1 2009-11-06 Doug Kwan <dougkwan@google.com>
3 * arm.cc (class Reloc_stub): Correct a comment.
4 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5 (Target_arm::scan_section_for_stubs): New method declaration.
6 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7 Change methods from private to protected.
8 (Target_arm::do_may_relax): New method definition.
9 (Target_arm::do_relax, Target_arm::group_sections,
10 Target_arm::scan_reloc_for_stub,
11 Target_arm::scan_reloc_section_for_stubs): New method declarations.
12 (Target_arm::arm_input_section_map_): New data member declaration.
13 (Target_arm::scan_reloc_for_stub,
14 Target_arm::scan_reloc_section_for_stubs,
15 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
16 Target_arm::do_relax): New method definitions.
18 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
20 * configure.ac: Check for (struct stat)::st_mtim
21 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
22 * config.in: Regenerate.
23 * configure: Regenerate.
25 2009-11-05 Ian Lance Taylor <iant@google.com>
28 * output.cc (Output_segment::add_output_section): Add missing
31 2009-11-04 Ian Lance Taylor <iant@google.com>
34 * object.h (class Object): Add is_needed and set_is_needed
35 methods. Add is_needed_ field. Make bool fields into bitfields.
36 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
37 defined in a dynamic object and referenced by a regular object,
38 set is_needed for the dynamic object.
39 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
40 if the file is marked with as_needed and it is not needed.
42 2009-11-04 Ian Lance Taylor <iant@google.com>
45 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
46 tags if data is discarded by linker script.
47 * i386.cc (Target_i386::do_finalize_sections): Likewise.
48 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
49 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
50 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
52 2009-11-04 Ian Lance Taylor <iant@google.com>
54 * layout.cc (Layout::get_output_section): Add is_interp and
55 is_dynamic_linker_section parameters. Change all callers.
56 (Layout::choose_output_section): Likewise.
57 (Layout::make_output_section): Likewise.
58 (Layout::add_output_section_data): Add is_dynamic_linker_section
59 parameter. Change all callers.
60 * layout.h (class Layout): Update declarations.
61 * output.h (class Output_section): Add is_interp, set_is_interp,
62 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
63 Add is_interp_, is_dynamic_linker_section_ fields. Change
64 generate_code_fills_at_write_ to a bitfield.
65 * output.cc (Output_section::Output_sections): Initialize new
67 (Output_segment::add_output_section): Add do_sort parameter.
70 2009-11-03 Ian Lance Taylor <iant@google.com>
73 * options.h (class General_options): Add --warn-common.
74 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
75 merging two common symbols.
76 (Symbol_table::should_override): Handle --warn-common when merging
77 a common symbol with a defined symbol. Use report_resolve_problem
78 for multiple definitions.
79 (Symbol_table::report_resolve_problem): New function.
80 * symtab.h (class Symbol_table): Declare report_resolve_problem.
82 2009-11-03 Doug Kwan <dougkwan@google.com>
84 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
86 (Target_arm::stub_factory): New method definition.
87 (Target_arm::new_arm_input_section,
88 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
89 Target_arm::reloc_uses_thumb_bit): New method declarations.
90 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
92 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
94 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
95 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
96 New method definitions.
98 2009-11-03 Ian Lance Taylor <iant@google.com>
100 * options.h (class General_options): Add --warn_constructors.
102 2009-11-03 Ian Lance Taylor <iant@google.com>
105 * defstd.cc (in_section): Add entries for __rel_iplt_start,
106 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
108 2009-11-03 Ian Lance Taylor <iant@google.com>
111 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
112 --msgid-bugs-address.
113 (install-pdf): New target.
114 (install-data_yes): Look up one directory to find mkinstalldirs.
116 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
118 * po/Make-in (.po.gmo): Don't generate .gmo files in source
121 2009-10-30 Doug Kwan <dougkwan@google.com>
123 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
125 2009-10-30 Doug Kwan <dougkwan@google.com>
127 * arm.cc (Stub_addend_reader): New struct template definition
128 and partial specializations.
129 (Stub_addend_reader::operator()): New method definition for a
130 partially specialized template.
132 2009-10-30 Doug Kwan <dougkwan@google.com>
134 * arm.cc (Arm_relobj::processor_specific_flags): New method
136 (Arm_relobj::do_read_symbols): New method declaration.
137 (Arm_relobj::processor_specific_flags_): New data member declaration.
138 (Arm_dynobj): New class definition.
139 (Target_arm::do_finalize_sections): Add input_objects parameter.
140 (Target_arm::do_adjust_elf_header): New method declaration.
141 (Target_arm::are_eabi_versions_compatible,
142 (Target_arm::merge_processor_specific_flags): New method declaration.
143 (Target_arm::do_make_elf_object): New overloaded method definitions
145 (Arm_relobj::do_read_symbols): New method definition.
146 (Arm_dynobj::do_read_symbols): Ditto.
147 (Target_arm::do_finalize_sections): Add input_objects parameters.
148 Merge processor-specific flags from all input objects.
149 (Target_arm::are_eabi_versions_compatible,
150 Target_arm::merge_processor_specific_flags,
151 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
152 New method definitions.
153 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
154 Input_objects pointer type parameter.
155 * layout.cc (Layout::finalize): Pass input objects to target's.
156 finalize_sections function.
157 * output.cc (Output_file_header::do_sized_write): Set ELF file
158 header's processor-specific flags.
159 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
160 Input_objects pointer type parameter.
161 * sparc.cc (Target_sparc::do_finalize_sections): Same.
162 * target.h (Input_objects): New forward class declaration.
163 (Target::processor_specific_flags,
164 Target::are_processor_specific_flags_sect): New method definitions.
165 (Target::finalize_sections): Add input_objects parameter.
166 (Target::Target): Initialize processor_specific_flags_ and
167 are_processor_specific_flags_set_.
168 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
170 (Target::set_processor_specific_flags): New method definition.
171 (Target::processor_specific_flags_,
172 Target::are_processor_specific_flags_set_): New data member
174 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
175 Input_objects pointer type parameter.
177 2009-10-30 Doug Kwan <dougkwan@google.com>
179 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
181 2009-10-28 Ian Lance Taylor <iant@google.com>
183 * object.h (class Relobj): Drop options parameter from
184 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
185 do_scan_relocs, do_relocate. Change all callers.
186 (class Sized_relobj): Drop options parameters from
187 do_gc_process_relocs, do_scan_relocs, do_relocate,
188 do_relocate_sections, relocate_sections, emit_relocs_scan,
189 emit_relocs_scan_reltype. Change all callers.
190 (struct Relocate_info): Remove options field and all references to
192 * reloc.h (class Read_relocs): Remove options constructor
193 parameter and options_ field. Change all callers.
194 (class Gc_process_relocs, class Scan_relocs): Likewise.
195 (class Relocate_task): Likewise.
196 * target-reloc.h (scan_relocs): Remove options parameter. Change
198 (scan_relocatable_relocs): Likewise.
199 * target.h (class Sized_target): Remove options parameter from
200 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
202 * gc.h (gc_process_relocs): Remove options parameter. Change all
204 * arm.cc: Update functions to remove options parameters.
206 * powerpc.cc: Likewise.
207 * sparc.cc: Likewise.
208 * x86_64.cc: Likewise.
209 * testsuite/testfile.cc: Likewise.
211 2009-10-28 Doug Kwan <dougkwan@google.com>
213 * arm.cc (Arm_relobj): New class definition.
214 (Arm_relobj::scan_sections_for_stubs,
215 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
216 New method definitions.
218 2009-10-28 Cary Coutant <ccoutant@google.com>
220 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
221 (Plugin::cleanup_done_): New member.
222 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
223 (Plugin_manager::cleanup_done_): Remove.
224 (Plugin_manager::add_input_file): Edit error message.
225 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
226 (Plugin_manager::cleanup): Remove use of cleanup_done_.
228 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
230 * fileread.cc: (File_read::View::~View): Use the new
231 data_ownership_ filed.
232 (File_read::~File_read): Dispose the new whole_file_view_.
233 (File_read::open): Mmap the whole file if needed.
234 (File_read::open): Use whole_file_view_ instead of contents_.
235 (File_read::find_view): Use whole_file_view_ if applicable.
236 (File_read::do_read): Use whole_file_view_ instead of contents_.
237 (File_read::make_view): Use whole_file_view_ instead of contents_,
238 update File_read::View::View call.
239 (File_read::find_or_make_view): Update File_read::View::View
241 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
243 (File_read::View::Data_ownership): New enum.
244 (File_read::View::View): Replace bool mapped_ with Data_ownership
246 (File_read::View::mapped_): Remove (replaced by data_ownership_).
247 (File_read::View::data_ownership_): New field.
248 (File_read::contents_): Remove (replaced by whole_file_view_).
249 (File_read::whole_file_view_): New field.
250 * options.h (class General_options): Add --keep-files-mapped.
252 2009-10-27 Cary Coutant <ccoutant@google.com>
254 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
255 * testsuite/Makefile.am (plugin_test_5): New test case.
256 * testsuite/Makefile.in: Regenerate.
258 2009-10-25 Doug Kwan <dougkwan@google.com>
260 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
261 from private to protected to allow access by child class.
262 (Sized_relobj::do_relocate_sections): New method declaration.
263 (Sized_relobj::relocate_sections): Virtualize.
264 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
265 Sized_relobj::relocate_sections. Instantiate template explicitly
266 for different target sizes and endianity.
268 2009-10-24 Doug Kwan <dougkwan@google.com>
270 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
271 (Arm_input_section::as_arm_input_section): New method.
272 (Arm_output_section): New class definition.
273 (Arm_output_section::create_stub_group,
274 Arm_output_section::group_sections): New method definitions.
276 2009-10-22 Doug Kwan <dougkwan@google.com>
278 * arm.cc (Arm_input_section): New class definition.
279 (Arm_input_section::init, Arm_input_section:do_write,
280 Arm_input_section::set_final_data_size,
281 Arm_input_section::do_reset_address_and_file_offset): New method
284 2009-10-21 Doug Kwan <dougkwan@google.com>
286 * arm.cc (Stub_table, Arm_input_section): New forward class
288 (Stub_table): New class defintion.
289 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
290 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
291 New method definition.
293 2009-10-21 Doug Kwan <dougkwan@google.com>
295 * arm.cc: Update copyright comments.
296 (Target_arm): New forward class template declaration.
297 (Arm_address): New type.
298 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
299 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
300 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
302 (Insn_template): Same.
303 (DEF_STUBS): New macro.
304 (Stub_type): New enum type.
305 (Stub_template): New class definition.
308 (Stub_factory): Same.
309 (Target_arm::Target_arm): Initialize may_use_blx_ and
310 should_force_pic_veneer_.
311 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
312 Target_arm::should_force_pic_veneer,
313 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
314 Target_arm::using_thumb_only, Target_arm:;default_target): New
316 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
317 New data member declarations.
318 (Insn_template::size, Insn_template::alignment): New method defintions.
319 (Stub_template::Stub_template): New method definition.
320 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
321 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
322 (Stub_factory::Stub_factory): New method definition.
323 * gold.h (string_hash): New template.
324 * output.h (Input_section_specifier::hash_value): Use
326 (Input_section_specifier::string_hash): Remove.
327 * stringpool.cc (Stringpool_template::string_hash): Use
330 2009-10-20 Doug Kwan <dougkwan@google.com>
332 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
333 symbols of relaxed input sections.
334 * output.h (Output_section::find_relaxed_input_section): Make
337 2009-10-16 Doug Kwan <dougkwan@google.com>
339 * dynobj.cc (Versions::Versions): Initialize version_script_.
340 Only insert base version symbol definition for a shared object
341 if version script defines any version versions.
342 (Versions::define_base_version): New method definition.
343 (Versions::add_def): Check that base version is not needed.
344 (Versions::add_need): Define base version lazily.
345 * dynobj.h (Versions::define_base_version): New method declaration.
346 (Versions::needs_base_version_): New data member declaration.
347 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
348 (check_DATA): Add no_version_test.stdout.
349 (libno_version_test.so, no_version_test.o no_version_test.stdout):
351 * testsuite/Makefile.in: Regenerate.
352 * testsuite/no_version_test.c: New file.
353 * testsuite/no_version_test.sh: Ditto.
355 2009-10-16 Doug Kwan <dougkwan@google.com>
357 * expression.cc (class Segment_start_expression): New class definition.
358 (Segment_start_expression::value): New method definition.
359 (script_exp_function_segment_start): Return a new
360 Segment_start_expression.
361 * gold/script-c.h (script_saw_segment_start_expression): New function
363 * script-sections.cc (Script_sections::Script_sections): Initialize
364 SAW_SEGMENT_START_EXPRESSION_ to false.
365 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
366 and -Tbbs options to specify section addresses if given in
367 command line and no SEGMENT_START expression is seen in a script.
368 * script-sections.h (Script_sections::saw_segment_start_expression,
369 Script_sections::set_saw_segment_start_expression): New method
371 (Script_sections::saw_segment_start_expression_): New data member
373 * script.cc (script_saw_segment_start_expression): New function.
374 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
375 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
376 script_test_7.sh and script_test_8.sh.
377 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
378 script_test_8.stdout.
379 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
380 (script_test_6, script_test_6.stdout, script_test_7,
381 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
382 * Makefile.in: Regenerate.
383 * testsuite/script_test_6.sh: New file.
384 * testsuite/script_test_6.t: Same.
385 * testsuite/script_test_7.sh: Same.
386 * testsuite/script_test_7.t: Same.
387 * testsuite/script_test_8.sh: Same.
389 2009-10-16 Doug Kwan <dougkwan@google.com>
391 * output.cc (Output_segment::set_section_list_address): Cast
392 expressions to unsigned long long type to avoid format warnings.
394 2009-10-15 Ian Lance Taylor <iant@google.com>
396 * script.cc (Script_options::add_symbol_assignment): Always add a
397 dot assignment to script_sections_.
398 * script-sections.cc (Script_sections::add_dot_assignment):
399 Initialize if necessary.
401 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
402 program headers with no load segment if there is a linker script.
404 * layout.cc (Layout::set_segment_offsets): Align the file offset
405 to the segment aligment for -N or -n with no load segment.
406 * output.cc (Output_segment::add_output_section): Don't crash if
407 the first section is a TLS section.
408 (Output_segment::set_section_list_addresses): Print an error
409 message if the address moves backward in a linker script.
411 (Output_section_element_input::set_section_addresses): Don't
412 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
413 (Orphan_output_section::set_section_addresses): Likewise.
415 2009-10-15 Doug Kwan <dougkwan@google.com>
417 * layout.cc (Layout::finish_dynamic_section): Generate tags
418 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
419 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
420 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
422 2009-10-14 Ian Lance Taylor <iant@google.com>
424 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
426 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
427 data_shdr fields of relinfo.
428 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
429 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
430 R_386_TLS_LDO_32, adjust based on section flags.
431 (Target_i386::Relocate::fix_up_ldo): Remove.
433 2009-10-13 Ian Lance Taylor <iant@google.com>
435 Add support for -pie.
436 * options.h (class General_options): Add -pie and
438 (General_options::output_is_position_independent): Test -pie.
439 (General_options::output_is_executable): Return true if not shared
441 (General_options::output_is_pie): Remove.
442 * options.cc (General_options::finalize): Reject incompatible uses
444 * gold.cc (queue_middle_tasks): A -pie link is not static.
445 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
446 * symtab.cc (Symbol::final_value_is_known): Return false if
447 output_is_position_independent.
448 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
449 output_is_position_independent.
450 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
451 output_is_position_independent.
452 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
453 output_is_position_independent.
454 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
456 (basic_pie_test.o, basic_pie_test): New targets.
457 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
458 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
459 (two_file_pie_test): New target.
460 * testsuite/Makefile.in: Rebuild.
461 * README: Remove note saying that -pie is not supported.
463 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
465 * options.h (class General_options): Add -init and -fini.
466 * layout.cc (Layout::finish_dynamic_section): Emit
467 given init and fini functions.
469 2009-10-13 Sriraman Tallam <tmsriram@google.com>
471 * gc.h (gc_process_relocs): Check if icf is enabled using new
473 * gold.cc (queue_initial_tasks): Likewise.
474 (queue_middle_tasks): Likewise.
475 * object.cc (do_layout): Likewise.
476 * symtab.cc (is_section_folded): Likewise.
477 * main.cc (main): Likewise.
478 * reloc.cc (Read_relocs::run): Likewise.
479 (Sized_relobj::do_scan_relocs): Likewise.
480 * icf.cc (is_function_ctor_or_dtor): New function.
481 (Icf::find_identical_sections): Check if function is ctor or dtor when
483 * options.h (General_options::icf): Change option to be an enum.
484 (Icf_status): New enum.
485 (icf_enabled): New method.
486 (icf_safe_folding): New method.
487 (set_icf_status): New method.
488 (icf_status_): New variable.
489 * (options.cc) (General_options::finalize): Set icf_status_.
490 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
491 icf_test and icf_keep_unique_test to use the --icf enum flag.
492 * testsuite/icf_safe_test.sh: New file.
493 * testsuite/icf_safe_test.cc: New file.
495 2009-10-12 Sriraman Tallam <tmsriram@google.com>
497 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
498 includes to gc.h and icf.h.
499 * arm.cc: Include gc.h.
502 * powerpc.cc: Likewise.
503 * sparc.cc: Likewise.
504 * x86_64.cc: Likewise.
505 * gc.h: Include icf.h.
507 2009-10-11 Ian Lance Taylor <iant@google.com>
509 * plugin.cc: Include "gold.h" before other header files.
511 2009-10-10 Chris Demetriou <cgd@google.com>
513 * options.h (Input_file_argument::Input_file_type): New enum.
514 (Input_file_argument::is_lib_): Replace with...
515 (Input_file_argument::type_): New member.
516 (Input_file_argument::Input_file_argument): Take Input_file_type
517 'type' rather than boolean 'is_lib' as second argument.
518 (Input_file_argument::is_lib): Use type_.
519 (Input_file_argument::is_searched_file): New function.
520 (Input_file_argument::may_need_search): Handle is_searched_file.
521 * options.cc (General_options::parse_library): Support -l:filename.
522 (General_options::parse_just_symbols): Update for Input_file_argument
524 (Command_line::process): Likewise.
525 * archive.cc (Archive::get_file_and_offset): Likewise.
526 * plugin.cc (Plugin_manager::release_input_file): Likewise.
527 * script.cc (read_script_file, script_add_file): Likewise.
528 * fileread.cc (Input_file::Input_file): Likewise.
529 (Input_file::will_search_for): Handle is_searched_file.
530 (Input_file::open): Likewise.
531 * readsyms.cc (Read_symbols::get_name): Likewise.
532 * testsuite/Makefile.am (searched_file_test): New test.
533 * testsuite/Makefile.in: Regenerate.
534 * testsuite/searched_file_test.cc: New file.
535 * testsuite/searched_file_test_lib.cc: New file.
537 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
538 Ian Lance Taylor <iant@google.com>
540 * descriptor.cc: Include <cstdio> and "binary-io.h".
541 (Descriptors::open): Open the files in binary mode always.
542 * script.cc (Lex::get_token): Treat \r as whitespace.
544 2009-10-09 Ian Lance Taylor <iant@google.com>
546 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
548 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
549 Ian Lance Taylor <iant@google.com>
551 * configure.ac: Check for readv function also.
552 * fileread.cc (readv): Define if not HAVE_READV.
553 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
555 * config.in: Regenerate.
556 * configure: Regenerate.
558 2009-10-09 Doug Kwan <dougkwan@google.com>
560 * layout.cc (Layout::make_output_section): Call target hook to make
561 ordinary output section.
562 (Layout::finalize): Adjust parameter list of call the
564 * layout.h (class Layout::section_list): New method.
565 * merge.h (Output_merge_base::entsize): Change visibility to public.
566 (Output_merge_base::is_string, Output_merge_base::do_is_string):
568 (Output_merge_string::do_is_string): New method.
569 * object.cc (Sized_relobj::do_setup): renamed from
570 Sized_relobj::set_up.
571 * object.h (Sized_relobj::adjust_shndx,
572 Sized_relobj::initializ_input_to_output_maps,
573 Sized_relobj::free_input_to_output_maps): Change visibilities to
575 (Sized_relobj::setup): Virtualize.
576 (Sized_relobj::do_setup): New method declaration.
577 (Sized_relobj::invalidate_section_offset,
578 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
579 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
580 * options.cc (parse_int): New function.
581 * options.h (parse_int): New declaration.
582 (DEFINE_int): New macro.
583 (stub_group_size): New option.
584 * output.cc (Output_section::Output_section): Initialize memebers
585 merge_section_map_, merge_section_by_properties_map_,
586 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
587 (Output_section::add_input_section): Handled deferred code-fill
588 generation and remove an old comment.
589 (Output_section::add_relaxed_input_section): New method definition.
590 (Output_section::add_merge_input_section): Use merge section by
591 properties map to speed to search. Update merge section maps
593 (Output_section::build_relaxation_map): New method definition.
594 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
596 (Output_section::relax_input_section): Renamed to
597 Output_section::convert_input_sections_to_relaxed_sections and change
598 interface to take a vector of pointers to relaxed sections.
599 (Output_section::find_merge_section,
600 Output_section::find_relaxed_input_section): New method definitions.
601 (Output_section::is_input_address_mapped,
602 Output_section::output_offset, Output_section::output_address):
603 Use output section data maps to speed up searching.
604 (Output_section::find_starting_output_address): Add comments.
605 (Output_section::do_write,
606 Output_section::write_to_postprocessing_buffer): Do code-fill
607 generation as appropriate.
608 (Output_section::get_input_sections): Invalidate relaxed input section
610 (Output_section::restore_states): Adjust type of checkpoint .
611 Invalidate relaxed input section map.
612 * output.h (Output_merge_base): New class declaration.
613 (Input_section_specifier): New class defintion.
614 (class Output_relaxed_input_section) Change base class to
615 Output_section_data_build.
616 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
617 base class initializer.
618 (Output_section::add_relaxed_input_section): New method declaration.
619 (Output_section::Input_section): Change visibility to protected.
620 (Output_section::Input_section::relobj,
621 Output_section::Input_section::shndx): Handle relaxed input sections.
622 Output_section::input_sections) Change visibility to protected. Also
623 define overload to return a non-const pointer.
624 (Output_section::Merge_section_properties): New class defintion.
625 (Output_section::Merge_section_by_properties_map,
626 Output_section::Output_section_data_by_input_section_map,
627 Output_section::Relaxation_map): New types.
628 (Output_section::relax_input_section): Rename method to
629 Output_section::convert_input_sections_to_relaxed_sections and change
630 interface to take a vector of relaxed section pointers.
631 (Output_section::find_merge_section,
632 Output_section::find_relaxed_input_section,
633 Output_section::build_relaxation_map,
634 Output_section::convert_input_sections_in_list_to_relaxed_sections):
635 New method declarations.
636 (Output_section::merge_section_map_
637 Output_section::merge_section_by_properties_map_,
638 Output_section::relaxed_input_section_map_,
639 Output_section::is_relaxed_input_section_map_valid_,
640 Output_section::generate_code_fills_at_write_): New data members.
642 (Output_section_element_input::set_section_addresses): Call
643 current_data_size and addralign methods of relaxed input sections.
644 (Orphan_output_section::set_section_addresses): Call current_data_size
645 and addralign methods of relaxed input sections.
646 * symtab.cc (Symbol_table::compute_final_value): Extract template
647 from the body of Symbol_table::sized_finalize_symbol.
648 (Symbol_table::sized_finalized_symbol): Call
649 Symbol_table::compute_final_value.
650 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
651 (Symbol_table::compute_final_value): New templated method declaration.
652 * target.cc (Target::do_make_output_section): New method defintion.
653 * target.h (Target::make_output_section): New method declaration.
654 (Target::relax): Add more parameters for input objects, symbol table
655 and layout. Adjust call to do_relax.
656 (Target::do_make_output_section): New method declaration.
657 (Target::do_relax): Add parameters for input objects, symbol table
660 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
662 * pread.c: Include stdio.h.
664 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
666 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
669 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
671 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
672 Change read_shndx type to unsigned int.
673 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
675 (Sized_dwarf_line_info::read_line_mappings): Likewise.
676 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
677 Change read_shndx type to unsigned int.
678 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
680 (Sized_dwarf_line_info::read_line_mappings): Likewise.
681 * layout.cc (Layout::create_symtab_sections): Cast the result of
682 local_symcount * symsize to off_t in the gold_assert.
684 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
686 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
687 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
689 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
690 (Arm_relocate_functions::thm_abs5): New function.
691 (Arm_relocate_functions::abs12): New function.
692 (Arm_relocate_functions::abs16): New function.
693 (Arm_relocate_functions::base_abs): New function.
694 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
695 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
696 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
698 (Scan::global): Likewise.
699 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
700 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
701 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
702 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
705 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
707 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
708 (Arm_relocate_functions::movt_prel): New function.
709 (Arm_relocate_functions::thm_movw_prel_nc): New function.
710 (Arm_relocate_functions::thm_movt_prel): New function.
711 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
712 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
713 (Scan::global, Relocate::relocate): Likewise.
714 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
716 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
718 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
720 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
722 (class Incremental_inputs_header): New class.
723 (Incremental_inputs_header_writer): Edit comment.
724 (Incremental_inputs_entry): New class.
725 (Incremental_inputs_entry_writer): Edit comment.
726 (Sized_incremental_binary::do_find_incremental_inputs_section):
727 Add *strtab_shndx parameter, fill it.
728 (Sized_incremental_binary::do_check_inputs): New method.
729 (Incremental_checker::can_incrementally_link_output_file): Use
730 Sized_incremental_binary::check_inputs.
731 (Incremental_inputs::report_command_line): Save command line in
734 (Incremental_binary::find_incremental_inputs_section): New
736 (Incremental_binary::do_find_incremental_inputs_section): Add
737 strtab_shndx parameter.
738 (Incremental_binary::do_check_inputs): New pure virtual method.
739 (Sized_incremental_binary::do_check_inputs): Declare.
740 (Incremental_checker::Incremental_checker): Add incremental_inputs
741 parameter, use it to initialize incremental_inputs_.
742 (Incremental_checker::incremental_inputs_): New field.
743 (Incremental_checker::command_line): New method.
744 (Incremental_checker::inputs): New method.
745 (Incremental_checker::command_line_): New field.
747 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
749 * incremental.cc: Include <cstdarg> and "target-select.h".
750 (vexplain_no_incremental): New function.
751 (explain_no_incremental): New function.
752 (Incremental_binary::error): New method.
753 (Sized_incremental_binary::do_find_incremental_inputs_section): New
755 (make_sized_incremental_binary): New function.
756 (open_incremental_binary): New function.
757 (can_incrementally_link_file): Add checks if output is ELF and has
759 * incremental.h: Include "elfcpp_file.h" and "output.h".
760 (Incremental_binary): New class.
761 (Sized_incremental_binary): New class.
762 (open_incremental_binary): Declare.
763 * object.cc (is_elf_object): Use
764 elfcpp::Elf_recognizer::is_elf_file.
765 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
766 * output.h (Output_file::filesize): New method.
768 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
770 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
772 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
773 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
775 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
777 (Arm_relocate_functions::movw_abs_nc): New function.
778 (Arm_relocate_functions::movt_abs): New function.
779 (Arm_relocate_functions::thm_movw_abs_nc): New function.
780 (Arm_relocate_functions::thm_movt_abs): New function.
781 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
782 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
783 (Scan::global): Likewise.
784 (Relocate::relocate): Likewise.
785 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
787 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
789 * arm.cc (Arm_relocate_functions::got_prel) New function.
790 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
791 (Relocate::relocate): Likewise.
792 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
794 2009-10-06 Ian Lance Taylor <iant@google.com>
796 * options.h (class General_options): Define
797 split_stack_adjust_size parameter.
798 * object.h (class Object): Add uses_split_stack_ and
799 has_no_split_stack_ fields. Add uses_split_stack and
800 has_no_split_stack accessor functions. Declare
801 handle_split_stack_section.
802 (class Reloc_symbol_changes): Define.
803 (class Sized_relobj): Define Function_offsets. Declare
804 split_stack_adjust, split_stack_adjust_reltype, and
806 * object.cc (Object::handle_split_stack_section): New function.
807 (Sized_relobj::do_layout): Call handle_split_stack_section.
808 * dynobj.cc (Sized_dynobj::do_layout): Call
809 handle_split_stack_section.
810 * reloc.cc (Sized_relobj::relocate_sections): Call
811 split_stack_adjust for executable sections in split_stack
812 objects. Pass reloc_map to relocate_section.
813 (Sized_relobj::split_stack_adjust): New function.
814 (Sized_relobj::split_stack_adjust_reltype): New function.
815 (Sized_relobj::find_functions): New function.
816 * target-reloc.h: Include "object.h".
817 (relocate_section): Add reloc_symbol_changes parameter. Change
819 * target.h (class Target): Add calls_non_split method. Declare
820 do_calls_non_split virtual method. Declare match_view and
822 * target.cc: Include "elfcpp.h".
823 (Target::do_calls_non_split): New function.
824 (Target::match_view): New function.
825 (Target::set_view_to_nop): New function.
826 * gold.cc (queue_middle_tasks): Give an error if mixing
827 split-stack and non-split-stack objects with -r.
828 * i386.cc (Target_i386::relocate_section): Add
829 reloc_symbol_changes parameter.
830 (Target_i386::do_calls_non_split): New function.
831 * x86_64.cc (Target_x86_64::relocate_section): Add
832 reloc_symbol_changes parameter.
833 (Target_x86_64::do_calls_non_split): New function.
834 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
836 * powerpc.cc (Target_powerpc::relocate_section): Add
837 reloc_symbol_changes parameter.
838 * sparc.cc (Target_sparc::relocate_section): Add
839 reloc_symbol_changes parameter.
840 * configure.ac: Call AM_CONDITIONAL for the default target.
841 * configure: Rebuild.
842 * testsuite/Makefile.am (TEST_AS): New variable.
843 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
844 (check_DATA): Add split_i386 and split_x86_64 files.
845 (SPLIT_DEFSYMS): Define.
846 (split_i386_[1234n].o): New targets.
847 (split_i386_[124]): New targets.
848 (split_i386_[1234r].stdout): New targets.
849 (split_x86_64_[1234n].o): New targets.
850 (split_x86_64_[124]): New targets.
851 (split_x86_64_[1234r].stdout): New targets.
852 (MOSTLYCLEANFILES): Add new executables.
853 * testsuite/split_i386.sh: New file.
854 * testsuite/split_x86_64.sh: New file.
855 * testsuite/split_i386_1.s: New file.
856 * testsuite/split_i386_2.s: New file.
857 * testsuite/split_i386_3.s: New file.
858 * testsuite/split_i386_4.s: New file.
859 * testsuite/split_i386_n.s: New file.
860 * testsuite/split_x86_64_1.s: New file.
861 * testsuite/split_x86_64_2.s: New file.
862 * testsuite/split_x86_64_3.s: New file.
863 * testsuite/split_x86_64_4.s: New file.
864 * testsuite/split_x86_64_n.s: New file.
865 * testsuite/testfile.cc (Target_test): Update relocation_section
867 * testsuite/Makefile.in: Rebuild.
869 2009-10-06 Ian Lance Taylor <iant@google.com>
871 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
872 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
873 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
874 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
875 the address on ldo_addrs_.
876 (Target_i386::Relocate::fix_up_ldo): New function.
878 2009-10-06 Rafael Espindola <espindola@google.com>
880 * plugin.cc (add_input_library): New.
881 (Plugin::load): Add add_input_library to tv.
882 (Plugin_manager::add_input_file): Add the is_lib argument.
883 (add_input_file): Update call to Plugin_manager::add_input_file.
884 (add_input_library): New.
885 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
887 2009-09-30 Doug Kwan <dougkwan@google.com>
889 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
890 symbol and call Symbol::may_need_copy_reloc to determine if
891 a copy reloc is needed.
892 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
893 nocopyreloc is given in command line.
894 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
895 given in command line.
896 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
897 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
898 of the removed Target_i386::may_need_copy_reloc.
899 * options.h (copyreloc): New option with default value false.
900 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
901 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
902 instead of the removed Target_powerpc::may_need_copy_reloc.
903 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
904 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
905 instead of the removed Target_sparc::may_need_copy_reloc.
906 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
907 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
908 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
909 instead of the removed Target_x86_64::may_need_copy_reloc.
911 2009-09-30 Ian Lance Taylor <iant@google.com>
913 * object.h (class Object): Remove target_ field, and target,
914 sized_target, and set_target methods.
915 (Object::sized_target): Remove.
916 (class Sized_relobj): Update declarations. Remove sized_target.
917 * object.cc (Sized_relobj::setup): Remove target parameter.
919 (Input_objects::add_object): Don't do anything with the target.
920 (make_elf_sized_object): Add punconfigured parameter. Change all
921 callers. Set or test parameter target.
922 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
924 * parameters.cc (Parameters::set_target): Change parameter type to
926 (Parameters::default_target): Remove.
927 (set_parameters_target): Change parameter type to be non-const.
928 (parameters_force_valid_target): New function.
929 (parameters_clear_target): New function.
930 * parameters.h (class Parameters): Update declarations. Remove
931 default_target method. Add sized_target and clear_target
932 methods. Change target_ to be non-const.
933 (set_parameters_target): Update declaration.
934 (parameters_force_valid_target): Declare.
935 (parameters_clear_target): Declare.
936 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
937 as NULL if we aren't searching.
938 (Add_symbols::run): Don't check for compatible target.
939 * fileread.cc (Input_file::open_binary): Call
940 parameters_force_valid_target.
941 * gold.cc (queue_middle_tasks): Likewise.
942 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
943 set_target on object.
944 * dynobj.h (class Sized_dynobj): Update declarations.
945 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
946 make_elf_object returns NULL.
947 (Archive::include_member): Don't check whether object target is
949 * output.cc (Output_section::add_input_section): Get target from
951 (Output_section::relax_input_section): Likewise.
952 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
954 (Sized_relobj::do_scan_relocs): Likewise.
955 (Sized_relobj::relocate_sections): Likewise.
956 * resolve.cc (Symbol_table::resolve): Likewise.
957 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
958 parameter. Change all callers.
959 (Symbol_table::add_from_object): Get target from parameters.
960 (Symbol_table::add_from_relobj): Don't check object target.
961 (Symbol_table::add_from_dynobj): Likewise.
962 (Symbol_table::define_special_symbol): Get target from
964 * symtab.h (class Symbol_table): Update declaration.
965 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
966 parameter. Change all callers. Clear parameter target.
967 (Binary_test): Test target here.
968 * testsuite/object_unittest.cc (gold_testsuite): Remove
969 target_test_pointer parameter. Change all callers.
970 (Object_test): Test target here.
972 2009-09-26 Ian Lance Taylor <iant@google.com>
974 * testsuite/initpri1.c: Don't try to use constructor priorities if
975 compiling with gcc before 4.3.
977 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
979 * testsuite/retain_symbols_file_test.sh (check_present): Change
980 output file name to retain_symbols_file_test.stdout.
981 (check_absent): Likewise.
983 2009-09-18 Craig Silverstein <csilvers@google.com>
985 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
986 * options.cc: Include <cerrno> and <fstream>.
987 (General_options::finalize): Parse -retain-symbols-file tag.
988 * options.h: New flag.
989 (General_options): New method should_retain_symbol, new
990 variable symbols_to_retain.
991 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
992 should_retain_symbol map.
993 * testsuite/Makefile.am (retain_symbols_file_test): New test.
994 * testsuite/Makefile.in: Regenerate.
995 * testsuite/retain_symbols_file_test.sh: New file.
997 2009-09-18 Nick Clifton <nickc@redhat.com>
999 * po/es.po: Updated Spanish translation.
1001 2009-09-17 Doug Kwan <dougkwan@google.com>
1003 * debug.h (DEBUG_RELAXATION): New constant.
1004 (DEBUG_ALL): Add DEBUG_RELAXATION.
1005 (debug_string_to_enum): Add relaxation debug option.
1007 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
1008 Layout::Relaxation_debug_check::read_sections,
1009 Layout::Relaxation_debug_check::read_sections): New method definitions.
1010 (Layout::Layout): Initialize data members
1011 record_output_section_data_from_scrips_,
1012 script_output_section_data_list_ and relaxation_debug_check_.
1013 (Layout::save_segments, Layout::restore_segments,
1014 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1015 Layout::relaxation_loop_body): New method definitions.
1016 (Layout::finalize): Support relaxation. Move section layout code to
1017 Layout::relaxation_loop_body.
1018 (Layout::set_asection_address_from_script): Move code for orphan
1019 section placement out.
1020 (Layout::place_orphan_sections_in_script): New method definition.
1021 * layout.h (Output_segment_headers, Output_file_header):
1022 New forward class declarations.
1023 (Layout::~Layout): Define.
1024 (Layout::new_output_section_data_from_script): New method definition.
1025 (Layout::place_orphan_sections_in_script): New method declaration.
1026 (Layout::Segment_states): New type declaration.
1027 (Layout::save_segments, Layout::restore_segments,
1028 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1029 Layout::relaxation_loop_body): New method declarations.
1030 (Layout::Output_section_data_list): New type declaration.
1031 (Layout::Relaxation_debug_check): New class definition.
1032 (Layout::record_output_section_data_from_script_,
1033 Layout::script_output_section_data_list_, Layout::segment_states_,
1034 Layout::relaxation_debug_check_): New data members.
1035 * output.cc: (Output_section_headers::do_size): New method definition.
1036 (Output_section_headers::Output_section_headers): Move size
1037 computation to Output_section_headers::do_size.
1038 (Output_segment_headers::do_size): New method definition.
1039 (Output_file_header::Output_file_header): Move size computation to
1040 Output_file_header::do_size and call it.
1041 (Output_file_header::do_size): New method definition.
1042 (Output_data_group::Output_data_group): Adjust call to
1043 Output_section_data.
1044 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
1045 (Output_symtab_xindex::do_write): Add array bound check.
1046 (Output_section::Input_section::print_to_mapfile): Handle
1047 RELAXED_INPUT_SECTION_CODE.
1048 (Output_section::Output_section): Initialize data member checkpoint_.
1049 (Output_section::~Output_section): Delete checkpoint object pointed
1051 (Output_section::add_input_section): Always add an Input_section if
1053 (Output_section::add_merge_input_section): Add assert.
1054 (Output_section::relax_input_section): New method definition.
1055 (Output_section::set_final_data_size): Set load address to zero for
1056 an unallocated section.
1057 (Output_section::do_address_and_file_offset_have_reset_values):
1058 New method definition.
1059 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
1060 Handle relaxed input section.
1061 (Output_section::sort_attached_input_sections): Checkpoint input
1062 section list lazily.
1063 (Output_section::get_input_sections): Change type of input_sections to
1064 list of Simple_input_section pointers. Checkpoint input section list
1065 lazily. Also handle relaxed input sections.
1066 (Output_section::add_input_section_for_script): Take a reference to
1067 a Simple_input_section object instead of Relobj pointer and section
1068 index as parameter. Handle relaxed input sections.
1069 (Output_section::save_states, Output_section::restore_states): New
1071 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
1072 (Output_data::is_data_size_fixed): New method definition.
1073 (Output_data::reset_addresss_and_file_offset): Do not reset data size
1075 (Output_data::address_and_file_offset_have_reset_values): New method
1077 (Output_data::do_address_and_file_offset_have_reset_values): New method
1079 (Output_data::set_data_size): Check that data size is not fixed.
1080 (Output_data::fix_data_size): New method definition.
1081 (Output_data::is_data_size_fixed_): New data member.
1082 (Output_section_headers::set_final_data_size): New method definition.
1083 (Output_section_headers::do_size): New method declaration.
1084 (Output_segment_headers::set_final_data_size): New method definition.
1085 (Output_segment_headers::do_size): New method declaration.
1086 (Output_file_header::set_final_data_size)::New method definition.
1087 (Output_file_header::do_size)::New method declaration.
1088 (Output_section_data::Output_section_data): Add new parameter
1089 is_data_size_fixed and use it to fix data size.
1090 (Output_data_const::Output_data_const): Adjust call to base class
1091 constructor and fix data size.
1092 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
1093 base class constructor and fix data size.
1094 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
1095 base class constructor and fix data size.
1096 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
1097 class constructor and fix data size.
1098 (Output_data_group::set_final_data_size): New method definition.
1099 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
1100 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
1101 class constructor and fix data size.
1102 (Output_relaxed_input_section): New class definition.
1103 (Output_section::Simple_input_section): New class definition.
1104 (Output_section::get_input_sections): Adjust parameter list.
1105 (Output_section::add_input_section_for_script): Same.
1106 (Output_section::save_states, Output_section::restore_states,
1107 Output_section::do_address_and_file_offset_have_reset_values,
1108 (Output_section::Input_section::Input_section): Handle
1109 RELAXED_INPUT_SECTION_CODE. Add new overload for
1110 Output_relaxed_input_section.
1111 (Output_section::Input_section::is_input_section,
1112 Output_section::Input_section::set_output_section): Handle relaxed
1114 (Output_section::Input_section::is_relaxed_input_section,
1115 Output_section::Input_section::output_section_data,
1116 Output_section::Input_section::relaxed_input_section): New method
1118 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
1120 (Output_section::Input_section::u1_): Update comments.
1121 (Output_section::Input_section::u2_): Add new union member poris.
1122 (Output_section::Checkpoint_output_section): New classs definition.
1123 (Output_section::relax_input_section): New method declaration.
1124 (Output_section::checkpoint_): New data member.
1125 (Output_segment): Update comments.
1126 (Output_segment::Output_segment): Un-privatize copy constructor.
1127 (Output_segment::operator=): Un-privatize.
1128 * script-sections.cc (Output_section_element::Input_section_list):
1129 Change element type to Output_section::Simple_input_section.
1130 (Output_section_element_dot_assignment::set_section_addresses):
1131 Register output section data for relaxation clean up.
1132 (Output_data_exression::Output_data_expression): Adjust call to base
1133 constructor to fix data size.
1134 (Output_section_element_data::set_section_addresses): Register
1135 Output_data_expression object for relaxation clean up.
1136 (struct Input_section_info): Replace Relobj pointer and section index
1137 pair with Output_section::Simple_input_section and Convert struct to a
1139 (Input_section_sorter::operator()): Adjust access to
1140 Input_section_info data member to use accessors.
1141 (Output_section_element_input::set_section_addresses): Use layout
1142 parameter. Adjust code to use Output_section::Simple_input_section
1143 and Input_secction_info classes. Register filler for relaxation
1145 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
1146 and section index pair with Output_section::Simple_input_section
1147 class. Adjust code accordingly.
1148 (Phdrs_element::release_segment): New method definition.
1149 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
1151 (Script_sections::release_segments): New method definition.
1152 * gold/script-sections.h (Script_sections::release_segments): New
1154 * gold/target.h (Target::may_relax, Target::relax,
1155 Target::do_may_relax, Target::do_relax): New method definitions.
1157 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1159 * arm.cc (has_signed_unsigned_overflow): New function.
1160 (Arm_relocate_functions::abs8): New function.
1161 (Target_arm::Scan::local): Handle R_ARM_ABS8.
1162 (Target_arm::Scan::global): Likewise.
1163 (Target_arm::relocate::relocate): Likewise.
1164 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1167 2009-09-16 Cary Coutant <ccoutant@google.com>
1169 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
1170 * testsuite/Makefile.in: Regenerate.
1172 2009-09-11 Nick Clifton <nickc@redhat.com>
1174 * po/gold.pot: Updated by the Translation project.
1176 2009-09-08 Cary Coutant <ccoutant@google.com>
1178 * output.cc (Output_file::open): Add execute permission to empty file.
1179 * testsuite/Makefile.am (permission_test): New test.
1180 * testsuite/Makefile.in: Regenerate.
1182 2009-09-02 Ian Lance Taylor <iant@google.com>
1184 * output.cc (Output_file::resize): Call map_no_anonymous rather
1187 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
1189 * gold.cc: Include "incremental.h".
1190 (queue_initial_tasks): Call Incremental_checker methods.
1191 * incremental.cc: Include "output.h".
1192 (Incremental_checker::can_incrementally_link_output_file): New
1194 * incremental.h (Incremental_checker): New class.
1196 * output.cc (Output_file::open_for_modification): New method.
1197 (Output_file::map_anonymous): Changed return type to bool. Record
1199 (Output_file::map_no_anonymous): New method, broken out of map.
1200 (Output_file::map): Use map_no_anonymous and map_anonymous.
1201 * output.h (class Output_file): Update declarations.
1203 2009-08-24 Cary Coutant <ccoutant@google.com>
1205 * options.h (Command_line::Pre_options): New class.
1206 (Command_line::pre_options): New member.
1207 * options.cc (gold::options::ready_to_register): New variable.
1208 (One_option::register_option): Do nothing if not registering options.
1209 Assert if same short option registered twice.
1210 (General_options::General_options): Turn off option registration when
1212 (Command_line::Pre_options::Pre_options): New constructor.
1214 2009-08-24 Cary Coutant <ccoutant@google.com>
1216 * options.h (General_options::no_keep_memory): Remove incorrect
1219 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1221 * Makefile.am (am__skiplex, am__skipyacc): New.
1222 * Makefile.in: Regenerate.
1224 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1226 * Makefile.am (AM_CPPFLAGS): Renamed from ...
1227 (INCLUDES): ... this.
1228 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
1229 (AM_CPPFLAGS): Renamed from ...
1230 (INCLUDE): ... this.
1231 * Makefile.in, testsuite/Makefile.in: Regenerate.
1233 * Makefile.in: Regenerate.
1234 * aclocal.m4: Likewise.
1235 * config.in: Likewise.
1236 * configure: Likewise.
1237 * testsuite/Makefile.in: Likewise.
1239 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1240 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1241 * Makefile.in: Regenerate.
1242 * testsuite/Makefile.in: Regenerate.
1244 2009-08-19 Cary Coutant <ccoutant@google.com>
1246 * resolve.cc (Symbol_table::resolve): Don't complain about defined
1247 symbols in shared libraries overridden by hidden or internal symbols
1248 in the main program.
1250 2009-08-19 Chris Demetriou <cgd@google.com>
1252 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
1253 checking source file names in error messages.
1255 2009-08-18 Doug Kwan <dougkwan@google.com>
1257 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
1258 an elcpp::Ehdr as parameter. Adjust call to set_target.
1259 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
1260 an elfcpp::Ehdr as parameter.
1261 * object.cc (Object::set_target): Remove the version that looks up
1262 a target and sets it.
1263 (Sized_relobj::setup): Take a Target object instead of
1264 an elfcpp::Ehdr as parameter. Adjust call to set_target.
1265 (make_elf_sized_object): Find target and ask target to
1267 * object.h: (Object::set_target): Remove the version that looks up
1268 a target and sets it.
1269 (Sized_relobj::setup): Take a Target object instead of
1270 an elfcpp:Ehdr as parameter.
1271 * target.cc: Include dynobj.h.
1272 (Target::do_make_elf_object_implementation): New.
1273 (Target::do_make_elf_object): New.
1274 * target.h (Target::make_elf_object): New template declaration.
1275 (Target::do_make_elf_object): New method declarations.
1276 (Target::do_make_elf_object_implementation): New template declaration.
1278 2009-08-14 Ian Lance Taylor <iant@google.com>
1280 * gold.h (FUNCTION_NAME): Define.
1281 (gold_unreachable): Use FUNCTION_NAME.
1283 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1285 * icf.cc (Icf::find_identical_sections): Issue a warning when a
1286 symbol in the --keep-unique list is not found.
1288 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1290 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
1291 been maked as --keep-unique.
1292 (Icf::unfold_section): New function.
1293 * icf.h (Icf::unfold_section): New function.
1294 * options.h (General_options::keep_unique): New option.
1295 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
1296 * testsuite/Makefile.in: Regenerate.
1297 * testsuite/icf_keep_unique_test.sh: New file.
1298 * testsuite/icf_keep_unique_test.cc: New file.
1300 2009-08-12 Cary Coutant <ccoutant@google.com>
1303 * resolve.cc (Symbol_table::resolve): Check for references from
1304 dynamic objects to hidden and internal symbols.
1305 * testsuite/Makefile.am (hidden_test.sh): New test.
1306 * testsuite/Makefile.in: Regenerate.
1307 * testsuite/hidden_test.sh: New script.
1308 * testsuite/hidden_test_1.c: New test source.
1309 * testsuite/hidden_test_main.c: New test source.
1311 2009-08-11 Doug Kwan <dougkwan@google.com>
1313 * arm.cc: Update comments.
1314 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
1315 segment to locate the .ARM.exidx section if present.
1317 2009-08-09 Doug Kwan <dougkwan@google.com>
1319 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
1322 2009-08-07 Sriraman Tallam <tmsriram@google.com>
1323 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
1326 2009-08-06 Sriraman Tallam <tmsriram@google.com>
1328 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
1329 valid tls_segment only for non-debug-section relocations.
1330 * testsuite/Makefile.am: Add gc_tls_test.
1331 * testsuite/Makefile.in: Regenerate.
1332 * testsuite/gc_tls_test.cc: New file.
1333 * testsuite/gc_tls_test.sh: New file.
1335 2009-08-05 Sriraman Tallam <tmsriram@google.com>
1339 * Makefile.am (CCFILES): Add icf.cc.
1341 * Makefile.in: Regenerate.
1342 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
1343 * gc.h (gc_process_relocs): Populate lists used by icf to contain
1344 section, symbol and addend information for the relocs.
1345 * gold.cc (queue_middle_tasks): Call identical code folding.
1346 * gold.h: Add defines for multimap.
1347 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
1348 to the call of finalize_local_symbols.
1349 * main.cc (main): Create object of class Icf.
1350 * object.cc (Sized_relobj::do_layout): Allow this function to be
1351 called twice during icf.
1352 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
1353 to sections marked as identical by icf.
1354 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
1356 (Sized_relobj::do_section_entsize): New function.
1357 * object.h (Object::section_entsize): New function.
1358 (Object::do_section_entsize): New pure virtual function.
1359 (Relobj::finalize_local_symbols): Add new parameter.
1360 (Relobj::do_section_entsize): New function.
1361 * options.h (General_options::icf): New option.
1362 (General_options::icf_iterations): New option.
1363 (General_options::print_icf_sections): New option.
1364 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
1365 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
1366 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
1368 * symtab.cc (Symbol_table::is_section_folded): New function.
1369 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
1370 to sections marked as identical by icf.
1371 * symtab.h (Symbol_table::set_icf): New function.
1372 (Symbol_table::icf): New function.
1373 (Symbol_table::is_section_folded): New function.
1374 (Symbol_table::icf_): New data member.
1375 * target-reloc.h (relocate_section): Ignore sections folded by icf.
1376 * testsuite/Makefile.am: Add commands to build icf_test.
1377 * testsuite/Makefile.in: Regenerate.
1378 * testsuite/icf_test.sh: New file.
1379 * testsuite/icf_test.cc: New file.
1381 2009-07-24 Chris Demetriou <cgd@google.com>
1383 * layout.cc (is_compressible_debug_section): Fix incorrect
1384 comment about compressed section names.
1386 2009-07-20 Ian Lance Taylor <ian@airs.com>
1389 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
1391 2009-07-16 Ian Lance Taylor <iant@google.com>
1394 * layout.h: #include <map>.
1395 (class Kept_section): Change from struct to class. Add accessors
1396 and setters. Add section size to Comdat_group mapping. Change
1397 Comdat_group to std::map. Add is_comdat_ field. Add
1398 linkonce_size field in union.
1399 (class Layout): Update declaration of find_or_add_kept_section.
1400 Don't declare find_kept_object.
1401 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1402 parameter. Add object, shndx, is_comdat, and is_group_name
1403 parameters. Change all callers. Adjust for new Kept_section.
1404 (Layout::find_kept_object): Remove.
1405 * object.cc (Sized_relobj::include_section_group): Update use of
1406 Kept_section. Rename secnum to shndx. Only record
1407 Kept_comdat_section if sections are the same size.
1408 (Sized_relobj::include_linkonce_section): Update use of
1409 Kept_section. Only record Kept_comdat_section if sections are the
1410 same size. Set size of linkonce section.
1411 (Sized_relobj::map_to_kept_section): Update call to
1412 get_kept_comdat_section.
1413 * object.h (class Sized_relobj): Rename fields in
1414 Kept_comdat_section to drop trailing underscores; change object
1415 field to Relobj*. Change Kept_comdat_section_table to store
1416 struct rather than pointer.
1417 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1418 Add kept_object and kept_shndx parameters. Change all callers.
1419 (Sized_relobj::get_kept_comdat_section): Change return type to
1420 bool. Add kept_object and kept_shndx parameters. Change all
1422 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1423 Layout::find_or_add_kept_section.
1425 2009-07-09 Ian Lance Taylor <iant@google.com>
1427 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1428 Reserve space in the hash table.
1430 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1432 * fileread.cc (File_read::get_mtime): New method.
1433 * fileread.h (Timespec): New structure.
1434 (File_read::get_mtime): New method.
1435 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1436 Renamed from timestamp_nsec.
1437 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1439 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1441 (Incremental_inputs::report_archive): Save mtime; style fix.
1442 (Incremental_inputs::report_obejct): Save mtime; style fix.
1443 (Incremental_inputs::report_script): Save mtime; style fix.
1444 (Incremental_inputs::finalize_inputs): Style fix.
1445 (Incremental_inputs::finalize): Style fix.
1446 (Incremental_inputs::create_input_section_data): Store inputs
1448 * incremental.h (Incremental_inputs::report_script): Add mtime
1450 (Incremental_inputs::Input_info::Input_info): Intialize only one
1452 (Incremental_inputs::Input_info::archive): Move to nameless
1454 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1455 (Incremental_inputs::Input_info::script): Move to nameless union.
1456 (Incremental_inputs::mtime): New field.
1457 * script.cc (read_input_script): Pass file mtime to
1459 * script.h (Script_info::inputs): Style fix.
1461 2009-07-01 Ian Lance Taylor <ian@airs.com>
1463 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1466 2009-06-24 Ian Lance Taylor <iant@google.com>
1469 * layout.cc (Layout::choose_output_section): If we find an
1470 existing section, update the flags.
1471 (Layout::create_notes): New function, broken out of
1473 (Layout::finalize): Don't create note sections.
1474 (Layout::create_note): Don't crash if linker script discards
1476 (Layout::create_gold_note): Likewise.
1477 (Layout::create_build_id): Likewise. Don't set
1478 after_input_sections on the section.
1479 (Layout::create_executable_stack_info): Remove target parameter.
1481 * layout.h (class Layout): Declare create_notes. Update
1482 declaration of create_executable_stack_info.
1483 * gold.cc (queue_middle_tasks): Call create_notes.
1484 * output.cc (Output_section::update_flags_for_input_section): Move
1485 here from output.h. If SHF_ALLOC flag is newly set, mark address
1487 * output.h (Output_data::mark_address_invalid): New function.
1488 (class Output_section): Only declare, not define,
1489 update_flags_for_input_section. Remove set_flags.
1491 2009-06-24 Ian Lance Taylor <iant@google.com>
1493 * script-sections.cc (Output_section_definition::
1494 set_section_addresses): Rename shadowing local load_address to
1497 2009-06-24 Ian Lance Taylor <iant@google.com>
1500 * reloc.cc (relocate_sections): Skip empty relocation sections.
1502 2009-06-23 Ian Lance Taylor <iant@google.com>
1505 * layout.cc (Layout::create_note): Use choose_output_section
1506 rather than make_output_section.
1508 2009-06-23 Ian Lance Taylor <iant@google.com>
1511 * options.cc (General_options::parse_V): Set printed_version_.
1512 (General_options::General_options): Initialize printed_version_.
1513 * options.h (class General_options): Add printed_version_ field.
1514 * gold.cc (queue_initial_tasks): If there are no input files,
1515 don't give a fatal error if we printed the version information.
1516 (queue_middle_tasks): If using -r with a shared object, give a
1517 fatal error rather than an ordinary error.
1519 2009-06-23 Ian Lance Taylor <iant@google.com>
1522 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1523 (Layout::make_output_section): Set have_stabstr_section_ if we see
1524 a .stab*str section.
1525 (Layout::finalize): Call link_stabs_sections.
1526 (Layout::link_stabs_sections): New file.
1527 * layout.h (class Layout): Add have_stabstr_section_ field.
1528 Declare link_stabs_sections.
1530 2009-06-23 Doug Kwan <dougkwan@google.com>
1532 * Makefile.am (libgold_a_LIBADD): New.
1533 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1534 * Makefile.in: Regenerate.
1535 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1536 * configure: Regenerate.
1537 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1538 * fileread.cc: Include sys/state.h
1539 * gold.h: Declare memmem and strndup if found missing.
1540 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1542 2009-06-23 Ian Lance Taylor <iant@google.com>
1544 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
1545 * configure: Rebuild.
1547 2009-06-23 Ian Lance Taylor <iant@google.com>
1550 * object.cc (Object::section_contents): Don't try to get a view if
1551 the section has length zero.
1552 (Object::handle_gnu_warning_section): If the section is empty, use
1553 the name of the section as the warning.
1555 2009-06-23 Ian Lance Taylor <iant@google.com>
1558 * stringpool.h (class Stringpool_template): Add optimize_ field.
1559 (Stringpool_template::set_optimize): New function.
1560 * stringpool.cc (Stringpool_template::Stringpool_template):
1561 Initialize optimize_ field.
1562 (Stringpool_template::set_string_offsets): Test local optimize
1563 fild rather than parameter.
1564 * layout.cc (Layout::Layout): Call set_optimize on the section
1567 2009-06-22 Ian Lance Taylor <iant@google.com>
1570 * yyscript.y: Parse TARGET.
1571 * script.cc (script_set_target): New function.
1572 * script-c.h (script_set_target): Declare.
1573 * options.cc (General_options::string_to_object_format): Rename
1574 from string_to_object_format in anonymous namespace. Change
1576 * options.h (class General_options): Declare
1577 string_to_object_format.
1579 2009-06-22 Ian Lance Taylor <iant@google.com>
1581 * script-sections.cc (Script_sections::create_segments): Don't put
1582 program headers in a PT_LOAD segment if -n or -N.
1584 2009-06-22 Ian Lance Taylor <iant@google.com>
1587 * options.h (class General_options): Add -z lazy and -z now. Sort
1588 -z options into alphabetical order.
1589 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
1591 2009-06-21 Ian Lance Taylor <iant@google.com>
1593 * layout.cc (Layout::make_output_section): Call
1594 Target::new_output_section.
1595 (Layout::attach_allocated_section_to_segment): Put large section
1596 sections in a separate load segment with the large segment flag
1598 (Layout::segment_precedes): Sort large data segments after other
1600 (align_file_offset): New static function.
1601 (Layout::set_segment_offsets): Use align_file_offset.
1602 * output.h (class Output_section): Add is_small_section_ and
1603 is_large_section_ fields.
1604 (Output_section::is_small_section): New function.
1605 (Output_section::set_is_small_section): New function.
1606 (Output_section::is_large_section): New function.
1607 (Output_section::set_is_large_section): New function.
1608 (Output_section::is_large_data_section): New function.
1609 (class Output_segment): Add is_large_data_segment_ field.
1610 (Output_segment::is_large_data_segment): New function.
1611 (Output_segment::set_is_large_data_segment): New function.
1612 * output.cc (Output_section::Output_section): Initialize new
1614 (Output_segment::Output_segment): Likewise.
1615 (Output_segment::add_output_section): Add assertion that large
1616 data sections always go in large data segments. Force small data
1617 sections to the end of the list of data sections. Force small BSS
1618 sections to the start of the list of BSS sections. For large BSS
1619 sections to the end of the list of BSS sections.
1620 * symtab.h (class Symbol): Declare is_common_shndx.
1621 (Symbol::is_defined): Check Symbol::is_common_shndx.
1622 (Symbol::is_common): Likewise.
1623 (class Symbol_table): Define enum Commons_section_type. Update
1624 declarations. Add small_commons_ and large_commons_ fields.
1625 * symtab.cc (Symbol::is_common_shndx): New function.
1626 (Symbol_table::Symbol_table): Initialize new fields.
1627 (Symbol_table::add_from_object): Put small and large common
1628 symbols in the right list.
1629 (Symbol_table::sized_finalized_symbol): Check
1630 Symbol::is_common_shndx.
1631 (Symbol_table::sized_write_globals): Likewise.
1632 * common.cc (Symbol_table::do_allocate_commons): Allocate new
1633 common symbol lists. Don't call do_allocate_commons_list if the
1635 (Symbol_table::do_allocate_commons_list): Remove is_tls
1636 parameter. Add comons_section_type parameter. Change all
1637 callers. Handle small and large common symbols.
1638 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
1639 Symbol::is_common_shndx.
1640 * resolve.cc (symbol_to_bits): Likewise.
1641 * target.h (Target::small_common_shndx): New function.
1642 (Target::small_common_section_flags): New function.
1643 (Target::large_common_shndx): New function.
1644 (Target::large_common_section_flags): New function.
1645 (Target::new_output_section): New function.
1646 (Target::Target_info): Add small_common_shndx, large_common_shndx,
1647 small_common_section_flags, and large_common_section_flags
1649 (Target::do_new_output_section): New virtual function.
1650 * arm.cc (Target_arm::arm_info): Initialize new fields.
1651 * i386.cc (Target_i386::i386_info): Likewise.
1652 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1654 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
1655 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1656 (Target_x86_64::do_new_output_section): New function.
1657 * configure.ac: Define conditional MCMODEL_MEDIUM.
1658 * testsuite/Makefile.am (check_PROGRAMS): Add large.
1659 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
1660 (large_LDFLAGS): Define.
1661 * testsuite/large.c: New file.
1662 * testsuite/testfile.cc (Target_test::test_target_info):
1663 Initialize new fields.
1664 * configure, testsuite/Makefile.in: Rebuild.
1666 2009-06-05 Doug Kwan <dougkwan@google.com>
1668 * Makefile.am (CCFILES): Add target.cc.
1669 * Makefile.in: Regenerate.
1670 * i386.cc (class Target_i386): Define new virtual method to
1671 override do_is_local_label_name in parent.
1672 * object.cc (Sized_relobj::do_count_local_symbols): Discard
1673 local symbols if --discard-locals or -X is given.
1674 * options.h (class General_options): Declare new options
1675 '--discard-locals' and '-X' for discarding locals.
1676 * target.h (class Target): Define new methods is_local_label_name.
1677 Declare new virtual method do_is_local_label_name.
1678 * target.cc: New file.
1679 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
1680 (check_SCRIPTS): Add discard_locals_test.sh.
1681 (check_DATA): Add discard_local_tests.syms.
1682 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
1683 (discard_local_tests.syms, discard_locals_test.o): New make rules.
1684 * testsuite/Makefile.in: Regenerate.
1685 * testsuite/discard_locals_test.c: New file.
1686 * testsuite/discard_locals_test.sh: Same.
1688 2009-06-05 Doug Kwan <dougkwan@google.com>
1690 * object.cc (Sized_relobj::Sized_relobj): Initialize
1691 discarded_eh_frame_shndx_ to -1U.
1692 (Sized_relobj::do_layout): Record index of a discard .eh_frame
1694 (Sized_relobj::do_count_local_symbols): Skip local symbols in
1695 a discarded .eh_frame section.
1696 (Sized_relobj::do_finalize_local_symbols): Ditto.
1697 * object.h (class Sized_relobj): Declare new member
1698 discarded_eh_frame_shndx_.
1699 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
1700 (local_labels_test.o, local_labels_test): New rules.
1701 * testsuite/Makefile.in: Regenerate.
1703 2009-06-04 Doug Kwan <dougkwan@google.com>
1705 * layout.cc (Layout::section_name_mapping): Add mapping for
1706 special ARM sections.
1708 2009-06-03 Doug Kwan <dougkwan@google.com>
1710 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
1711 (utils::has_overflow): Same.
1713 2009-06-03 Ian Lance Taylor <iant@google.com>
1715 * layout.cc (Layout::section_name_mapping): New array, replacing
1716 Layout::linkonce_mapping.
1717 (Layout::section_name_mapping_count): New variable, replacing
1718 Layout::linkonce_mapping_count.
1719 (Layout::linkonce_output_name): Remove.
1720 (Layout::output_section_name): Rewrite.
1721 * layout.h (class Layout): Rename Linkonce_mapping to
1722 Section_name_mapping, linkonce_mapping to section_name_mapping,
1723 linkonce_mapping_count to section_name_mapping_count. Don't
1724 declare linkonce_output_name.
1726 2009-06-03 Doug Kwan <dougkwan@google.com>
1728 * gold/arm.cc (namespace utils): New.
1729 (Target_arm::reloc_is_non_pic): Define new method.
1730 (class Arm_relocate_functions): New.
1731 (Target_arm::Relocate::relocate): Handle relocation types used by
1734 2009-06-03 Ian Lance Taylor <iant@google.com>
1736 * arm.cc (Target_arm::scan::global): Use || instead of |.
1738 2009-06-02 Doug Kwan <dougkwan@google.com>
1740 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
1741 issued_non_pic_error_.
1742 (class Target_arm::Scan): Declare new method check_non_pic.
1743 Define new method symbol_needs_plt_entry.
1744 Declare new data member issued_non_pic_error_.
1745 (class Target_arm::Relocate): Declare new method
1746 should_apply_static_reloc.
1747 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
1748 (Target_arm::Scan::check_non_pic): Define new method.
1749 (Target_arm::Scan::local): Handle a small subset of reloc types used
1751 (Target_arm::Scan::local): Same.
1752 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
1754 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
1756 * incremental.cc (Incremental_inputs::report_command_line): Filter
1757 out --incremental-* options.
1759 2009-05-29 Doug Kwan <dougkwan@google.com>
1761 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
1763 (class Target_arm): Update comment.
1764 (Target_arm::Target_arm): Initialize new data members GOT_,
1765 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
1766 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
1767 and Target_arm::rel_dyn_section.
1768 Declare new_enum Target_arm::Got_type.
1769 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
1771 Update commments for member do_dynsym_value.
1772 (Target_arm::got_size, Target_arm::plt_section,
1773 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
1774 new methods inside class defintion.
1775 (Target_arm::got_section): Define new method.
1776 (Target_arm::rel_dyn_section): Same.
1777 (Output_data_plt_arm): New template class.
1778 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
1779 (Output_data_plt_arm:do_adjust_output_section): Define new method.
1780 (Output_data_plt_arm::add_entry): Same.
1781 (Output_data_plt_arm::first_plt_entry): Define new
1782 static data member for PLT instruction template.
1783 (Output_data_plt_arm::plt_entry): Same.
1784 (Output_data_plt_arm::do_write): Define new method.
1785 (Target_arm::make_plt_entry): Same.
1786 (Target_arm::do_finalize_sections): Same.
1787 (Target_arm::do_dynsym_value): Same.
1789 2009-05-28 Doug Kwan <dougkwan@google.com>
1791 * Makefile.am (TARGETSOURCES): Add arm.cc.
1792 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
1793 * Makefile.in: Regenerate.
1795 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
1797 2009-05-26 Doug Kwan <dougkwan@google.com>
1799 * options.cc (General_options::parse_exclude_libs). Fix a comment.
1800 (General_options::check_excluded_libs): Strip off directories in
1801 archive name before matching like GNU ld does.
1802 * testsuite/Makefile.am (MOSTLYCLEANFILES,
1803 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
1804 (exclude_libs_test_LDFLAGS): Add linker option
1805 -Wl,--exclude-libs,libexclude_libs_test_3
1806 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
1807 an explicit archive without using -l.
1808 (alt/libexclude_libs_test_3.a): New make rule.
1809 * testsuite/Makefile.in: Regenerate.
1810 * testsuite/exclude_libs_test.c : Declare lib3_default().
1812 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
1813 * exclude_libs_test_3.c: New file.
1815 2009-05-26 Nick Clifton <nickc@redhat.com>
1817 * po/id.po: New Indonesian translation.
1818 * po/gold.pot: Updated template file.
1820 2009-05-22 Sriraman Tallam <tmsriram@google.com>
1822 * testsuite/Makefile.am: Add -ffunction-sections to compile
1823 gc_comdat_test files. Add -Wl,--gc-sections to build
1825 * testsuite/Makefile.in: Regenerate.
1826 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
1828 2009-05-21 Sriraman Tallam <tmsriram@google.com>
1830 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
1831 kept comdat section was garbage collected.
1832 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
1833 * testsuite/Makefile.in: Regenerate.
1834 * testsuite/gc_comdat_test.sh: New file.
1835 * testsuite/gc_comdat_test_1.cc: New file.
1836 * testsuite/gc_comdat_test_2.cc: New file.
1838 2009-05-19 Doug Kwan <dougkwan@google.com>
1840 * archive.cc (Archive::Archive): Move constructor from archive.h
1841 to here. Initialize no_export_.
1842 (Archive::get_elf_object_for_member): Set no_export flag of object.
1843 * archive.h (Archive::Archive): Move constructor body to
1845 (Archive::no_export): New method.
1846 (Archive::no_export_): New field.
1847 * object.h (Object::Object): Initialize no_export_ to false.
1848 (Object::no_export, Object::set_no_export): New methods.
1849 (Object::no_export_): New field.
1850 * options.cc (General_options::parse_exclude_libs): New method.
1851 (General_options::check_excluded_libs) Same.
1852 * options.h (exclude_libs): New option.
1853 (General_options::check_excluded_libs): New method declaration.
1854 (General_options::excluded_libs_): New field.
1855 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
1856 default or protected visibility if an object has no-export flag set.
1857 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
1858 (check_SCRIPTS): Add exclude_libs_test.sh.
1859 (check_DATA): Add exclude_libs_test.syms.
1860 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
1861 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
1862 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
1863 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
1864 (exclude_libs_test.syms, libexclude_libs_test_1.a,
1865 libexclude_libs_test_2.a): New rules.
1866 * testsuite/Makefile.in: Regenerate.
1867 * testsuite/exclude_libs_test.c: New file.
1868 * testsuite/exclude_libs_test.sh: Ditto.
1869 * testsuite/exclude_libs_test_1.c: Ditto.
1870 * testsuite/exclude_libs_test_2.c: Ditto.
1872 2009-05-15 Ian Lance Taylor <iant@google.com>
1874 * configure.ac: Check for declarations for cases where libiberty.h
1875 checks HAVE_DECL_xxx.
1876 * configure, config.in: Rebuild.
1878 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
1880 * gold.h (Incremental_argument_list): Remove (invalid) forward
1882 * incremental.cc (Incremental_inputs::report_achive): New method.
1883 (Incremental_inputs::report_object): New method.
1884 (Incremental_inputs::report_script): New method.
1885 (Incremental_inputs::finalize_inputs): New method.
1886 (Incremental_inputs::finalize): Call finalize_inputs().
1887 (Incremental_inputs::sized_create_incremental_inputs_section_data):
1888 Create inputs entries.
1889 * incremental.h (Incremental_input_type): New enum.
1890 (Incremental_inputs::Incremental_input): Initialize new fields.
1891 (Incremental_inputs::report_inputs): New method.
1892 (Incremental_inputs::report_achive): New method.
1893 (Incremental_inputs::report_object): New method.
1894 (Incremental_inputs::report_script): New method.
1895 (Incremental_inputs::finalize_inputs): New method.
1896 (Incremental_inputs::Input_info): New struct.
1897 (Incremental_inputs::Input_info_map): New typedef.
1898 (Incremental_inputs::lock_): New field.
1899 (Incremental_inputs::Inputs_): New field.
1900 (Incremental_inputs::Inputs_map): New field.
1901 * main.cc (main): Call Incremental_input::report_inputs.
1902 * options.h (Input_argument_list): Typedef moved from
1904 (Input_file_group::Files): Remove, use ::Input_argument_list.
1905 (Input_file_group::Input_argument_list): Remove, use
1906 ::Input_argument_list.
1907 * plugin.cc (Plugin_manager::add_input_file): Add error in
1909 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
1911 * script.cc (read_input_script): Call
1912 Incremental_input::report_script.
1913 * script.h (Script_info): New class.
1915 2009-04-27 Ian Lance Taylor <iant@google.com>
1917 * x86_64.cc (do_adjust_output_section): Set entsize to
1920 2009-04-23 Elliott Hughes <enh@google.com>
1922 * output.cc (Output_file::close): After short writes, continue
1923 writing from the correct offset in the buffer being written.
1925 2009-04-23 Chris Demetriou <cgd@google.com>
1927 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
1928 * configure: Regenerate.
1929 * config.in: Regenerate.
1930 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
1931 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
1933 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
1935 * incremental.cc (Incremental_inputs_header_data): Renamed from
1936 Incremental_input_header_data.
1937 (Incremental_inputs_header_data::data_size): New field.
1938 (Incremental_inputs_header_data::put_input_file_count): Renamed
1939 from input_file_count.
1940 (Incremental_inputs_header_data::put_command_line_offset): Renamed
1941 from command_line_offset.
1942 (Incremental_inputs_header_data::put_reserved): Renamed from
1944 (Incremental_inputs_entry_data): Renamed from
1945 Incremental_input_entry_data.
1946 (Incremental_inputs_entry_data::data_size): New field.
1947 (Incremental_inputs::report_command_line): New method.
1948 (Incremental_inputs::finalize): New method.
1949 (Incremental_inputs::create_incremental_inputs_data): New method.
1950 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
1951 * incremental.h: New file.
1952 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
1953 (Layout::finalize): Create incremental inputs section in
1955 (Layout::create_incremental_info_sections): New method.
1956 * layout.h (Layout::incremental_inputs): New method.
1957 (Layout::create_incremental_info_sections): New method.
1958 (Layout::incremental_inputs_): New field.
1959 * main.cc (main): Notify Incremental_input of the command line.
1961 2009-04-01 Ian Lance Taylor <iant@google.com>
1962 Mikolaj Zalewski <mikolajz@google.com>
1964 * gold.h (reserve_unordered_map): Define, three versions, one for
1965 each version of Unordered_map.
1966 * layout.cc (Layout::Layout): Remove options parameter. Add
1967 number_of_input_files parameter. Don't initialize options_.
1968 Initialize number_of_input_files_ and resized_signatures_. Move
1969 sections_are_attached_.
1970 (Layout::layout_group): Reserve space for group_signatures_.
1971 (Layout::find_or_add_kept_section): Change name parameter to be a
1972 reference. Resize signatures_ map when it gets large enough.
1973 (Layout::layout_eh_frame): Use parameters->options() instead of
1975 (Layout::make_output_section): Likewise.
1976 (Layout::attach_allocated_section_to_segment): Likewise.
1977 (Layout::finalize, Layout::create_executable_stack): Likewise.
1978 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
1979 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
1980 * layout.h (class Layout): Update declarations. Remove options_
1981 field. Add number_of_input_files_ and resized_signatures_
1982 fields. Move sections_are_attached_ field.
1983 * main.cc (main): Pass number of input files to Layout
1984 constructor. Don't pass options.
1986 2009-03-30 Ian Lance Taylor <iant@google.com>
1988 * ffsll.c (ffsll): Correct implementation.
1990 2009-03-27 Ian Lance Taylor <iant@google.com>
1992 * ffsll.c: New file.
1993 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
1994 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
1995 * ftruncate.c (ftruncate): Declare before definition.
1996 * mremap.c (mremap): Likewise.
1997 * pread.c (pread): Likewise.
1998 * configure, Makefile.in, config.in: Rebuild.
2000 * mremap.c: New file.
2001 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
2002 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
2003 (mremap): Declare if HAVE_MREMAP is not defined.
2004 * configure, Makefile.in, config.in: Rebuild.
2006 2009-03-27 Cary Coutant <ccoutant@google.com>
2008 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
2009 position independent.
2010 * sparc.cc (Target_sparc::check_non_pic): Likewise.
2011 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
2013 2009-03-24 Cary Coutant <ccoutant@google.com>
2015 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
2017 (needs_dynamic_reloc): Likewise.
2019 2009-03-24 Ian Lance Taylor <iant@google.com>
2021 * yyscript.y (file_cmd): Recognize EXTERN.
2022 (extern_name_list, extern_name_list_body): New nonterminals.
2023 * script.cc (script_add_extern): Define.
2024 * script-c.h (script_add_extern): Declare.
2026 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
2028 * object.cc (is_elf_object): Define.
2029 * object.h (is_elf_object): Declare.
2030 * archive.cc (Archive::get_elf_object_for_member): Call
2032 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
2034 2009-03-24 Elliott Hughes <enh@google.com>
2036 * output.cc (Output_file::map_anonymous): Define.
2037 (Output_file::map): Use map_anonymous. If the regular mmap fails,
2038 try an anonymous one. Report the size if the mmap fails.
2039 * output.h (class Output_file): Declare map_anonymous.
2041 2009-03-24 Ian Lance Taylor <iant@google.com>
2043 * target-select.cc (instantiate_target): Don't acquire the lock if
2044 the instantiated_target_ field has already been set.
2046 2009-03-23 Ian Lance Taylor <iant@google.com>
2048 * gold-threads.h (class Initialize_lock): Define.
2049 * gold-threads.cc (class Initialize_lock_once): Define.
2050 (initialize_lock_control): New static variable.
2051 (initialize_lock_pointer): New static variable.
2052 (initialize_lock_once): New static function.
2053 (Initialize_lock::Initialize_lock): Define.
2054 (Initialize_lock::initialize): Define.
2055 * target-select.h: Include "gold-threads.h".
2056 (class Target_selector): Add lock_ and initialize_lock_ fields.
2057 Don't define instantiate_target, just declare it.
2058 * target-select.cc (Target_selector::Target_selector): Initialize
2060 (Target_selector::instantiate_target): Define.
2061 * descriptors.h: Include "gold-threads.h".
2062 (class Descriptors): Add initialize_lock_ field.
2063 * descriptors.cc (Descriptors::Descriptors): Initialize new
2065 (Descriptors::open): Use initialize_lock_ field
2066 * errors.h (class Errors): Add initialize_lock_ field.
2067 * errors.cc (Errors::Errors): Initialize new field.
2068 (Errors::initialize_lock): Use initialize_lock_ field.
2069 * powerpc.cc (class Target_selector_powerpc): Remove
2070 instantiated_target_ field. In do_recognize call
2071 instantiate_target rather than do_instantiate_target. In
2072 do_instantiate_target just allocate a new target.
2073 * sparc.cc (class Target_selector_sparc): Likewise.
2075 * freebsd.h: New file.
2076 * i386.cc: Include "freebsd.h".
2077 (Target_i386): Derive from Target_freebsd rather than
2079 (Target_selector_i386): Derive from Target_selector_freebsd rather
2080 than Target_selector.
2081 * x86_64.cc: Include "freebsd.h".
2082 (Target_x86_64): Derive from Target_freebsd rather than
2084 (Target_selector_x86_64): Derive from Target_selector_freebsd
2085 rather than Target_selector.
2086 * target.h (class Target): Add adjust_elf_header and
2087 do_adjust_elf_header.
2088 * output.cc (Output_file_header:: do_sized_write): Call target
2089 adjust_elf_header routine.
2090 * configure.tgt: Set targ_osabi.
2091 * configure.ac: Define GOLD_DEFAULT_OSABI.
2092 * parameters.cc (Parameters::default_target): Pass
2093 GOLD_DEFAULT_OSABI to select_target.
2094 * target-select.h (class Target_selector): Make instantiate_target
2095 protected rather than private.
2096 * Makefile.am (HFILES): Add freebsd.h.
2097 * configure, Makefile.in, config.in: Rebuild.
2099 * merge.cc (do_add_input_section): Correct pend value. Change
2100 message about last entry not being null terminated from error to
2103 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
2105 * incremental.cc: New file.
2106 * Makefile.am (CCFILES): Add incremental.cc.
2107 * Makefile.in: Rebuild.
2109 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
2111 * layout.cc (Layout::output_section_name): Preserve names
2112 of '.note.' sections.
2114 2009-03-19 Ian Lance Taylor <iant@google.com>
2116 * descriptors.cc (Descriptors::open): Check that the options are
2117 valid before using them.
2119 2009-03-18 Ian Lance Taylor <iant@google.com>
2121 * script-sections.h: Include <list>.
2122 (class Script_sections): Change Sections_elements from std::vector
2123 to std::list. Typedef public Elements_iterator. Add
2124 orphan_section_placement_, data_segment_align_start_, and
2125 saw_data_segment_align_ fields. Remove data_segment_align_index_
2127 * script-sections.cc (class Orphan_section_placement): New class.
2128 (class Sections_element): Add virtual functions is_relro and
2129 orphan_section_init. Remove virtual function place_orphan_here.
2130 (class Output_section_definition): Add is_relro and
2131 orphan_section_init. Remove place_orphan_here.
2132 (class Orphan_output_section): Likewise.
2133 (Script_sections::Script_sections): Update for field changes.
2134 (Script_sections::data_segment_align): Set saw_data_segment_align_
2135 and data_segment_align_start_, not data_segment_align_index.
2136 (Script_sections::data_segment_relro_end): Check
2137 saw_data_segment_align_. Use data_segment_align_start_ rather
2138 than data_segment_align_index_.
2139 (Script_sections::place_orphan): Rewrite to use
2140 Orphan_section_placement.
2142 2009-03-17 Ian Lance Taylor <iant@google.com>
2144 * archive.cc (Archive::add_symbols): Check for a version attached
2145 to the symbol name in the archive map.
2146 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
2147 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
2148 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
2149 (ver_test_11.a): New target.
2150 * testsuite/Makefile.in: Rebuild.
2152 * configure.ac: Check for chsize and posix_fallocate. Replace
2154 * ftruncate.c: New file, from gnulib.
2155 * output.cc (posix_fallocate): Define dummy version if not
2156 HAVE_POSIX_FALLOCATE.
2157 (Output_file::map): Call posix_fallocate rather than lseek and
2159 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
2160 * configure, Makefile.in, config.in: Rebuild.
2162 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
2164 * layout.h (Layout::create_note): Add section_name parameter.
2165 * layout.cc (Layout::create_note): Likewise.
2166 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
2168 2009-03-17 Ian Lance Taylor <iant@google.com>
2170 * descriptors.cc: Include "options.h".
2171 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
2172 (Descriptors::open): Always use O_CLOEXEC when opening a new
2173 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
2174 then set FD_CLOEXEC.
2176 * sparc.cc (class Target_sparc): Add has_got_section.
2177 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
2178 make sure we have a GOT section.
2180 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
2181 (Target_sparc::Scan::local): Likewise.
2182 (Target_sparc::Scan::global): Likewise.
2183 (Target_sparc::Relocate::relocate): Likewise.
2184 (Target_sparc::Relocate::relocate_tls): Likewise.
2186 * symtab.cc (Symbol_table::define_default_version): New function,
2187 broken out of add_from_object.
2188 (Symbol_table::add_from_object): Call define_default_version.
2189 (Symbol_table::define_special_symbol): Add resolve_oldsym
2190 parameter. Change all callers. If the version for a symbol comes
2191 from a version script, resolve it with the symbol with the same
2192 name with no version. Also add the symbol without a version if
2194 (do_define_in_output_data): If resolving with oldsym, don't delete
2196 (do_define_in_output_segment): Likewise.
2197 (do_define_as_constant): Likewise.
2198 * symtab.h (class Symbol_table): Update declarations.
2200 2009-03-13 Ian Lance Taylor <iant@google.com>
2202 * readsyms.cc (Read_symbols::incompatible_warning): New function.
2203 (Read_symbols::requeue): New function.
2204 (Read_symbols::do_read_symbols): If make_elf_object fails because
2205 the target type is not configured, and the file was searched for,
2206 issue a warning and retry with the next directory.
2207 (Add_symbols::run): If the file has an incompatible format, and
2208 it was searched for, requeue the Read_symbols task. On error,
2210 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
2211 dirindex parameter to constructor. Change all callers. Declare
2212 incompatible_warning and requeue.
2213 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
2214 input_argument_ and input_group_ fields. Add them to
2215 constructor. Change all callers.
2216 (class Read_script): Add dirindex_ field. Add it to constructor.
2218 * archive.cc (Archive::setup): Remove input_objects parameter.
2220 (Archive::get_file_and_offset): Likewise.
2221 (Archive::read_all_symbols): Likewise.
2222 (Archive::read_symbols): Likewise.
2223 (Archive::get_elf_object_for_member): Remove input_objects
2224 parameter. Add punconfigured parameter. Change all callers.
2225 (Archive::add_symbols): Change return type to bool. Check return
2226 value of include_member.
2227 (Archive::include_all_members): Likewise.
2228 (Archive::include_member): Change return type to bool. Return
2229 false if first included object has incompatible target. Set
2230 included_member_ field.
2231 (Add_archive_symbols::run): If add_symbols returns false, requeue
2233 * archive.h (class Archive): Add included_member_ field.
2234 Initialize it in constructor. Add input_file and searched_for
2235 methods. Update declarations.
2236 (class Add_archive_symbols): Add dirpath_, dirindex_, and
2237 input_argument_ fields. Add them to constructor. Change all
2239 * script.cc: Include "target-select.h".
2240 (class Parser_closure): Add skip_on_incompatible_target_ and
2241 found_incompatible_target_ fields. Add
2242 skip_on_incompatible_target parameter to constructor. Change all
2243 callers. Add methods skip_on_incompatible_target,
2244 clear_skip_on_incompatible_target, found_incompatible_target, and
2245 set_found_incompatible_target.
2246 (read_input_script): Add dirindex parameter. Change all callers.
2247 If parser finds an incompatible target, requeue Read_symbols
2249 (script_set_symbol): Clear skip_on_incompatible_target in
2251 (script_add_assertion, script_parse_option): Likewise.
2252 (script_start_sections, script_add_phdr): Likewise.
2253 (script_check_output_format): New function.
2254 * script.h (read_input_script): Update declaration.
2255 * script-c.h (script_check_output_format): Declare.
2256 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
2257 (ignore_cmd): Remove OUTPUT_FORMAT.
2258 * fileread.cc (Input_file::Input_file): Add explicit this.
2259 (Input_file::will_search_for): New function.
2260 (Input_file::open): Add pindex parameter. Change all callers.
2261 * fileread.h (class Input_file): Add input_file_argument method.
2262 Declare will_search_for. Update declarations.
2263 * object.cc (make_elf_object): Add punconfigured parameter.
2265 * object.h (class Object): Make input_file public. Add
2266 searched_for method.
2267 (make_elf_object): Update declaration.
2268 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
2270 * dirsearch.h (class Dirsearch): Update declaration.
2271 * options.h (class General_options): Add --warn-search-mismatch.
2272 * parameters.cc (Parameters::is_compatible_target): New function.
2273 * parameters.h (class Parameters): Declare is_compatible_target.
2274 * workqueue.cc (Workqueue::add_blocker): New function.
2275 * workqueue.h (class Workqueue): Declare add_blocker.
2277 * fileread.cc (Input_file::open): Remove options parameter.
2279 (Input_file::open_binary): Likewise.
2280 * script.cc (read_input_script): Likewise.
2281 * readsyms.h (class Read_symbols): Remove options_ field. Remove
2282 options parameter from constructor. Change all callers.
2283 (class Read_script): Likewise.
2284 * fileread.h (class Input_file): Update declarations.
2285 * script.h (read_input_script): Update declaration.
2287 2009-03-10 Nick Clifton <nickc@redhat.com>
2289 * po/es.po: New Spanish translation.
2291 2009-03-06 Cary Coutant <ccoutant@google.com>
2293 * options.cc (parse_short_option): Keep dash_z from registering itself.
2295 2009-03-03 Ian Lance Taylor <iant@google.com>
2298 * target-reloc.h (relocate_section): Pass output_section to
2300 * i386.cc (Target_i386::should_apply_static_reloc): Add
2301 output_section parameter. Change all callers.
2302 (Target_i386::Relocate::relocate): Add output_section parameter.
2303 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2304 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2305 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2306 * testsuite/two_file_shared.sh: New script.
2307 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
2308 (check_DATA): Add two_file_shared.dbg.
2309 (two_file_shared.dbg): New target.
2310 * testsuite/Makefile.in: Rebuild.
2312 2009-03-01 Ian Lance Taylor <iant@google.com>
2314 * configure.ac: Check for byteswap.h.
2315 * configure: Rebuild.
2316 * config.in: Rebuild.
2318 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
2320 * layout.cc (Layout::find_or_add_kept_section): New function.
2321 (Layout::add_comdat): Removed.
2322 * layout.h (struct Kept_section): Move out of class Layout.
2323 Remove trailing underscores from field names. Add group_sections
2324 field. Rename group_ field to is_group. Change all uses.
2325 (class Layout): Declare find_or_add_kept_section, not add_comdat.
2326 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
2327 comdat_groups_ field.
2328 (Sized_relobj::include_section_group): Use
2329 find_or_add_kept_section and Kept_section::group_sections.
2330 (Sized_relobj::include_linkonce_section): Likewise.
2331 * object.cc (class Sized_relobj): Don't define Comdat_group or
2332 Comdat_group_table. Remove find_comdat_group and
2333 add_comdat_group. Remove comdat_groups_ field.
2334 * plugin.cc (include_comdat_group): Use
2335 Layout::find_or_add_kept_section.
2337 2009-02-28 Ian Lance Taylor <iant@google.com>
2339 * README: --gc-sections and map files are now supported. Document
2340 some build requirements.
2343 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
2344 relocatable link set the value of the section symbol to zero.
2345 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
2346 relocatable link don't include the section address in the local
2349 2009-02-27 Ian Lance Taylor <iant@google.com>
2352 * options.h (class Search_directory): Add is_system_directory.
2353 (class General_options): Declare is_in_system_directory.
2354 * options.cc (get_relative_sysroot): Make static.
2355 (get_default_sysroot): Make static.
2356 (General_optoins::is_in_system_directory): New function.
2357 * fileread.cc (Input_file::is_in_system_directory): New function.
2358 * fileread.h (class Input_file): Declare is_in_system_directory.
2359 * object.h (class Object): Add is_in_system_directory.
2360 (class Input_objects): Remove system_library_directory_ field.
2361 * object.cc (Input_objects::add_object): Don't set
2362 system_library_directory_.
2363 (input_objects::found_in_system_library_directory): Remove.
2364 * symtab.cc (Symbol_table::write_globals): Remove input_objects
2365 parameter. Change all callers.
2366 (Symbol_table::sized_write_globals): Likewise.
2367 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
2368 Call Object::is_in_system_directory.
2369 * symtab.h (class Symbol_table): Update declarations.
2372 * descriptors.h (Open_descriptor): Add is_on_stack field.
2373 * descriptors.cc (Descriptors::open): If the descriptor is on the
2374 top of the stack, remove it. Initialize is_on_stack field.
2375 (Descriptors::release): Only add pod to stack if it is not on the
2377 (Descriptors::close_some_descriptor): Clear stack_next and
2381 * output.cc (Output_section::find_starting_output_address): Rename
2382 from starting_output_address; add PADDR parameter; change return
2384 * output.h (class Output_section): Declare
2385 find_starting_output_address instead of starting_output_address.
2386 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
2387 section symbol for which we can't find a merge section.
2390 * symtab.cc (Symbol_table::add_from_object): If the visibility is
2391 hidden or internal, force the symbol to be local.
2392 * resolve.cc (Symbol::override_visibility): Define.
2393 (Symbol::override_base): Use override_visibility.
2394 (Symbol_table::resolve): Likewise.
2395 (Symbol::override_base_with_special): Likewise.
2396 (Symbol_table::override_with_special): If the visibility is hidden
2397 or internal, force the symbol to be local.
2398 * symtab.h (class Symbol): Add set_visibility and
2399 override_visibility.
2400 * testsuite/ver_test_1.sh: New file.
2401 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2402 (check_DATA): Add ver_test_1.syms.
2403 (ver_test_1.syms): New target.
2404 * testsuite/Makefile.in: Rebuild.
2406 2009-02-25 Cary Coutant <ccoutant@google.com>
2408 * layout.cc (Layout::choose_output_section): Don't rename sections
2409 when using a linker script that has a SECTIONS clause.
2410 * Makefile.in: Regenerate.
2412 * testsuite/Makefile.am (script_test_5.sh): New test case.
2413 * testsuite/Makefile.in: Regenerate.
2414 * testsuite/script_test_5.cc: New file.
2415 * testsuite/script_test_5.sh: New file.
2416 * testsuite/script_test_5.t: New file.
2418 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
2420 * archive.cc (Archive::include_member): Update calls to add_symbols.
2421 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2422 the Layout argument.
2423 * dynobj.h (do_add_symbols): Add the Layout argument.
2424 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2426 * object.h (Object::add_symbols): Add the Layout argument.
2427 (Object::do_add_symbols): Add the Layout argument.
2428 (Sized_relobj::do_add_symbols): Add the Layout argument.
2429 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2430 Unify the two versions.
2431 (Add_plugin_symbols): Remove.
2432 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2433 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2434 (Add_plugin_symbols): Remove.
2435 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2436 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2437 (Add_symbols::run): Make it work with Pulginobj.
2439 2009-02-06 Ian Lance Taylor <iant@google.com>
2441 * object.cc (Sized_relobj::do_layout): Make info message start
2442 with lower case letter.
2444 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2446 * binary.cc: Fix file comment.
2448 * options.h (enum Incremental_disposition): Define.
2449 (class General_options): Add new options: --incremental,
2450 --incremental_changed, --incremental_unchanged,
2451 --incremental_unknown. Add incremental_disposition_ and
2452 implicit_incremental_ fields.
2453 (General_options::incremental_disposition): New function.
2454 (class Position_dependent_options): Add incremental_disposition
2456 (Position_dependent_options::copy_from_options): Set incremental
2458 * options.cc (General_options::parse_incremental_changed): New
2460 (General_options::parse_incremental_unchanged): New function.
2461 (General_options::parse_incremental_unknown): New function.
2462 (General_options::General_options): Initialize new fields
2463 incremental_disposition_ and implicit_incremental_.
2464 (General_options::finalize): Check for uasge of --incremental-*
2465 without --incremental.
2467 2009-02-06 Chris Demetriou <cgd@google.com>
2469 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2470 pointer and to report location as the file name associated with
2472 (gold_undefined_symbol_at_location): New function to replace the
2473 old gold_undefined_symbol functionality.
2474 * target-reloc.h (relocate_section): Update to use
2475 gold_undefined_symbol_at_location.
2476 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2477 Call gold_undefined_symbol function rather than gold_error.
2478 * errors.h (Errors::undefined_symbol): Take location as a
2479 string, rather than calculating it from a relocation.
2480 * errors.cc (Errors::fatal): Print "fatal error:" before the
2482 (Errors::error, Errors::error_at_location): Print "error: "
2483 before the formatted message.
2484 (Errors::undefined_symbol): Take location as a string, rather
2485 than calculating it from a relocation.
2486 (gold_undefined_symbol_at_location): New function akin to
2487 old gold_undefined_symbol, calculates location from relocation.
2488 (gold_undefined_symbol): Change to take only a Symbol pointer
2489 and to report location as the file name associated with the symbol.
2490 * testsuite/debug_msg.sh: Update for changed error messages.
2491 * testsuite/undef_symbol.sh: Likewise.
2493 2009-02-04 Duncan Sands <baldrick@free.fr>
2496 * reduced_debug_output.h
2497 (Output_reduced_debug_abbrev_section::failed): Use format for
2499 (Output_reduced_debug_info_section::faild): Likewise.
2501 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2503 * script.cc (Lazy_demangler): New class.
2504 (Version_script_info::get_symbol_version_helper): Demangle a
2507 2009-01-29 Cary Coutant <ccoutant@google.com>
2509 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2511 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2513 2009-01-28 Ian Lance Taylor <iant@google.com>
2515 * version.cc (version_string): Bump to 1.9.
2517 * gold.h: Include <cstring> and <stdint.h>.
2518 * version.cc: Include <cstdio>.
2519 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2521 * reduced_debug_output.cc (insert_into_vector): Rename from
2522 Insert_into_vector; change all callers. Use Swap_unaligned to
2523 avoid aliasing issue; remove union since it is unnecessary.
2525 2009-01-27 Sriraman Tallam <tmsriram@google.com>
2527 * Makefile.am (CCFILES): Add gc.cc.
2529 * Makefile.in: Regenerate.
2530 * gold.cc (Gc_runner): New class.
2531 (queue_initial_tasks): Call garbage collection related tasks
2532 when corresponding options are invoked.
2533 (queue_middle_gc_tasks): New function.
2534 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2535 processed early before laying out sections during garbage collection.
2536 * gold.h (queue_middle_gc_tasks): New function.
2537 (is_prefix_of): Move from "layout.cc".
2538 * i386.cc (Target_i386::gc_process_relocs): New function.
2539 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2540 * main.cc (main): Create object of class "Garbage_collection".
2541 * object.cc (Relobj::copy_symbols_data): New function.
2542 (Relobj::is_section_name_included): New function.
2543 (Sized_relobj::do_layout): Allow this function to be called twice
2544 during garbage collection and defer layout of section during the
2546 * object.h (Relobj::get_symbols_data): New function.
2547 (Relobj::is_section_name_included): New function.
2548 (Relobj::copy_symbols_data): New function.
2549 (Relobj::set_symbols_data): New function.
2550 (Relobj::get_relocs_data): New function.
2551 (Relobj::set_relocs_data): New function.
2552 (Relobj::is_output_section_offset_invalid): New pure virtual function.
2553 (Relobj::gc_process_relocs): New function.
2554 (Relobj::do_gc_process_relocs): New pure virtual function.
2555 (Relobj::sd_): New data member.
2556 (Sized_relobj::is_output_section_offset_invalid): New function.
2557 (Sized_relobj::do_gc_process_relocs): New function.
2558 * options.h (General_options::gc_sections): Modify to not be a no-op.
2559 (General_options::print_gc_sections): New option.
2560 * plugin.cc (Plugin_finish::run): Remove function call to
2561 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
2562 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
2563 * reloc.cc (Read_relocs::run): Add task to process relocs and
2564 determine unreferenced sections when doing garbage collection.
2565 (Gc_process_relocs): New class.
2566 (Sized_relobj::do_gc_process_relocs): New function.
2567 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
2568 sections that are garbage collected.
2569 * reloc.h (Gc_process_relocs): New class.
2570 * sparc.cc (Target_sparc::gc_process_relocs): New function.
2571 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
2572 symbols whose corresponding sections are garbage collected.
2573 (Symbol_table::Symbol_table): Add new parameter for the garbage
2575 (Symbol_table::gc_mark_undef_symbols): New function.
2576 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2577 (Symbol_table::gc_mark_dyn_syms): New function.
2578 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
2580 (Symbol_table::add_from_object): Likewise.
2581 (Symbol_table::add_from_relobj): When building shared objects, do not
2582 treat externally visible symbols as garbage.
2583 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
2584 table information for static and relocatable links.
2585 * symtab.h (Symbol_table::set_gc): New function.
2586 (Symbol_table::gc): New function.
2587 (Symbol_table::gc_mark_undef_symbols): New function.
2588 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2589 (Symbol_table::gc_mark_dyn_syms): New function.
2590 (Symbol_table::gc_): New data member.
2591 * target.h (Sized_target::gc_process_relocs): New pure virtual
2593 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
2594 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2596 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
2598 * options.h (General_options::gc_sections): Define as a no-op for now.
2599 (General_options::no_keep_memory): Ditto.
2600 (General_options::Bshareable): Define.
2601 * options.cc (General_options::finalize): Honor -Bshareable.
2603 2009-01-20 Andreas Schwab <schwab@suse.de>
2605 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
2606 read the value in the contents, since we don't use it. Use the
2607 template endianness when writing.
2608 (Relocate::relocate): Use it for R_PPC_REL16_HA.
2610 2009-01-19 Andreas Schwab <schwab@suse.de>
2612 * configure.tgt (powerpc64-*): Fix targ_obj.
2614 2009-01-15 Ian Lance Taylor <iant@google.com>
2616 * object.cc (Sized_relobj::write_local_symbols): Don't write out
2617 local symbols when stripping all symbols.
2619 2009-01-14 Cary Coutant <ccoutant@google.com>
2621 * output.cc (Output_reloc): Add explicit instantiations.
2623 2009-01-14 Cary Coutant <ccoutant@google.com>
2625 * archive.cc (Archive::get_elf_object_for_member): Remove call
2626 to File_read::claim_for_plugin.
2627 * descriptors.cc (Descriptors::open): Remove reference to
2629 (Descriptors::claim_for_plugin): Remove.
2630 * descriptors.h (Descriptors::claim_for_plugin): Remove.
2631 (Descriptors::is_claimed): Remove.
2632 (claim_descriptor_for_plugin): Remove.
2633 * fileread.cc (File_read::claim_for_plugin): Remove.
2634 * fileread.h (File_read::claim_for_plugin): Remove.
2635 (File_read::descriptor): Reopen descriptor if necessary.
2636 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
2637 (Plugin_manager::all_symbols_read): Add task parameter. Change
2639 (Plugin_manager::get_input_file): New function.
2640 (Plugin_manager::release_input_file): New function.
2641 (Pluginobj::Pluginobj): Add filesize parameter and initialize
2642 corresponding data member.
2643 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
2644 and pass to base constructor. Change all callers.
2645 (get_input_file, release_input_file): New functions.
2646 (make_sized_plugin_object): Add filesize parameter. Change all callers.
2647 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
2648 (Plugin_manager::all_symbols_read): Add task parameter.
2649 (Plugin_manager::get_input_file): New function.
2650 (Plugin_manager::release_input_file): New function.
2651 (Plugin_manager::task_): New data member.
2652 (Pluginobj::Pluginobj): Add filesize parameter.
2653 (Pluginobj::filename): New function.
2654 (Pluginobj::descriptor): New function.
2655 (Pluginobj::filesize): New function.
2656 (Pluginobj::filesize_): New data member.
2657 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
2658 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
2659 File_read::claim_for_plugin; use Object::unlock to unlock the file.
2661 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
2662 with archive libraries.
2663 * testsuite/Makefile.in: Regenerate.
2664 * testsuite/plugin_test.c (struct sym_info): New type.
2665 (get_input_file, release_input_file): New static variables.
2666 (onload): Capture new transfer vector entries.
2667 (claim_file_hook): Stop reading at end of file according to filesize.
2668 Factor out parsing of readelf output into separate function.
2669 (all_symbols_read_hook): Exercise get_input_file and release_input_file
2670 APIs and get the source file name from the symbol table. Convert
2671 source file name to corresponding object file name. Print info
2672 message when adding new input files.
2673 (parse_readelf_line): New function.
2674 * testsuite/plugin_test_1.sh: Add checks for new info messages.
2675 * testsuite/plugin_test_2.sh: Likewise.
2676 * testsuite/plugin_test_3.sh: Likewise.
2677 * testsuite/plugin_test_4.sh: New test case.
2679 2009-01-07 Ian Lance Taylor <iant@google.com>
2681 * version.cc (version_string): Bump to 1.8.
2683 2008-12-23 Cary Coutant <ccoutant@google.com>
2685 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
2686 * plugin.cc (Plugin_manager::finish): Rename as
2687 layout_deferred_objects. Move cleanup to separate function.
2688 (Plugin_manager::cleanup): New function.
2689 (Plugin_finish::run): Call layout_deferred_objects and cleanup
2691 * plugin.h (Plugin_manager::finish): Rename as
2692 layout_deferred_objects.
2693 (Plugin_manager::cleanup): New function.
2694 (Plugin_manager::cleanup_done): New field.
2696 2008-12-23 Cary Coutant <ccoutant@google.com>
2698 * plugin.cc (is_visible_from_outside): New function.
2699 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
2700 so we don't return "IR only" status for exported symbols or -r links.
2702 * testsuite/Makefile.am (plugin_test_3): New test case.
2703 * testsuite/Makefile.in: Regenerate.
2704 * testsuite/plugin_test_3.sh: New file.
2706 2008-12-22 Cary Coutant <ccoutant@google.com>
2708 * object.cc (Sized_relobj::layout_section): New function.
2709 (Sized_relobj::do_layout): Defer layout of input sections until after
2710 plugin has provided replacement files.
2711 (Sized_relobj::do_layout_deferred_sections): New function.
2712 * object.h (Relobj::set_section_offset): Remove virtual keyword.
2713 (Relobj::layout_deferred_sections): New function.
2714 (Relobj::do_layout_deferred_sections): New function.
2715 (Sized_relobj::do_layout_deferred_sections): New function.
2716 (Sized_relobj::layout_section): New function.
2717 (Sized_relobj::Deferred_layout): New structure.
2718 (Sized_relobj::deferred_layout_): New field.
2719 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
2720 Change all callers. Layout deferred sections.
2721 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
2723 (Plugin_hook::run): Move code from do_plugin_hook inline.
2724 (Plugin_hook::do_plugin_hook): Remove.
2725 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
2726 (Plugin_manager::finish): Renamed, was cleanup.
2727 (Plugin_manager::should_defer_layout): New function.
2728 (Plugin_manager::add_deferred_layout_object): New function.
2729 (Plugin_manager::Deferred_layout_list): New type.
2730 (Plugin_manager::deferred_layout_objects_): New field.
2731 (Plugin_hook::do_plugin_hook): Remove.
2733 2008-12-17 Ian Lance Taylor <iant@google.com>
2735 * options.h (class General_options): Add --no case for
2738 2008-12-16 Cary Coutant <ccoutant@google.com>
2740 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
2742 (Plugin_manager::claim_file): Create plugin object even if
2743 plugin did not call the add_symbols callback.
2744 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
2745 asking for more symbols than were added.
2746 * testsuite/Makefile.am (plugin_test_1): Add test case with
2748 (empty.syms): New target.
2749 * testsuite/Makefile.in: Regenerate.
2750 * testsuite/plugin_test.c (claim_file_hook): Add new debug
2751 message. Don't call add_symbols if no globals.
2752 (all_symbols_read_hook): Don't provide replacement for empty
2755 2008-12-12 Ian Lance Taylor <iant@google.com>
2757 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
2758 r_type == 0 for a local symbol with r_sym == 0.
2759 (scan_relocatable_relocs): Pass r_sym to
2760 local_non_section_strategy.
2761 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
2764 * configure.ac: Update test for TLS descriptors: they are
2765 supported as of glibc 2.9.
2766 * configure: Rebuild.
2768 2008-12-11 Ian Lance Taylor <iant@google.com>
2771 * target-reloc.h (Default_scan_relocatable_relocs): For each
2772 function, map r_type == 0 to RELOC_DISCARD.
2774 2008-12-10 Cary Coutant <ccoutant@google.com>
2776 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
2777 object to override a kept COMDAT group from a plugin object.
2779 2008-12-09 Ian Lance Taylor <iant@google.com>
2782 * yyscript.y (file_cmd): Handle INPUT.
2784 * testsuite/initpri1.c: Change all declarations to be full
2785 prototypes by adding void, to avoid compiler warnings.
2787 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
2789 * options.cc (General_options::parse_plugin_opt): New.
2790 (General_options::add_plugin): The argument now is just the filename.
2791 (General_options::add_plugin_option): New.
2792 * options.h (plugin_opt): New.
2793 (add_plugin): Change argument name.
2794 (add_plugin_option): New.
2795 * plugin.cc (Plugin::load): Don't parse the plugin option.
2796 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
2797 (Plugin::add_option): New.
2798 (Plugin::args_): Change type.
2799 (Plugin::filename_): New.
2800 (Plugin_manager::add_plugin_option): New.
2801 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
2802 * testsuite/Makefile.in: Regenerate.
2804 2008-12-05 Cary Coutant <ccoutant@google.com>
2806 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
2807 Handle --strip-lto-sections option.
2808 * options.h (strip_lto_sections): New option.
2810 2008-12-01 Cary Coutant <ccoutant@google.com>
2812 * plugin.cc (ld_plugin_message): Change format parameter to const.
2813 Fix mismatch between new[] and delete.
2815 2008-11-14 Cary Coutant <ccoutant@google.com>
2817 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
2820 2008-11-05 Craig Silverstein <csilvers@google.com>
2822 * options.cc (General_options::parse_dynamic_list): New function.
2823 * options.h (General_options): New flags dynamic_list,
2824 dynamic_list_data, dynamic_list_cpp_new, and
2825 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
2826 (General_options::in_dynamic_list): New function.
2827 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
2828 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
2829 (Lex::can_continue_name): Likewise.
2831 (read_script_file): New parameter script_options.
2832 (read_dynamic_list): New function.
2833 (Script_options::define_dynamic_list): New function.
2834 (dynamic_list_keyword_parsecodes): New variable.
2835 (dynamic_list_keywords): New variable.
2836 * script.h (Script_options::define_dynamic_list): New function
2838 (read_dynamic_list): New function prototype.
2839 * symtab.cc (strprefix): New macro.
2840 (Symbol::should_add_dynsym_entry): Support dynamic_list,
2841 dynamic_list_data, dynamic_list_cpp_new, and
2842 dynamic_list_cpp_typeinfo.
2843 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
2844 (dynamic_list_expr): New rule.
2845 (dynamic_list_nodes): Likewise.
2846 (dynamic_list_node): Likewise.
2847 * testsuite/Makefile.am (dynamic_list): New test.
2848 * testsuite/Makefile.in: Regenerated.
2849 * testsuite/dynamic_list.t: New file.
2850 * testsuite/dynamic_list.sh: New file.
2852 2008-11-05 Craig Silverstein <csilvers@google.com>
2854 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
2855 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
2856 (t11_last): Likewise.
2857 * testsuite/ver_test_6.c (main): Likewise.
2859 2008-10-07 Cary Coutant <ccoutant@google.com>
2861 * options.c (General_options::finalize): Add check for -static and
2863 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
2866 2008-10-02 Cary Coutant <ccoutant@google.com>
2868 * plugin.cc (make_sized_plugin_object): Fix conditional
2869 compilation to work when not all targets are enabled.
2871 2008-09-29 Cary Coutant <ccoutant@google.com>
2873 * archive.cc (Archive::get_file_and_offset): Use filename instead
2874 of name to get library path.
2875 (Archive::include_member): Unlock external member of a thin archive.
2877 * testsuite/Makefile.am (TEST_AR): New variable.
2878 (thin_archive_test_1): New test.
2879 (thin_archive_test_2): New test.
2880 * testsuite/Makefile.in: Regenerate.
2881 * testsuite/thin_archive_main.cc: New file.
2882 * testsuite/thin_archive_test_1.cc: New file.
2883 * testsuite/thin_archive_test_2.cc: New file.
2884 * testsuite/thin_archive_test_3.cc: New file.
2885 * testsuite/thin_archive_test_4.cc: New file.
2887 2008-09-29 Cary Coutant <ccoutant@google.com>
2889 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
2890 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
2892 (Sized_relobj::do_finalize_local_symbols): Likewise.
2893 (Sized_relobj::map_to_kept_section): Likewise.
2894 * object.h (Sized_relobj::invalid_address): New constant.
2895 (Sized_relobj::do_output_section_offset): Check for invalid_address
2897 * output.cc (Output_reloc::local_section_offset): Use constant
2898 invalid_address instead of -1U.
2899 (Output_reloc::get_address): Likewise.
2900 (Output_section::output_address): Change -1U to -1ULL.
2901 * output.h (Output_reloc::invalid_address): New constant.
2902 * reloc.cc (Sized_relobj::write_sections): Use constant
2903 invalid_address instead of -1U.
2904 (Sized_relobj::relocate_sections): Likewise.
2905 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
2906 values for merge sections.
2907 * target-reloc.h (relocate_for_relocatable): Use constant
2908 invalid_address instead of -1U.
2910 2008-09-19 Cary Coutant <ccoutant@google.com>
2912 Add plugin functionality for link-time optimization (LTO).
2913 * configure.ac (plugins): Add --enable-plugins option.
2914 * configure: Regenerate.
2915 * config.in: Regenerate.
2916 * Makefile.am (LIBDL): New variable.
2917 (CCFILES): Add plugin.cc.
2918 (HFILES): Add plugin.h.
2919 (ldadd_var): Add LIBDL.
2920 * Makefile.in: Regenerate.
2922 * archive.cc: Include "plugin.h".
2923 (Archive::setup): Don't preread archive symbols when using a plugin.
2924 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
2925 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
2927 (Archive::include_member): Add symbols from plugin objects.
2928 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
2929 * descriptors.cc (Descriptors::open): Check for file descriptors
2930 abandoned by plugins.
2931 (Descriptors::claim_for_plugin): New function.
2932 * descriptors.h (Descriptors::claim_for_plugin): New function.
2933 (Open_descriptor::is_claimed): New field.
2934 (claim_descriptor_for_plugin): New function.
2935 * fileread.cc (File_read::claim_for_plugin): New function.
2936 * fileread.h (File_read::claim_for_plugin): New function.
2937 (File_read::descriptor): New function.
2938 * gold.cc: Include "plugin.h".
2939 (queue_initial_tasks): Add task to call plugin hooks for generating
2941 * main.cc: Include "plugin.h".
2942 (main): Load plugin libraries.
2943 * object.h (Pluginobj): Declare.
2944 (Object::pluginobj): New function.
2945 (Object::do_pluginobj): New function.
2946 (Object::set_target): New function.
2947 * options.cc: Include "plugin.h".
2948 (General_options::parse_plugin): New function.
2949 (General_options::General_options): Initialize plugins_ field.
2950 (General_options::add_plugin): New function.
2951 * options.h (Plugin_manager): Declare.
2952 (General_options): Add --plugin option.
2953 (General_options::has_plugins): New function.
2954 (General_options::plugins): New function.
2955 (General_options::add_plugin): New function.
2956 (General_options::plugins_): New field.
2957 * plugin.cc: New file.
2958 * plugin.h: New file.
2959 * readsyms.cc: Include "plugin.h".
2960 (Read_symbols::do_read_symbols): Check for archive before checking
2961 for ELF file. Call plugin hooks to claim files.
2962 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
2963 from a real object file; force override when processing replacement
2965 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
2966 (Symbol::init_base_object): Likewise.
2967 (Symbol::init_base_output_data): Likewise.
2968 (Symbol::init_base_output_segment): Likewise.
2969 (Symbol::init_base_constant): Likewise.
2970 (Symbol::init_base_undefined): Likewise.
2971 (Symbol::output_section): Assert that object is not a plugin.
2972 (Symbol_table::add_from_pluginobj): New function.
2973 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
2975 (Symbol_table::sized_write_globals): Likewise.
2976 (Symbol_table::add_from_pluginobj): Instantiate template.
2977 * symtab.h (Sized_pluginobj): Declare.
2978 (Symbol::in_real_elf): New function.
2979 (Symbol::set_in_real_elf): New function.
2980 (Symbol::in_real_elf_): New field.
2981 (Symbol_table::add_from_pluginobj): New function.
2983 * testsuite/Makefile.am (AM_CFLAGS): New variable.
2984 (LIBDL): New variable.
2986 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
2987 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
2988 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
2989 (MOSTLYCLEANFILES): Likewise.
2990 * testsuite/Makefile.in: Regenerate.
2991 * testsuite/plugin_test.c: New file.
2992 * testsuite/plugin_test_1.sh: New file.
2993 * testsuite/plugin_test_2.sh: New file.
2995 2008-09-16 Ian Lance Taylor <iant@google.com>
2997 * target-reloc.h (relocate_section): Check whether a symbol is
2998 defined by the ABI before reporting an undefined symbol error.
2999 * target.h (Target::is_defined_by_abi): Make parameter const.
3000 (Target::do_is_defined_by_abi): Likewise.
3001 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
3002 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
3003 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
3004 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
3005 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
3006 * testsuite/Makefile.in: Rebuild.
3008 * fileread.cc (make_view): Add casts to avoid warning.
3010 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
3012 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
3013 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3015 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
3017 * options.h (General_options::output_is_executable): New.
3018 (General_options::output_is_pie): New.
3019 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
3020 for shared libraries.
3021 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3023 2008-09-11 Chris Demetriou <cgd@google.com>
3025 * options.h (origin): New -z option.
3026 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
3027 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
3030 2008-09-05 Cary Coutant <ccoutant@google.com>
3032 * fileread.cc (File_read::make_view): Add check for attempt to map
3035 2008-09-05 Cary Coutant <ccoutant@google.com>
3037 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
3038 explicit instantiations.
3040 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
3043 * options.cc (General_options::finalize): Allow undefined symbols
3044 in shlibs if linking -shared.
3047 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
3048 symbols as not needing a dynsym entry.
3050 2008-08-20 Craig Silverstein <csilvers@google.com>
3052 * fileread.cc (File_read::open): Do not lock the file unless it
3053 was successfully opened.
3055 2008-08-14 Cary Coutant <ccoutant@google.com>
3057 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
3058 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
3059 * testsuite/tls_test.cc (struct int128): 128-bit struct
3060 for testing TLS relocs with non-zero addend.
3061 (v12): New TLS variable.
3063 (t_last): Add check for v12.
3064 * testsuite/tls_test.h (t12): New function.
3065 * testsuite/tls_test_main.cc (thread_routine): Call new test.
3067 2008-08-13 Ian Lance Taylor <iant@google.com>
3069 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
3070 set tls_segment_ or relro_segment_.
3071 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
3073 * output.h (Output_section::clear_is_relro): New function.
3074 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
3075 sections specially even when output_data_ is empty.
3076 (Output_segment::maximum_alignment): When first section is relro,
3077 only force alignment for PT_LOAD segments.
3078 * script.cc (script_data_segment_align): New function.
3079 (script_data_segment_relro_end): New function.
3080 * script-c.h (script_data_segment_align): Declare.
3081 (script_data_segment_relro_end): Declare.
3082 * script-sections.h (class Script_sections): Declare
3083 data_segment_align and data_segment_relro_end. Add fields
3084 segment_align_index_ and saw_relro_end_.
3085 * script-sections.cc (class Sections_element): Add set_is_relro
3086 virtual function. Add new bool* parameter to place_orphan_here.
3087 Add get_output_section virtual function.
3088 (class Output_section_definition): Add set_is_relro. Add new
3089 bool* parameter to place_orphan_here. Add get_output_section.
3090 Add is_relro_ field.
3091 (Output_section_definition::Output_section_definition): Initialize
3092 evaluated_address_, evaluated_load_address, evaluated_addralign_,
3093 and is_relro_ fields.
3094 (Output_section_definition::place_orphan_here): Add is_relro
3096 (Output_section_definition::set_section_addresses): Set relro for
3098 (Output_section_definition::alternate_constraint): Likewise.
3099 (class Orphan_output_section): Add new bool* parameter to
3100 place_orphan_here. Add get_output_section.
3101 (Orphan_output_section::place_orphan_here): Add is_relro
3103 (Script_sections::Script_sections): Initialize
3104 data_segment_align_index_ and saw_relro_end_.
3105 (Script_sections::data_segment_align): New function.
3106 (Script_sections::data_segment_relro_end): New function.
3107 (Script_sections::place_orphan): Set or clear is_relro.
3108 (Script_sections::set_section_addresses): Force alignment of first
3110 * yyscript.y (exp): Call script_data_segment_align and
3111 script_data_segment_relro_end.
3112 * testsuite/relro_script_test.t: New file.
3113 * testsuite/relro_test.cc (using_script): Declare.
3114 (t1, t2): Test using_script.
3115 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
3116 (relro_script_test_SOURCES): Define.
3117 (relro_script_test_DEPENDENCIES): Define.
3118 (relro_script_test_LDFLAGS): Define.
3119 (relro_script_test_LDADD): Define.
3120 (relro_script_test.so): New target.
3121 * testsuite/Makefile.in: Rebuild.
3123 2008-08-06 Cary Coutant <ccoutant@google.com>
3125 * archive.cc (Archive::total_archives, Archive::total_members)
3126 (Archive::total_members_loaded): New variables.
3127 (Archive::setup): Add parameter. Add option to preread
3129 (Archive::read_armap): Add counter.
3130 (Archive::get_file_and_offset): New function.
3131 (Archive::get_elf_object_for_member): New function.
3132 (Archive::read_all_symbols): New function.
3133 (Archive::read_symbols): New function.
3134 (Archive::add_symbols): Add counters.
3135 (Archive::include_all_members): Use armap to find members if it's
3137 (Archive::include_member): Skip reading symbols if already read.
3138 Factored code into Archive::get_file_and_offset and
3139 Archive::get_elf_object_for_member. Changed call to
3140 Mapfile::report_include_archive_member.
3141 (Archive::print_stats): New function.
3142 * archive.h: Declare Object and Read_symbols_data classes.
3143 (Archive::Archive): Add initializers for new members.
3144 (Archive::setup): Add parameter.
3145 (Archive::print_stats): New function.
3146 (Archive::total_archives, Archive::total_members)
3147 (Archive::total_members_loaded): New variables.
3148 (Archive::get_file_and_offset): New function.
3149 (Archive::get_elf_object_for_member): New function.
3150 (Archive::read_all_symbols): New function.
3151 (Archive::read_symbols): New function.
3152 (Archive::Archive_member): New class.
3153 (Archive::members_): New member.
3154 (Archive::num_members_): New member.
3155 * main.cc: Include archive.h.
3156 (main): Call Archive::print_stats.
3157 * mapfile.cc (Mapfile::report_include_archive_member): Delete
3158 archive parameter; member_name is now the fully-decorated name.
3159 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
3160 * options.h: (General_options): Add --preread-archive-symbols option.
3161 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
3164 2008-08-04 Ian Lance Taylor <iant@google.com>
3166 * symtab.h (Symbol::use_plt_offset): New function.
3167 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
3168 * powerpc.cc (Relocate::relocate): Likewise.
3169 * sparc.cc (Relocate::relocate): Likewise.
3170 * x86_64.cc (Relocate::relocate): Likewise.
3171 * testsuite/weak_plt.sh: New test.
3172 * testsuite/weak_plt_main.cc: New test.
3173 * testsuite/weak_plt_shared.cc: New test.
3174 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
3175 (check_PROGRAMS): Add weak_plt.
3176 (check_DATA): Add weak_plt_shared.so.
3177 (weak_plt_main_pic.o, weak_plt): New targets.
3178 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
3179 * testsuite/Makefile.in: Rebuild.
3181 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
3183 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
3184 * testsuite/Makefile.in: Rebuild.
3186 2008-08-04 Alan Modra <amodra@bigpond.net.au>
3188 * Makefile.am (POTFILES.in): Set LC_ALL=C.
3189 * Makefile.in: Regenerate.
3190 * po/POTFILES.in: Regenerate.
3192 2008-07-29 Ian Lance Taylor <iant@google.com>
3194 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
3195 symbols before other symbols.
3196 * testsuite/script_test_2.cc (test_addr): Declare.
3197 (test_addr_alias): Declare.
3198 (main): Check that test_addr and test_addr_alias have the right
3200 * testsuite/script_test_2.t: Define test_addr_alias and
3203 2008-07-24 Ian Lance Taylor <iant@google.com>
3206 * descriptors.cc: New file.
3207 * descriptors.h: New file.
3208 * gold-threads.h (class Hold_optional_lock): New class.
3209 * fileread.cc: Include "descriptors.h".
3210 (File_read::~File_read): Release descriptor rather than closing
3212 (File_read::open) [file]: Call open_descriptor rather than open.
3213 Set is_descriptor_opened_.
3214 (File_read::open) [memory]: Assert that descriptor is not open.
3215 (File_read::reopen_descriptor): New function.
3216 (File_read::release): Release descriptor.
3217 (File_read::do_read): Make non-const. Reopen descriptor.
3218 (File_read::read): Make non-const.
3219 (File_read::make_view): Reopen descriptor.
3220 (File_read::do_readv): Likewise.
3221 * fileread.h (class File_read): Add is_descriptor_opened_ field.
3222 Update declarations.
3223 * layout.cc: Include "descriptors.h".
3224 (Layout::create_build_id): Use open_descriptor rather than open.
3225 * output.cc: Include "descriptors.h".
3226 (Output_file::open): Use open_descriptor rather than open.
3227 * archive.cc (Archive::const_iterator): Change Archive to be
3229 (Archive::begin, Archive::end): Make non-const.
3230 (Archive::count_members): Likewise.
3231 * archive.h (class Archive): Update declarations.
3232 * object.h (Object::read): Make non-const.
3233 * Makefile.am (CCFILES): Add descriptors.cc.
3234 (HFILES): Add descriptors.h.
3235 * Makefile.in: Rebuild.
3238 * gold.h: Always include <clocale>. Add Solaris workarounds
3239 following code in binutils/sysdep.h.
3242 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
3243 this->eh_frame_hdr_ is NULL before using it.
3245 * dynobj.cc (Versions::Versions): Update comment.
3247 * dynobj.cc (Versions::Versions): If there is an soname, use it as
3248 the base version name.
3250 * stringpool.cc (Stringpool_template::add_with_length): Set key to
3251 array size plus one.
3252 (Stringpool_template::set_string_offsets): Subtract one from key
3253 before using it as an array index.
3254 (Stringpool_template::get_offset_with_length): Likewise.
3255 (Stringpool_template::write_to_buffer): Likewise.
3256 * stringpool.h (Stringpool_template::get_offset_from_key):
3259 2008-07-23 Ian Lance Taylor <iant@google.com>
3262 * object.h (Merged_symbol_value::value): Do our best to handle a
3266 * script.cc (Version_script_info::get_versions): Don't add empty
3267 version tag to return value.
3268 (Version_script_info::get_symbol_version_helper): Change return
3269 type to bool. Add pversion parameter. Change all callers.
3270 (script_register_vers_node): Don't require a non-NULL tag.
3271 * script.h (class Version_script_info): Update declarations.
3272 (Version_script_info::get_symbol_version): Change return type to
3273 bool. Add version parameter. Change all callers.
3274 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
3275 handling. Handle an empty version from a version script.
3276 (Symbol_table::define_special_symbol): Likewise.
3277 * testsuite/ver_test_10.script: New file.
3278 * testsuite/ver_test_10.sh: New file.
3279 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
3280 (check_DATA): Add ver_test_10.syms.
3281 (ver_test_10.syms, ver_test_10.so): New target.
3282 * testsuite/Makefile.in: Rebuild.
3284 2008-07-23 Simon Baldwin <simonb@google.com>
3286 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
3287 to zero for undefined symbols from dynamic libraries.
3289 2008-07-23 Ian Lance Taylor <iant@google.com>
3291 * symtab.cc (Symbol_table::resolve): Remove version parameter.
3293 * symtab.h (class Symbol_table): Update declaration.
3294 * testsuite/ver_test_9.cc: New file.
3295 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
3296 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
3297 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
3298 (ver_test_9.so, ver_test_9.o): New targets.
3299 * testsuite/Makefile.in: Rebuild.
3301 2008-07-22 Ian Lance Taylor <iant@google.com>
3303 * options.h (class General_options): Define --check-sections.
3304 * layout.cc (Layout::set_segment_offsets): Handle
3307 * options.h (class General_options): Define -n/--nmagic and
3309 * options.cc (General_options::finalize): For -n/--nmagic or
3310 -N/--omagic, set -static.
3311 * layout.cc (Layout::attach_allocated_section_to_segment): If
3312 -N/--omagic, don't put read-only and read-write sections in
3314 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
3315 finding a read-only segment.
3316 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
3317 don't set the minimum segment alignment to the common page size,
3318 and don't set the file offset to the address modulo the page size.
3319 * script-sections.cc (Script_sections::create_segments): If
3320 -n/--omagic, don't put read-only and read-write sections in
3323 * cref.cc: New file.
3325 * options.h (class General_options): Add --print-symbol-counts.
3326 * main.cc (main): Issue defined symbol report if requested.
3327 * archive.cc (Archive::interpret_header): Make into a const member
3329 (Archive::add_symbols): Call Input_objects::archive_start and
3331 (Archive::const_iterator): Define new class.
3332 (Archive::begin, Archive::end): New functions.
3333 (Archive::include_all_members): Rewrite to use iterator.
3334 (Archive::count_members): New function.
3335 * archive.h (class Archive): Update declarations.
3336 (Archive::filename): New function.
3337 * object.cc: Include "cref.h".
3338 (Sized_relobj::Sized_relobj): Initialize defined_count_.
3339 (Sized_relobj::do_get_global_symbol_counts): New function.
3340 (Input_objects::add_object): Add object to cross-referencer.
3341 (Input_objects::archive_start): New function.
3342 (Input_objects::archive_stop): New function.
3343 (Input_objects::print_symbol_counts): New function.
3344 * object.h: Declare Cref and Archive.
3345 (Object::get_global_symbol_counts): New function.
3346 (Object::do_get_global_symbol_counts): New pure virtual function.
3347 (class Sized_relobj): Add defined_count_ field. Update
3349 (class Input_objects): Add cref_ field. Update constructor.
3350 Update declarations.
3351 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
3353 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
3355 (Sized_dynobj::do_get_global_symbol_counts): New function.
3356 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
3357 defined_count_. Update declarations. Define Symbols typedef.
3358 * symtab.cc (Symbol_table::add_from_relobj): Add defined
3359 parameter. Change all callers.
3360 (Symbol_table::add_from_dynobj): Add sympointers and defined
3361 parameters. Change all callers.
3362 * symtab.h (class Symbol_table): Update declarations.
3363 * Makefile.am (CCFILES): Add cref.cc.
3364 (HFILES): Add cref.h.
3365 * Makefile.in: Rebuild.
3367 2008-07-22 Simon Baldwin <simonb@google.com>
3369 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
3370 to zero when writing undefined symbols.
3372 2008-07-22 Ian Lance Taylor <iant@google.com>
3374 * output.cc (Output_section::add_input_section): Don't try to
3375 merge empty merge sections.
3377 2008-07-21 Craig Silverstein <csilvers@google.com>
3379 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3380 Include symbol version in error message.
3382 2008-07-20 Chris Demetriou <cgd@google.com>
3384 * configure.ac (gold_cv_c_random_seed): New configured variable.
3385 (RANDOM_SEED_CFLAGS): New substituted variable.
3386 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
3387 * configure: Rebuild.
3388 * Makefile.in: Likewise.
3389 * testsuite/Makefile.in: Likewise.
3391 2008-07-18 Ian Lance Taylor <iant@google.com>
3393 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
3394 where we see NAME/NULL and NAME/VERSION as separate symbols.
3395 * testsuite/ver_test_main.cc (main): Call t4.
3396 (t4, t4_2a): Define.
3397 * testsuite/ver_test_2.cc (t4_2): Define.
3398 * testsuite/ver_test_2.script: Put t4_2a in VER2.
3399 * testsuite/ver_test_4.cc (t4_2a): Define.
3400 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3401 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3403 2008-07-17 Ian Lance Taylor <iant@google.com>
3405 * dynobj.cc (Versions::add_def): If we give an error about a
3406 missing version, go ahead and create the version anyhow.
3408 2008-07-10 Ian Lance Taylor <iant@google.com>
3410 Handle output sections with more than 0x7fffffff bytes.
3411 * object.h (class Relobj): Change map_to_output_ to
3412 output_sections_, and just keep a section pointer. Change all
3413 uses. Move comdat group support to Sized_relobj.
3414 (Relobj::is_section_specially_mapped): Remove.
3415 (Relobj::output_section): Remove poff parameter. Change all
3417 (Relobj::output_section_offset): New function.
3418 (Relobj::set_section_offset): Rewrite.
3419 (Relobj::map_to_output): Remove.
3420 (Relobj::output_sections): New function.
3421 (Relobj::do_output_section_offset): New pure virtual function.
3422 (Relobj::do_set_section_offset): Likewise.
3423 (class Sized_relobj): Add section_offsets_ field. Add comdat
3424 group support from Relobj. Update declarations.
3425 (Sized_relobj::get_output_section_offset): New function.
3426 (Sized_relobj::do_output_section_offset): New function.
3427 (Sized_relobj::do_set_section_offset): New function.
3428 * object.cc (Relobj::output_section_address): Remove.
3429 (Sized_relobj::Sized_relobj): Initialize new fields.
3430 (Sized_relobj::include_section_group): Cast find_kept_object to
3432 (Sized_relobj::include_linkonce_section): Likewise.
3433 (Sized_relobj::do_layout): Use separate arrays for output section
3435 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3437 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3438 output_sections and section_offsets.
3439 (Sized_relobj::write_local_symbols): Likewise.
3440 (map_to_kept_section): Compute output address directly.
3441 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3442 output_sections and section_offsets.
3443 (Sized_relobj::write_sections): Likewise.
3444 (Sized_relobj::relocate_sections): Likewise.
3445 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3446 * output.h (class Output_reloc): Update declarations. Change
3447 u2_.relobj to Sized_relobj*.
3448 (class Output_data_reloc): Change add functions to use
3450 * output.cc (Output_reloc::Output_reloc): Change relobj to
3452 (Output_reloc::local_section_offset): Change return type to
3453 Elf_Addr. Use get_output_section_offset.
3454 (Output_reloc::get_address): Likewise.
3455 (Output_section::is_input_address_mapped): Don't call
3456 is_section_specially_mapped.
3457 (Output_section::output_offset): Likewise.
3458 (Output_section::output_address): Likewise.
3459 (Output_section::starting_output_address): Likewise.
3460 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3461 parameter to Sized_relobj*.
3462 (Copy_relocs::need_copy_reloc): Likewise.
3463 (Copy_relocs::save): Likewise.
3464 * copy-relocs.h (class Copy_relocs): Update declarations.
3465 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3466 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3467 * target-reloc.h (relocate_for_relocatable): Change
3468 offset_in_output_section type to Elf_Addr. Change code that uses
3470 * layout.cc (Layout::layout): Always set *off.
3471 * mapfile.cc (Mapfile::print_input_section): Use
3472 output_section_offset.
3473 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3475 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3476 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3477 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3479 2008-07-03 Ian Lance Taylor <iant@google.com>
3481 * layout.cc (Layout::include_section): Do not discard unrecognized
3482 SHT_STRTAB sections.
3484 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3486 * script.cc (Lex::can_continue_name): Make '?' allowable in
3487 version-script names.
3488 * testsuite/version_script.map: Change glob pattern to use '?'
3490 2008-06-30 Manish Singh <yosh@gimp.org>
3493 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3496 2008-06-30 Ian Lance Taylor <iant@google.com>
3500 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3501 versions]: Don't try to read the value in the contents, since we
3502 don't use it. Use the template endianness when writing.
3504 2008-06-25 Cary Coutant <ccoutant@google.com>
3506 * fileread.cc (File_read::make_view): Assert on zero-length view.
3507 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3508 symbol table when there are no symbols to read.
3510 2008-06-23 Craig Silverstein <csilvers@google.com>
3512 * version.cc (version_string): Bump to 1.7
3514 2008-06-18 Craig Silverstein <csilvers@google.com>
3516 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3517 constant 0xFFFF to type Valtype.
3518 (Powerpc_relocate_functions::rel16_ha): Likewise.
3520 2008-06-17 Ian Lance Taylor <iant@google.com>
3522 * output.h (Output_section::Input_section): Initialize p2align_ to
3523 zero for Output_section_data constructors.
3524 (Output_section::Input_section::addralign): If not an input
3525 section, return the alignment of the Output_section_data.
3526 * testsuite/copy_test.cc: New file.
3527 * testsuite/copy_test_1.cc: New file.
3528 * testsuite/copy_test_2.cc: New file.
3529 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3530 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3531 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3532 (copy_test_1_pic.o, copy_test_1.so): New targets.
3533 (copy_test_2_pic.o, copy_test_2.so): New targets.
3534 * testsuite/Makefile.in: Rebuild.
3536 * script-sections.cc (Script_sections::place_orphan): Initialize
3537 local variable exact.
3539 2008-06-13 David Edelsohn <edelsohn@gnu.org>
3541 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3543 2008-06-12 David Edelsohn <edelsohn@gnu.org>
3544 David S. Miller <davem@davemloft.net>
3546 * powerpc.cc: New file.
3547 * Makefile.am (TARGETSOURCES): Add powerpc.cc
3548 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
3549 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
3550 * Makefile.in: Rebuild.
3552 2008-06-09 Ian Lance Taylor <iant@google.com>
3554 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
3556 (throwing, orig_terminate): New static variables.
3557 (terminate_handler): New static function.
3558 (t2): Set terminate handler.
3560 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
3563 * binary.cc (Binary_to_elf::sized_convert): Fix .data
3566 2008-05-30 Cary Coutant <ccoutant@google.com>
3568 * archive.cc (Archive::include_all_members) Correct to step
3569 over symbol table and extended name table in thin archives.
3571 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
3574 * target-reloc.h (relocate_for_relocatable): Fix new_offset
3577 2008-05-28 Caleb Howe <cshowe@google.com>
3579 * reduced_debug_output.cc: New file.
3580 * reduced_debug_output.h: New file.
3581 * options.h (class General_options): Add --strip-debug-non-line.
3582 * options.cc (General_options::finalize): Add strip_debug_non_line
3583 to the strip heirarchy.
3584 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
3586 * layout.cc: Include "reduced_debug_output.h".
3587 (Layout::Layout): Initialize new fields.
3588 (line_only_debug_sections): New static array.
3589 (is_lines_only_debug_sections): New static inline function.
3590 (Layout::include_section): Handle --strip-debug-non-line.
3591 (Layout::make_output_section): If --strip-debug-non-line, build
3592 new output sections for .debug_abbrev and .debug_info.
3593 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
3594 gold. Warn about possible overflow.
3595 (read_signed_LEB_128): Likewise.
3596 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
3597 (read_signed_LEB_128): Declare.
3598 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
3599 (HFILES): Add reduced_debug_output.h.
3600 * Makefile.in: Rebuild.
3602 2008-05-21 Ian Lance Taylor <iant@google.com>
3604 * mapfile.cc: New file.
3605 * mapfile.h: New file.
3606 * options.h (class General_options): Add -M/--print-map and -Map.
3607 * options.cc (General_options::finalize): Make -M equivalent to
3609 * main.cc: Include <cstdio> and "mapfile.h".
3610 (main): Open mapfile if requested.
3611 * gold.cc (class Middle_runner): Add mapfile_ field. Update
3612 constructor. Change caller.
3613 (queue_initial_tasks): Add mapfile parameter. Change caller.
3614 (queue_middle_tasks): Likewise.
3615 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
3617 * archive.cc: Include "mapfile.h".
3618 (Archive::add_symbols): Add mapfile parameter. Change all
3619 callers. Pass mapfile, symbol, and reason to include_member.
3620 (Archive::include_all_members): Add mapfile parameter. Change all
3622 (Archive::include_member): Add mapfile, sym, and why parameters.
3623 Change all callers. Report inclusion to map file.
3624 * archive.h: Include "fileread.h".
3625 (class Archive): Update declarations.
3626 (Archive::file): New const method.
3627 (class Add_archive_symbols): Add mapfile_ field. Update
3628 constructor. Change all callers.
3629 * readsyms.h (class Read_symbols): Likewise.
3630 (class Finish_group): Likewise.
3631 (class Read_script): Likewise.
3632 * common.cc: Include "mapfile.h".
3633 (Symbol_table::allocate_commons): Add mapfile parameter. Change
3635 (Symbol_table::do_allocate_commons): Likewise.
3636 (Symbol_table::do_allocate_commons_list): Likewise. Report common
3637 symbol allocation to mapfile.
3638 * common.h (class Allocate_commons_task): Add mapfile_ field.
3639 Update constructor. Change all callers.
3640 * symtab.h (class Symbol_table): Update declarations.
3641 * layout.cc: Include "mapfile.h".
3642 (Layout_task_runner::run): Print information to mapfile.
3643 (Layout::create_gold_note): Change Output_data_fixed_space to
3644 Output_data_zero_fill.
3645 (Layout::create_build_id): Likewise.
3646 (Layout::print_to_mapfile): New function.
3647 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
3648 constructor. Change caller.
3649 (class Layout): Declare print_to_mapfile.
3650 * output.cc (Output_section::Input_section::print_to_mapfile): New
3652 (Output_section::add_input_section): If producing a map, always
3653 add to input_sections_ list.
3654 (Output_section::do_print_to_mapfile): New function.
3655 (Output_segment::print_sections_to_mapfile): New function.
3656 (Output_segment::print_section_list_to_mapfile): New function.
3657 * output.h: Include "mapfile.h".
3658 (Output_data::print_to_mapfile): New function.
3659 (Output_data::do_print_to_mapfile): New virtual function.
3660 (Output_segment_headers::do_print_to_mapfile): New function.
3661 (Output_file_header::do_print_to_mapfile): New function.
3662 (Output_data_const::do_print_to_mapfile): New function.
3663 (class Output_data_const_buffer): Add map_name_ field. Update
3664 constructor. Change all callers. Add do_print_to_mapfile
3666 (class Output_data_fixed_space): Likewise.
3667 (class Output_data_space): Likewise.
3668 (class Output_data_zero_fill): New class.
3669 (Output_data_strtab::do_print_to_mapfile): New function.
3670 (Output_data_reloc_base::do_print_to_mapfile): New function.
3671 (Output_relocatable_relocs::do_print_to_mapfile): New function.
3672 (Output_data_group::do_print_to_mapfile): New function.
3673 (Output_data_got::do_print_to_mapfile): New function.
3674 (Output_data_dynamic::do_print_to_mapfile): New function.
3675 (Output_symtab_xindex::do_print_to_mapfile): New function.
3676 (class Output_section): Declare do_print_to_mapflie. Declare
3677 print_to_mapfile in Input_section.
3678 (class Output_segment): Declare new functions.
3679 * object.h (Sized_relobj::symbol_count): New function.
3680 * script-sections.cc
3681 (Output_section_element_dot_assignment::set_section_addresses):
3682 Change Output_data_fixed_space to Output_data_zero_fill.
3683 (Output_data_expression::do_print_to_mapfile): New function.
3684 * script.cc (read_input_script): Add mapfile parameter. Change
3686 * script.h (read_input_script): Update declaration.
3687 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
3688 (Eh_frame::do_print_to_mapfile): New function.
3689 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
3690 (Output_merge_string::do_print_to_mapfile): New function.
3691 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
3693 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
3695 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
3697 * Makefile.am (CCFILES): Add mapfile.cc.
3698 (HFILES): Add mapfile.h.
3699 * Makefile.in: Rebuild.
3701 2008-05-19 Ian Lance Taylor <iant@google.com>
3703 * options.h (class General_options): Add -z relro.
3704 * layout.cc (Layout::Layout): Initialize relro_segment_.
3705 (Layout::add_output_section_data): Return the output section.
3706 (Layout::make_output_section): Rcognize relro sections and mark
3708 (Layout::attach_allocated_section_to_segment): Put relro sections
3709 in a PT_GNU_RELRO segment.
3710 (Layout::create_initial_dynamic_sections): Mark the .dynamic
3712 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
3714 (Layout::linkonce_mapping): Map d.rel.ro.local to
3716 (Layout::output_section_name): Us .data.rel.ro.local for any
3717 section which begins with that.
3718 * layout.h (class Layout): Update add_output_section_data
3719 declaration. Add relro_segment_ field.
3720 * output.cc (Output_section::Output_section): Initialize is_relro_
3721 and is_relro_local_ fields.
3722 (Output_segment::add_output_section): Group relro sections.
3723 (Output_segment::is_first_section_relro): New function.
3724 (Output_segment::maximum_alignment): If there is a relro section,
3725 align the segment to the common page size.
3726 (Output_segment::set_section_addresses): Track whether we are
3727 looking at relro sections. If the last section is a relro
3728 section, align to the common page size.
3729 (Output_segment::set_section_list_addresses): Add in_relro
3730 parameter. Change all callers. Align to the page size when
3731 moving from relro to non-relro section.
3732 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
3734 * output.h (class Output_section): Add is_relro_ and
3735 is_relro_local_ fields.
3736 (Output_section::is_relro): New function.
3737 (Output_section::set_is_relro): New function.
3738 (Output_section::is_relro_local): New function.
3739 (Output_section::set_is_relro_local): New function.
3740 (class Output_segment): Update declarations.
3741 * i386.cc (Target_i386::got_section): Mark .got section as relro.
3742 * sparc.cc (Target_sparc::got_section): Likewise.
3743 * x86_64.cc (Target_x86_64::got_section): Likewise.
3744 * testsuite/relro_test_main.cc: New file.
3745 * testsuite/relro_test.cc: New file.
3746 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
3747 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
3748 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
3749 (relro_test.so, relro_test_pic.o): New targets.
3750 * testsuite/Makefile.in: Rebuild.
3752 2008-05-16 Ian Lance Taylor <iant@google.com>
3754 * output.cc (Output_segment::add_output_section): Remove front
3756 * output.h (class Output_segment): Remove
3757 add_initial_output_section and overloaded add_output_section.
3758 Update declaration of remaining add_output_section.
3759 * layout.cc (Layout::create_interp): Call add_output_section
3760 rather than add_initial_output_section.
3761 (Layout::finish_dynamic_section): Likewise.
3763 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
3764 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
3765 know the dynamic type.
3766 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
3767 field. Initialize it in constructor.
3768 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
3769 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
3770 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
3773 * output.cc (Output_reloc::get_address): Change return type to
3775 * output.h (class Output_reloc): Update get_address declaration.
3776 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
3777 for section addresses.
3779 2008-05-09 Ian Lance Taylor <iant@google.com>
3782 * gold.cc (gold_nomem): Use return value of write.
3784 2008-05-08 Ian Lance Taylor <iant@google.com>
3786 * symtab.c (Symbol::init_base_output_data): Add version
3787 parameter. Change all callers.
3788 (Symbol::init_base_output_segment): Likewise.
3789 (Symbol::init_base_constant): Likewise.
3790 (Symbol::init_base_undefined): Likewise.
3791 (Sized_symbol::init_output_data): Likewise.
3792 (Sized_symbol::init_output_segment): Likewise.
3793 (Sized_symbol::init_constant): Likewise.
3794 (Sized_symbol::init_undefined): Likewise.
3795 (Symbol_table::do_define_in_output_data): If the new symbol has a
3796 version, mark it as the default.
3797 (Symbol_table::do_define_in_output_segment): Likewise.
3798 (Symbol_table::do_define_as_constant): Likewise.
3799 * symtab.h (class Symbol): Update declarations.
3800 (class Sized_symbol): Likewise.
3801 * resolve.cc (Symbol::override_version): New function.
3802 (Symbol::override_base): Call override_version.
3803 (Symbol::override_base_with_special): Likewise.
3804 * testsuite/ver_script_8.script: New file.
3805 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
3806 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
3807 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
3808 (ver_test_8_1.so, ver_test_8_2.so): New targets.
3810 2008-05-06 Ian Lance Taylor <iant@google.com>
3813 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
3815 (class General_options): Remove existing --undefined, and add
3816 --no-undefined instead. Add new --undefined as synonym for -u.
3817 * archive.cc (Archive::add_symbols): Check whether symbol was
3819 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
3820 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
3821 all uses. Add IS_UNDEFINED. Update declarations to split
3822 different versions of init_base. Declare init_base_undefined.
3823 (Symbol::is_defined): Handle IS_UNDEFINED.
3824 (Symbol::is_undefined): Likewise.
3825 (Symbol::is_weak_undefined): Call is_undefined.
3826 (Symbol::is_absolute): Handle IS_CONSTANT.
3827 (class Sized_symbol): Update declarations to split different
3828 versions of init. Declare init_undefined.
3829 (class Symbol_table): Declare new functions.
3830 * symtab.cc (Symbol::init_base_object): Rename from init_base.
3832 (Symbol::init_base_output_data): Likewise.
3833 (Symbol::init_base_output_segment): Likewise.
3834 (Symbol::init_base_constant): Likewise.
3835 (Symbol::init_base_undefined): New function.
3836 (Sized_symbol::init_object): Rename from init. Change all
3838 (Sized_symbol::init_output_data): Likewise.
3839 (Sized_symbol::init_output_segment): Likewise.
3840 (Sized_symbol::init_constant): Likewise.
3841 (Sized_symbol::init_undefined): New function.
3842 (Symbol_table::add_undefined_symbols_from_command_line): New
3844 (Symbol_table::do_add_undefined_symbols_from_command_line): New
3846 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
3847 (Symbol::output_section): Likewise.
3848 (Symbol::set_output_section): Likewise.
3849 (Symbol_table::sized_finalize_symbol): Likewise.
3850 (Symbol_table::sized_write_globals): Likewise.
3851 * resolve.cc (Symbol_table::should_override): Likewise.
3852 (Symbol::override_base_with_special): Likewise.
3854 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
3855 symbol, change it to have default visibility.
3856 * testsuite/protected_1.cc: New file.
3857 * testsuite/protected_2.cc: New file.
3858 * testsuite/protected_3.cc: New file.
3859 * testsuite/protected_main_1.cc: New file.
3860 * testsuite/protected_main_2.cc: New file.
3861 * testsuite/protected_main_3.cc: New file.
3862 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
3863 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
3864 (protected_1_LDFLAGS, protected_1_LDADD): Define.
3865 (protected_1.so): New target.
3866 (protected_1_pic.o, protected_2_pic.o): New targets.
3867 (protected_3_pic.o): New target.
3868 (check_PROGRAMS): Add protected_2.
3869 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
3870 (protected_2_LDFLAGS, protected_2_LDADD): Define.
3871 * testsuite/Makefile.in: Rebuild.
3873 * options.h (DEFINE_var): Add set_user_set_##varname__.
3874 (DEFINE_bool_alias): New macro.
3875 (class General_options): Define -Bstatic using DEFINE_bool_alias
3876 rather than DEFINE_special. Add --undefined as an alias for -z
3878 * options.cc (General_options::parse_Bstatic): Remove.
3880 * options.h (class General_options): Add --fatal-warnings.
3881 * main.cc (main): Implement --fatal-warnings.
3882 * errors.h (Errors::warning_count): New function.
3884 * options.h (class General_options): Add -Bsymbolic-functions.
3885 * symtab.h (Symbol::is_preemptible): Check for
3886 -Bsymbolic-functions.
3888 2008-05-05 Ian Lance Taylor <iant@google.com>
3890 * options.h (DEFINE_bool): For DASH_Z, create the negative option
3891 as noVARNAME rather than no-VARNAME.
3892 (class General_options): Add option -z combreloc.
3893 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
3895 (Output_reloc::sort_before) [SHT_REL]: New function.
3896 (Output_reloc::sort_before) [SHT_RELA]: New function.
3897 (class Output_data_reloc_base): Add sort_relocs_ field. Define
3898 Sort_relocs_comparison.
3899 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
3900 parameter. Change all callers.
3901 (Output_data_reloc::Output_data_reloc) [both versions]: Add
3902 sort_relocs parameter. Change all callers.
3903 * output.cc (Output_reloc::get_address): New function, broken out
3905 (Output_reloc::write_rel): Call it.
3906 (Output_reloc::compare): New function.
3907 (Output_data_reloc_base::do_write): Optionally sort relocs.
3909 * configure.ac: If targ_extra_obj is set, link it in.
3910 * configure.tgt: Initialize all variables.
3911 (x86_64*): Set targ_extra_obj and targ_extra_size.
3912 * configure: Rebuild.
3914 * object.cc (Sized_relobj::include_section_group): Adjust section
3915 indexes read from group data. Build vector to pass to
3917 * layout.cc (Layout::layout_group): Add flags and shndxes
3918 parameters. Remove contents parameter. Change caller. Update
3919 explicit instantiations.
3920 * layout.h (class Layout): Update layout_group declaration.
3921 * output.cc (Output_data_group::Output_data_group): Add flags and
3922 input_shndxes parameters. Remove contents parameter. Change
3924 (Output_data_group::do_write): Change input_sections_ to
3926 * output.h (class Output_data_group): Update constructor
3927 declaration. Rename input_sections_ to input_shndxes_.
3928 * testsuite/many_sections_test.cc: Add template.
3930 2008-04-30 Cary Coutant <ccoutant@google.com>
3932 * target-reloc.h (relocate_section): Fix dead-pointer bug.
3934 * layout.cc (Layout::include_section): Refactored check for debug
3936 (Layout::add_comdat): Add new parameters. Change type
3937 of signature parameter. Add object and shndx to signatures table.
3938 (Layout::find_kept_object): New function.
3939 * layout.h: Include <cstring>.
3940 (Layout::is_debug_info_section): New function.
3941 (Layout::add_comdat): Add new parameters.
3942 (Layout::find_kept_object): New function.
3943 (Layout::Kept_section): New struct.
3944 (Layout::Signatures): Change type of map range.
3945 * object.cc (Relobj::output_section_address): New function.
3946 (Sized_relobj::include_section_group): Add new parameters. Change
3947 calls to Layout::add_comdat. Change to build table of kept comdat
3948 groups and table mapping discarded sections to kept sections.
3949 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
3950 (Sized_relobj::do_layout): Change calls to include_section_group and
3951 include_linkonce_section.
3952 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
3953 value to zero when section is discarded.
3954 (Sized_relobj::map_to_kept_section): New function.
3955 * object.h (Relobj::output_section_address): New function.
3956 (Relobj::Comdat_group): New type.
3957 (Relobj::find_comdat_group): New function.
3958 (Relobj::Comdat_group_table): New type.
3959 (Relobj::Kept_comdat_section): New type.
3960 (Relobj::Kept_comdat_section_table): New type.
3961 (Relobj::add_comdat_group): New function.
3962 (Relobj::set_kept_comdat_section): New function.
3963 (Relobj::get_kept_comdat_section): New function.
3964 (Relobj::comdat_groups_): New field.
3965 (Relobj::kept_comdat_sections_): New field.
3966 (Symbol_value::input_value): Update comment.
3967 (Sized_relobj::map_to_kept_section) New function.
3968 (Sized_relobj::include_linkonce_section): Add new parameter.
3969 * target-reloc.h (Comdat_behavior): New type.
3970 (get_comdat_behavior): New function.
3971 (relocate_section): Add code to map a discarded section to the
3972 corresponding kept section when applying a relocation.
3974 2008-04-30 Craig Silverstein <csilvers@google.com>
3976 * dwarf_reader.cc (next_generation_count): New static var.
3977 (Addr2line_cache_entry): New struct.
3978 (addr2line_cache): New static var.
3979 (Dwarf_line_info::one_addr2line): Added caching.
3980 (Dwarf_line_info::clear_addr2line_cache): New function.
3981 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
3982 cache-size parameter.
3983 (Dwarf_line_info::one_addr2line_cache): New function.
3984 * symtab.cc (Symbol_table::detect_odr_violations): Pass
3985 new cache-size argument to one_addr2line(), and clear cache.
3987 2008-04-28 Cary Coutant <ccoutant@google.com>
3989 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
3990 R_386_PC8 relocations.
3992 2008-04-23 Ian Lance Taylor <iant@google.com>
3994 * object.cc (Sized_relobj::include_section_group): Check for
3995 invalid section group.
3997 * object.cc (make_elf_object): Correct test for 64-bit ELF file
4000 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
4001 than read for file header.
4002 * archive.cc (Archive::include_member): Likewise.
4004 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
4006 * aclocal.m4: Regenerate.
4007 * configure: Regenerate.
4009 2008-04-19 Ian Lance Taylor <iant@google.com>
4011 * version.cc (version_string): Bump to 1.6.
4013 * testsuite/Makefile.am (many_sections_r_test): New target.
4014 (many_sections_r_test_SOURCES): Remove.
4015 (many_sections_r_test_DEPENDENCIES): Remove.
4016 (many_sections_r_test_LDFLAGS): Remove.
4017 (many_sections_r_test_LDADD): Remove.
4019 * object.cc (Sized_relobj::do_add_symbols): Always pass
4020 local_symbol_count_ to add_from_relobj.
4022 * testsuite/Makefile.am (many_sections_check.h): Only check one in
4023 every thousand variables.
4024 * testsuite/Makefile.in: Rebuild.
4026 * object.cc (Xindex::initialize_symtab_xindex): New function.
4027 (Xindex::read_symtab_xindex): New function.
4028 (Xindex::sym_xindex_to_shndx): New function.
4029 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
4031 (Sized_relobj::do_initialize_xindex): New function.
4032 (Sized_relobj::do_read_symbols): Adjust section links.
4033 (Sized_relobj::symbol_section_and_value): Add is_ordinary
4034 parameter. Change all callers.
4035 (Sized_relobj::include_section_group): Adjust section links and
4036 symbol section indexes.
4037 (Sized_relobj::do_layout): Adjust section links.
4038 (Sized_relobj::do_count_local_symbols): Adjust section links and
4039 symbol section indexes.
4040 (Sized_relobj::do_finalize_local_symbols): Distinguish between
4041 ordinary and special symbols.
4042 (Sized_relobj::write_local_symbols): Add symtab_xindex and
4043 dynsym_xindex parameters. Change all callers. Adjust section
4044 links. Use SHN_XINDEX when needed.
4045 (Sized_relobj::get_symbol_location_info): Adjust section links.
4046 Don't get fooled by special symbols.
4047 * object.h (class Xindex): Define.
4048 (class Object): Add xindex_ parameter. Declare virtual functoin
4049 do_initialize_xindex.
4050 (Object::adjust_sym_shndx): New function.
4051 (Object::set_xindex): New protected function.
4052 (class Symbol_value): Add is_ordinary_shndx_ field.
4053 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
4054 (Symbol_value::value): Assert ordinary section.
4055 (Symbol_value::initialize_input_to_output_map): Likewise.
4056 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
4058 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
4060 (class Sized_relobj): Update declarations.
4061 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
4062 parameter. Change all callers.
4063 (Sized_relobj::adjust_shndx): New function.
4064 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
4066 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
4067 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
4068 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
4069 (Sized_dynobj::read_dynsym_section): Adjust section links.
4070 (Sized_dynobj::read_dynamic): Likewise.
4071 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
4073 (Sized_dynobj::do_initialize_xindex): New function.
4074 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
4075 do_initialize_xindex.
4076 (Sized_dynobj::adjust_shndx): New function.
4077 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
4078 dynsym_xindex_ fields.
4079 (Layout::finalize): Add a call to set_section_indexes before
4080 creating the symtab sections.
4081 (Layout::set_section_indexes): Don't do anything if the section
4082 already has a section index.
4083 (Layout::create_symtab_sections): Add shnum parameter. Change
4084 caller. Create .symtab_shndx section if needed.
4085 (Layout::create_shdrs): Add shstrtab_section parameter. Change
4087 (Layout::allocated_output_section_count): New function.
4088 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
4090 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
4091 fields. Update declarations.
4092 (Layout::symtab_xindex): New function.
4093 (Layout::dynsym_xindex): New function.
4094 (class Write_symbols_task): Add layout_ field.
4095 (Write_symbols_task::Write_symbols_task): Add layout parameter.
4097 * output.cc (Output_section_headers::Output_section_headers): Add
4098 shstrtab_section parameter. Change all callers.
4099 (Output_section_headers::do_sized_write): Store overflow values
4100 for section count and section string table section index in
4101 section header zero.
4102 (Output_file_header::do_sized_write): Check for overflow of
4103 section count and section string table section index.
4104 (Output_symtab_xindex::do_write): New function.
4105 (Output_symtab_xindex::endian_do_write): New function.
4106 * output.h (class Output_section_headers): Add shstrtab_section_.
4107 Update declarations.
4108 (class Output_symtab_xindex): Define.
4109 (Output_section::has_out_shndx): New function.
4110 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
4112 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
4114 (Sized_symbol::init): Likewise.
4115 (Symbol::output_section): Check for ordinary symbol.
4116 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
4117 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
4119 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
4120 Change all callers. Simplify handling of symbols from sections
4121 not included in the link.
4122 (Symbol_table::add_from_dynobj): Handle ordinary symbol
4124 (Weak_alias_sorter::operator()): Assert that symbols are
4126 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
4128 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
4129 parameters. Change all callers.
4130 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
4131 symbol distinction. Use SHN_XINDEX when needed.
4132 (Symbol_table::write_section_symbol): Add symtab_xindex
4133 parameter. Change all callers.
4134 (Symbol_table::sized_write_section_symbol): Likewise. Use
4135 SHN_XINDEX when needed.
4136 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
4138 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
4139 (Symbol::is_defined): Check is_ordinary.
4140 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
4141 (Symbol::is_absolute, Symbol::is_common): Likewise.
4142 (class Sized_symbol): Update declarations.
4143 (class Symbol_table): Update declarations.
4144 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
4145 parameters. Change all callers.
4146 (Sized_symbol::override): Likewise.
4147 (Symbol_table::override): Likewise.
4148 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
4149 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
4150 is_ordinary, and orig_st_shndx parameters. Change all callers.
4151 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
4152 to be in an ordinary section.
4153 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
4154 object and is_ordinary parameters. Change all callers.
4155 (Sized_dwarf_line_info::read_relocs): Add object parameter.
4156 Change all callers. Don't add undefined or non-ordinary symbols
4158 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
4160 * dwarf_reader.h (class Sized_dwarf_line_info): Update
4162 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
4163 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
4164 (Sized_relobj::relocate_sections): Likewise.
4165 * target-reloc.h (scan_relocs): Adjust section symbol index.
4166 (scan_relocatable_relocs): Likewise.
4167 * i386.cc (Scan::local): Check for ordinary symbols.
4168 * sparc.cc (Scan::local): Likewise.
4169 * x86_64.cc (Scan::local): Likewise.
4170 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
4171 to symbol_section_and_value.
4172 * testsuite/many_sections_test.cc: New file.
4173 * testsuite/Makefile.am (BUILT_SOURCES): Define.
4174 (check_PROGRAMS): Add many_sections_test.
4175 (many_sections_test_SOURCES): Define.
4176 (many_sections_test_DEPENDENCIES): Define.
4177 (many_sections_test_LDFLAGS): Define.
4178 (BUILT_SOURCES): Add many_sections_define.h.
4179 (many_sections_define.h): New target.
4180 (BUILT_SOURCES): Add many_sections_check.h.
4181 (many_sections_check.h): New target.
4182 (check_PROGRAMS): Add many_sections_r_test.
4183 (many_sections_r_test_SOURCES): Define.
4184 (many_sections_r_test_DEPENDENCIES): Define.
4185 (many_sections_r_test_LDFLAGS): Define.
4186 (many_sections_r_test_LDADD): Define.
4187 (many_sections_r_test.o): New target.
4188 * testsuite/Makefile.in: Rebuild.
4190 2008-04-17 Cary Coutant <ccoutant@google.com>
4192 * errors.cc (Errors::info): New function.
4193 (gold_info): New function.
4194 * errors.h (Errors::info): New function.
4195 * gold.h (gold_info): New function.
4196 * object.cc (Input_objects::add_object): Print trace output.
4197 * options.cc (options::parse_set): New function.
4198 (General_options::parse_wrap): Deleted.
4199 (General_options::General_options): Deleted initializer.
4200 * options.h (options::String_set): New typedef.
4201 (options::parse_set): New function.
4202 (DEFINE_set): New macro.
4203 (General_options::wrap): Changed to use DEFINE_set. Changed
4204 callers of any_wrap_symbols and is_wrap_symbol.
4205 (General_options::trace, General_options::trace_symbol):
4207 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
4208 (General_options::wrap_symbols_): Deleted.
4209 * symtab.cc (Symbol_table::add_from_object): Print trace output.
4211 2008-04-17 David S. Miller <davem@davemloft.net>
4213 * options.cc (General_options::parse_V): New function.
4214 * options.h: Add entries for -V and -Qy.
4216 2008-04-17 Ian Lance Taylor <iant@google.com>
4218 * common.cc (Symbol_table::allocate_commons): Remove options
4219 parameter. Change caller.
4220 (Symbol_table::do_allocate_commons): Remove options parameter.
4221 Change caller. Just call do_allocate_commons_list twice.
4222 (Symbol_table::do_allocate_commons_list): New function, broken out
4223 of do_allocate_commons.
4224 * common.h (class Allocate_commons_task): Remove options_ field.
4226 * symtab.cc (Symbol_table::Symbol_table): Initialize
4228 (Symbol_table::add_from_object): Put TLS common symbols on
4230 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
4231 which are IN_OUTPUT_DATA.
4232 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
4233 allocate_commons and do_allocate_commons declarations. Declare
4234 do_allocate_commons_list.
4235 * gold.cc (queue_middle_tasks): Update creation of
4236 Allocate_commons_task to not pass options.
4237 * testsuite/Makefile.am (INCLUDES): Add -I.. .
4238 (TLS_TEST_C_FLAGS): New variable.
4239 (tls_test_c_pic.o): New target.
4240 (tls_test_shared.so): Link in tls_test_c_pic.o.
4241 (tls_test_c_pic_ie.o): New target.
4242 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
4243 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
4244 (tls_test_c.o): New target.
4245 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
4246 (tls_pic_test_LDADD): Likewise.
4247 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
4248 (tls_shared_gd_to_ie_test_LDADD): Likewise.
4249 (tls_test_c_gnu2.o): New target.
4250 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
4252 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
4253 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
4254 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
4255 * testsuite/tls_test.cc: Include "config.h".
4256 (t_last): Call t11_last.
4257 * testsuite/tls_test.h (t11, t11_last): Declare.
4258 * testsuite/tls_test_c.c: New file.
4259 * testsuite/tls_test_main.cc (thread_routine): Call t11.
4260 * configure.ac: Check for OpenMP support.
4261 * configure, config.in, Makefile.in: Rebuild.
4262 * testsuite/Makefile.in: Rebuild.
4264 2008-04-16 Cary Coutant <ccoutant@google.com>
4266 * i386.cc (Target_i386::define_tls_base_symbol): New function.
4267 (Target_i386::tls_base_symbol_defined_): New field.
4268 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4269 (Target_i386::Scan::global): Likewise.
4270 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
4271 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
4272 (Target_x86_64::tls_base_symbol_defined_): New field.
4273 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4274 (Target_x86_64::Scan::global): Likewise.
4276 2008-04-16 Cary Coutant <ccoutant@google.com>
4278 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
4279 (Symbol::needs_plt_entry): Allow weak undefined symbols.
4280 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
4281 building shared libraries.
4282 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
4283 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
4284 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
4285 * testsuite/Makefile.in: Rebuild.
4286 * testsuite/weak_undef.h: New file.
4287 * testsuite/weak_undef_file1.cc: Add extra test cases.
4288 * testsuite/weak_undef_file2.cc: Likewise.
4289 * testsuite/weak_undef_test.cc: Likewise.
4291 2008-04-16 David S. Miller <davem@davemloft.net>
4293 * sparc.cc (Target_sparc::Scan): Change from struct to class.
4294 Add issued_non_pic_error_ field. Declare check_non_pic.
4295 (Target_sparc::Scan::check_non_pic): New function.
4296 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
4297 (Target_sparc::Scan::global): Likewise.
4299 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
4300 * configure: Rebuild.
4302 * options.h (DEFINE_enable): New macro.
4303 (new_dtags): New enable option.
4304 (initfirst, interpose, loadfltr, nodefaultlib,
4305 nodelete, nodlopen, nodump): New -z options.
4306 * layout.cc (Layout:finish_dynamic_section): If new
4307 dtags enabled, emit DT_RUNPATH. Also, emit a
4308 DT_FLAGS_1 containing any specified -z flags.
4310 2008-04-16 Ian Lance Taylor <iant@google.com>
4312 * copy-relocs.cc: New file.
4313 * copy-relocs.h: New file.
4314 * reloc.cc: Remove Copy_relocs code.
4315 * reloc.h: Likewise.
4316 * reloc-types.h (struct Reloc_types) [both versions]: Add
4317 get_reloc_addend_noerror.
4318 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
4319 variants of add_global which take an addend which must be zero.
4320 * i386.cc: Include "copy-relocs.h".
4321 (class Target_i386): Change type of copy_relocs_ to variable,
4323 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
4325 (Target_i386::do_finalize_sections): Change handling of
4327 * sparc.cc: Include "copy-relocs.h".
4328 (class Target_sparc): Change type of copy_relocs_ to variable,
4330 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
4332 (Target_sparc::do_finalize_sections): Change handling of
4334 * x86_64.cc: Include "copy-relocs.h".
4335 (class Target_x86_64): Change type of copy_relocs_ to variable,
4337 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
4338 class. Change all callers.
4339 (Target_x86_64::do_finalize_sections): Change handling of
4341 * Makefile.am (CCFILES): Add copy-relocs.cc.
4342 (HFILES): Add copy-relocs.h.
4344 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
4346 * testsuite/script_test_4.sh: Permit leading zeroes.
4348 2008-04-15 Ian Lance Taylor <iant@google.com>
4350 * script-sections.cc (Script_sections::create_segments): Use
4351 header_size_adjustment even when there is enough room for the
4353 * testsuite/script_test_4.sh: New file.
4354 * testsuite/script_test_4.t: New file.
4355 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
4356 (check_DATA): Add script_test_4.stdout.
4357 (MOSTLYCLEANFILES): Likewise.
4358 (script_test_4): New target.
4359 (script_test_4.stdout): New target.
4360 * testsuite/Makefile.in: Rebuild.
4362 * sparc.cc: Add definitions for Output_data_plt_sparc class
4365 2008-04-14 David S. Miller <davem@davemloft.net>
4367 * sparc.cc: New file.
4368 * Makefile.am (TARGETSOURCES): Add sparc.cc
4369 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
4370 * configure.tgt: Document targ_extra_size and
4371 targ_extra_big_endian. Add entries for sparc-* and
4373 * configure.ac: Handle targ_extra_size and
4374 targ_extra_big_endian.
4375 * Makefile.in: Rebuild.
4376 * configure: Likewise.
4377 * po/POTFILES.in: Likewise.
4378 * po/gold.pot: Likewise.
4380 2008-04-14 Ian Lance Taylor <iant@google.com>
4382 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
4383 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
4384 in the name/type/flags to section mapping. Don't call
4385 allocate_output_section.
4386 (Layout::choose_output_section): Change parameter from adjust_name
4387 to is_input_section. Don't permit input sections after sections
4388 are attached to segments. Don't call allocate_output_section.
4389 (Layout::layout_eh_frame): Call update_flags_for_input_section,
4390 not write_enable_output_section.
4391 (Layout::make_output_section): Don't push to
4392 unattached_section_list_ nor call attach_to_segment. Call
4393 attach_section_to_segment if sections are attached.
4394 (Layout::attach_sections_to_segments): New function.
4395 (Layout::attach_section_to_segment): New function.
4396 (Layout::attach_allocated_section_to_segment): Rename from
4397 attach_to_segment. Remove flags parameter.
4398 (Layout::allocate_output_section): Remove function.
4399 (Layout::write_enable_output_section): Remove function.
4400 * layout.h (class Layout): Update for above changes. Add new
4401 field sections_are_attached_.
4402 * output.h (Output_section::update_flags_for_input_section): New
4404 * output.cc (Output_section::add_input_section): Call
4405 update_flags_for_input_section.
4406 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4408 2008-04-11 Cary Coutant <ccoutant@google.com>
4410 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4411 thought unnecessary.
4412 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4414 2008-04-11 Ian Lance Taylor <iant@google.com>
4416 * output.h (class Output_section_data): Remove inline definition
4418 * output.cc (Output_section_data::set_addralign): New function.
4420 2008-04-11 Cary Coutant <ccoutant@google.com>
4422 Add support for TLS descriptors for i386 and x86_64.
4423 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4424 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4425 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4427 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4428 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4429 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4431 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4432 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4433 Fix problem with initial-exec relocations.
4434 (Target_i386::Relocate::relocate_tls): Likewise.
4435 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4437 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4438 support for section-plus-offset dynamic table entries.
4439 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4440 (Output_data_dynamic::Dynamic_entry): Add support for
4441 section-plus-offset dynamic table entries.
4442 (Output_data_dynamic::Classification): Likewise.
4443 (Output_data_dynamic::classification_): Renamed offset_.
4444 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4445 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4446 (Target_x86_64::make_plt_section): New function.
4447 (Target_x86_64::reserve_tlsdesc_entries): New function.
4448 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4449 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4450 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4451 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4452 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4453 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4454 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4455 add extra PLT entry for TLS descriptors.
4456 (Output_data_plt_x86_64::got_): New field.
4457 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4458 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4460 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4462 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4463 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4464 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4465 R_386_TLS_DESC_CALL relocations.
4466 (Target_x86_64::Scan::global): Likewise.
4467 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4468 for TLS descriptors.
4469 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4470 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4471 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4472 GD-to-IE relaxation.
4473 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4474 and TLS_DESCRIPTORS.
4475 * Makefile.in: Rebuild.
4476 * configure: Rebuild.
4477 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4478 (tls_test_shared2.so): New target.
4479 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4480 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4481 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4482 (tls_shared_gd_to_ie_test_LDADD): New variable.
4483 (tls_shared_gnu2_gd_to_ie_test): New target.
4484 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4486 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4487 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4488 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4489 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4490 (tls_shared_gnu2_test): New target.
4491 (tls_test_gnu2_shared.so): New target.
4492 (tls_shared_gnu2_test_SOURCES): New variable.
4493 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4494 (tls_shared_gnu2_test_LDFLAGS): New variable.
4495 (tls_shared_gnu2_test_LDADD): New variable.
4496 * testsuite/Makefile.in: Rebuild.
4497 * testsuite/Makefile.
4499 2008-04-11 Ian Lance Taylor <iant@google.com>
4501 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4503 * testsuite/Makefile.in: Rebuild.
4505 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4507 * testsuite/script_test_2.cc (main): Adjust test.
4509 2008-04-11 David S. Miller <davem@davemloft.net>
4510 Ian Lance Taylor <iant@google.com>
4512 * options.h (General_options): Add entries for '-Y' and
4514 * options.cc (General_options:finalize): If -Y was used, add those
4515 entries to the library path instead of the default "/lib" and
4518 2008-04-11 David S. Miller <davem@davemloft.net>
4520 * testsuite/justsyms.t: Start at 0x100.
4521 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
4522 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4524 * testsuite/script_test_2.cc: Adjust string and section length
4527 2008-04-09 Ian Lance Taylor <iant@google.com>
4530 * script-sections.cc (Sections_element::allocate_to_segment): Add
4532 (Output_section_definition::allocate_to_segment): Likewise.
4533 (Orphan_output_section::allocate_to_segment): Likewise.
4534 (Script_sections::attach_sections_using_phdrs_clause): Don't
4535 propagate non-PT_LOAD segments to orphan sections.
4536 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4537 readelf rather than objdump.
4538 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4539 .interp section and PT_INTERP segment are the same size.
4540 * testsuite/Makefile.in: Rebuild.
4542 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4543 aliases for symbols defined in the same object.
4544 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
4545 (weak_alias_test_SOURCES): New variable.
4546 (weak_alias_test_DEPENDENCIES): New variable.
4547 (weak_alias_test_LDFLAGS): New variable.
4548 (weak_alias_test_LDADD): New variable.
4549 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
4550 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
4551 (weak_alias_test_3.o): New target.
4552 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
4553 * testsuite/weak_alias_test_main.cc: New file.
4554 * testsuite/weak_alias_test_1.cc: New file.
4555 * testsuite/weak_alias_test_2.cc: New file.
4556 * testsuite/weak_alias_test_3.cc: New file.
4558 2008-04-08 Ian Lance Taylor <iant@google.com>
4560 * options.h (class General_options): Add --noinhibit-exec option.
4561 * main.cc (main): Check --noinhibit-exec.
4563 * options.h (class General_options): Define --wrap as a special
4564 option. Add wrap_symbols_ field.
4565 (General_options::any_wrap_symbols): New function.
4566 (General_options::is_wrap_symbol): New function.
4567 * options.cc (General_options::parse_wrap): New function.
4568 (General_options::General_options): Initialize wrap_symbols_.
4569 * symtab.cc (Symbol_table::wrap_symbol): New function.
4570 (Symbol_table::add_from_object): Handle --wrap.
4571 * symtab.h (class Symbol_table): Declare wrap_symbol.
4572 * target.h (Target::wrap_char): New function.
4573 (Target::Target_info): Add wrap_char field.
4574 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
4575 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4576 * testsuite/testfile.cc (Target_test::test_target_info):
4579 * errors.cc (Errors::undefined_symbol): Mention symbol version if
4582 * layout.h (class Layout): Add added_eh_frame_data_ field.
4583 * layout.cc (Layout::Layout): Initialize new field.
4584 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
4585 output section until we find a section we merged successfully.
4586 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
4587 that the size be non-zero.
4589 * merge.cc (Object_merge_map::get_output_offset): Remove inline
4592 2008-04-08 Craig Silverstein <csilvers@google.com>
4594 * configure.ac: Export new conditional variable HAVE_ZLIB.
4595 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
4597 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
4598 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4600 2008-04-07 Ian Lance Taylor <iant@google.com>
4602 * version.cc (version_string): Set to "1.5".
4604 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
4605 Add issued_non_pic_error_ field. Declare check_non_pic.
4606 (Target_x86_64::Scan::check_non_pic): New function.
4607 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
4608 (Target_x86_64::Scan::global): Likewise.
4610 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
4611 addend parameter. Change caller. Handle merge sections.
4612 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
4613 Address to Addend. Don't add in the result of
4614 local_section_offset, pass down the addend and use the returned
4616 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
4617 Update declarations of local_section_offset and symbol_value.
4618 * testsuite/two_file_test_1.cc (t18): New function.
4619 * testsuite/two_file_test_2.cc (f18): New function.
4620 * testsuite/two_file_test_main.cc (main): Call t18.
4621 * testsuite/two_file_test.h (t18, f18): Declare.
4623 * configure.ac: Don't test for objdump, c++filt, or readelf.
4624 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
4626 (TEST_READELF): New variable.
4627 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
4628 (check_PROGRAMS): Add two_file_strip_test.
4629 (two_file_strip_test): New target.
4630 (check_PROGRAMS): Add two_file_same_shared_strip_test.
4631 (two_file_same_shared_strip_test_SOURCES): New variable.
4632 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
4633 (two_file_same_shared_strip_test_LDFLAGS): New variable.
4634 (two_file_same_shared_strip_test_LDADD): New variable.
4635 (two_file_shared_strip.so): New target.
4636 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
4637 (ver_test_5.syms, ver_test_7.syms): Likewise.
4638 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
4639 (strip_test_3.stdout): Use TEST_OBJDUMP.
4640 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4642 2008-04-04 Cary Coutant <ccoutant@google.com>
4644 * symtab.h (Symbol::is_weak_undefined): New function.
4645 (Symbol::is_strong_undefined): New function.
4646 (Symbol::is_absolute): New function.
4647 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
4648 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
4650 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
4651 (weak_undef_test): New target.
4652 * testsuite/Makefile.in: Rebuild.
4653 * testsuite/weak_undef_file1.cc: New file.
4654 * testsuite/weak_undef_file2.cc: New file.
4655 * testsuite/weak_undef_test.cc: New file.
4657 2008-04-03 Craig Silverstein <csilvers@google.com>
4659 * compressed_output.h (class Output_compressed_section): Use
4661 * compressed_output.cc (zlib_compress): Use unsigned buffers,
4663 (zlib_compressed_suffix): Removed.
4664 (Output_compressed_section::set_final_data_size): Use unsigned
4666 * testsuite/Makefile.am (flagstest_compress_debug_sections):
4667 Fix linker invocation.
4668 (flagstest_o_specialfile_and_compress_debug_sections):
4670 * testsuite/Makefile.in: Regenerated.
4672 2008-04-02 David S. Miller <davem@davemloft.net>
4674 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
4675 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
4677 2008-04-02 Craig Silverstein <csilvers@google.com>
4681 2008-04-02 Ian Lance Taylor <iant@google.com>
4683 * fileread.cc (File_read::find_view): Add byteshift and vshifted
4684 parameters. Update for new key type to views_. Change all
4686 (File_read::read): Adjust for byteshift in returned view.
4687 (File_read::add_view): New function, broken out of
4689 (File_read::make_view): New function, broken out of
4691 (File_read::find_or_make_view): Add offset and aligned
4692 parameters. Rewrite accordingly. Change all callers.
4693 (File_read::get_view): Add offset and aligned parameters. Adjust
4694 for byteshift in return value.
4695 (File_read::get_lasting_view): Likewise.
4696 * fileread.h (class File_read): Update declarations.
4697 (class File_read::View): Add byteshift_ field. Add byteshift to
4698 constructor. Add byteshift method.
4699 * archive.h (Archive::clear_uncached_views): New function.
4700 (Archive::get_view): Add aligned parameter. Change all callers.
4701 * object.h (Object::get_view): Add aligned parameter. Change all
4703 (Object::get_lasting_view): Likewise.
4705 * fileread.cc (File_read::release): Don't call clear_views if
4706 there are multiple objects.
4707 * fileread.h (File_read::clear_uncached_views): New function.
4708 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
4711 2008-03-31 Cary Coutant <ccoutant@google.com>
4713 Add thin archive support.
4714 * archive.cc (Archive::armagt): New const.
4715 (Archive::setup): Remove task parameter and calls to unlock.
4716 (Archive::unlock_nested_archives): New function.
4717 (Archive::read_header): Add nested_off parameter. Change
4719 (Archive::interpret_header): Likewise.
4720 (Archive::include_all_members): Change to handle thin
4722 (Archive::include_member): Likewise.
4723 * archive.h (Archive::Archive): Add new parameters and
4725 (Archive::armagt): New const.
4726 (Archive::setup): Remove task parameter.
4727 (Archive::unlock_nested_archives): New function.
4728 (Archive::read_header): Add nested_off parameter.
4729 (Archive::interpret_header): Likewise.
4730 (Archive::Nested_archive_table): New typedef.
4731 (Archive::is_thin_archive_): New field.
4732 (Archive::nested_archives_): New field.
4733 (Archive::options_): New field.
4734 (Archive::dirpath_): New field.
4735 (Archive::task_): New field.
4736 * readsyms.cc (Read_symbols::do_read_symbols): Add check
4737 for thin archives. Pass additional parameters to
4738 Archive::Archive. Unlock the archive file after calling
4741 2008-03-29 Ian Lance Taylor <iant@google.com>
4743 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
4744 version symbol to be local.
4745 * testsuite/ver_test_4.sh: New file.
4746 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
4747 (check_DATA): Add ver_test_4.syms.
4748 (ver_test_4.syms): New target.
4749 * testsuite/Makefile.in: Rebuild.
4752 (Output_section::Input_section_sort_entry::has_priority): New
4754 (Output_section::Input_section_sort_entry::match_file_name): New
4756 (Output_section::Input_section_sort_entry::match_section_name):
4758 (Output_section::Input_section_sort_entry::match_section_name_prefix):
4760 (Output_section::Input_section_sort_entry::match_section_file):
4762 (Output_section::Input_section_sort_compare::operator()): Rewrite
4763 using new Input_section_sort_entry functions. Sort crtbegin and
4764 crtend first. Sort sections with no priority before sections with
4766 * testsuite/initpri1.c (d3): Check j != 4.
4767 (cd5): New constructor/destructor function.
4768 (main): Check j != 2.
4770 * symtab.cc (Symbol_table::add_from_object): If we don't use the
4771 new symbol when resolving, don't call set_is_default.
4772 * testsuite/ver_test_7.cc: New file.
4773 * testsuite/ver_test_7.sh: New file.
4774 * testsuite/Makefile.am (ver_test_7.so): New target.
4775 (ver_test_7.o): New target.
4776 (check_SCRIPTS): Add ver_test_7.sh.
4777 (check_DATA): Add ver_test_7.syms.
4778 (ver_test_7.syms): New target.
4780 2008-03-28 Ian Lance Taylor <iant@google.com>
4782 * layout.cc (Layout::layout): If we see an input section with a
4783 name that needs sorting, set the must_sort flag for the output
4785 (Layout::make_output_section): If the name of the output section
4786 indicates that it might require sorting, set the may_sort flag.
4787 * output.h (Output_section::may_sort_attached_input_sections): New
4789 (Output_section::set_may_sort_attached_input_sections): New
4791 (Output_section::must_sort_attached_input_sections): New
4793 (Output_section::set_must_sort_attached_input_sections): New
4795 (class Output_section): Declare Input_section_sort_entry. Define
4796 Input_section_sort_compare. Declare
4797 sort_attached_input_sections. Add new fields:
4798 may_sort_attached_input_sections_,
4799 must_sort_attached_input_sections_,
4800 attached_input_sections_are_sorted_.
4801 * output.cc (Output_section::Output_section): Initialize new
4803 (Output_section::add_input_section): Add an entry to
4804 input_sections_ if may_sort or must_sort are true.
4805 (Output_section::set_final_data_size): Call
4806 sort_attached_input_sections if necessary.
4807 (Output_section::Input_section_sort_entry): Define new class.
4808 (Output_section::Input_section_sort_compare::operator()): New
4810 (Output_section::sort_attached_input_sections): New function.
4811 * configure.ac: Check whether the compiler supports constructor
4812 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
4813 * testsuite/initpri1.c: New file.
4814 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
4815 CONSTRUCTOR_PRIORITY.
4816 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
4817 (initpri1_LDFLAGS): New variable.
4818 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4820 2008-03-27 Ian Lance Taylor <iant@google.com>
4822 * common.cc (Sort_commons::operator): Correct sorting algorithm.
4823 * testsuite/common_test_1.c: New file.
4824 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
4825 (common_test_1_SOURCES): New variable.
4826 (common_test_1_DEPENDENCIES): New variable.
4827 (common_test_1_LDFLAGS): New variable.
4829 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
4830 and commons_ correctly when NAME/VERSION does not override
4832 * testsuite/ver_test_6.c: New file.
4833 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
4834 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
4835 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
4837 2008-03-26 Ian Lance Taylor <iant@google.com>
4839 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
4840 of an undefined symbol from a version script.
4841 * testsuite/Makefile.am (ver_test_5.so): New target.
4842 (ver_test_5.o): New target.
4843 (check_SCRIPTS): Add ver_test_5.sh.
4844 (check_DATA): Add ver_test_5.syms.
4845 (ver_test_5.syms): New target.
4846 * testsuite/ver_test_5.cc: New file.
4847 * testsuite/ver_test_5.script: New file.
4848 * testsuite/ver_test_5.sh: New file.
4849 * Makefile.in, testsuite/Makefile.in: Rebuild.
4852 Fix problems building gold with gcc 4.3.0.
4853 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
4854 (gold_error_at_location, gold_warning_at_location): Use it.
4855 * configure.ac: Check whether we can compile and use a template
4856 function with a printf attribute.
4857 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
4858 when jumping over bytes.
4859 * object.cc: Instantiate Object::read_section_data.
4860 * debug.h: Include <cstring>
4861 * dwarf_reader.cc: Include <algorithm>
4862 * main.cc: Include <cstring>.
4863 * options.cc: Include <cstring>.
4864 * output.cc: Include <cstring>.
4865 * script.cc: Include <cstring>.
4866 * script.h: Include <string>.
4867 * symtab.cc: Include <cstring> and <algorithm>.
4868 * target-select.cc: Include <cstring>.
4869 * version.cc: Include <string>.
4870 * testsuite/testmain.cc: Include <cstdlib>.
4871 * configure, config.in: Rebuild.
4873 2008-03-25 Ian Lance Taylor <iant@google.com>
4875 * options.cc: Include "../bfd/bfdver.h".
4876 (options::help): Print bug reporting address.
4878 * version.cc (print_version): Adjust output for current value of
4883 * options.cc (options::help): Print list of supported targets.
4884 * target-select.h: Include <vector>.
4885 (class Target_selector): Make machine_, size_, and is_big_endian_
4886 fields const. Add bfd_name_ and instantiated_target_ fields.
4887 (Target_selector::Target_selector): Add bfd_name parameter.
4888 (Target_selector::recognize): Make non-virtual, call
4890 (Target_selector::recognize_by_name): Make non-virtual, call
4891 do_recognize_by_name.
4892 (Target_selector::supported_names): New function.
4893 (Target_selector::bfd_name): New function.
4894 (Target_selector::do_instantiate_target): New pure virtual
4896 (Target_selector::do_recognize): New virtual function.
4897 (Target_selector::do_recognize_by_name): New virtual function.
4898 (Target_selector::instantiate_target): New private function.
4899 (supported_target_names): Declare.
4900 * target-select.cc (Target_selector::Target_selector): Update for
4901 new parameter and fields.
4902 (select_target_by_name): Check that the name matches before
4903 calling recognize_by_name.
4904 (supported_target_names): New function.
4905 * i386.cc (class Target_selector_i386): Update Target_selector
4906 constructor call. Remove recognize and recognize_by_name. Add
4907 do_instantiate_target.
4908 * x86_64.cc (class Target_selector_x86_64): Likewise.
4909 * testsuite/testfile.cc (class Target_selector_test): Update for
4910 changes to Target_selector.
4912 * README: Rewrite, with some notes on unsupported features.
4914 2008-03-24 Cary Coutant <ccoutant@google.com>
4916 * i386.cc (Target_i386::Got_type): New enum declaration.
4917 (Target_i386::Scan::local): Updated callers of Output_data_got
4919 (Target_i386::Scan::global): Likewise.
4920 (Target_i386::Relocate::relocate): Likewise.
4921 (Target_i386::Relocate::relocate_tls): Likewise.
4922 * object.h (Got_offset_list): New class.
4923 (Sized_relobj::local_has_got_offset): Added got_type parameter.
4924 (Sized_relobj::local_got_offset): Likewise.
4925 (Sized_relobj::set_local_got_offset): Likewise.
4926 (Sized_relobj::local_has_tls_got_offset): Removed.
4927 (Sized_relobj::local_tls_got_offset): Removed.
4928 (Sized_relobj::set_local_tls_got_offset): Removed.
4929 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
4930 * output.cc (Output_data_got::add_global): Added got_type parameter.
4931 (Output_data_got::add_global_with_rel): Likewise.
4932 (Output_data_got::add_global_with_rela): Likewise.
4933 (Output_data_got::add_global_pair_with_rel): New function.
4934 (Output_data_got::add_global_pair_with_rela): New function.
4935 (Output_data_got::add_local): Added got_type parameter.
4936 (Output_data_got::add_local_with_rel): Likewise.
4937 (Output_data_got::add_local_with_rela): Likewise.
4938 (Output_data_got::add_local_pair_with_rel): New function.
4939 (Output_data_got::add_local_pair_with_rela): New function.
4940 (Output_data_got::add_global_tls): Removed.
4941 (Output_data_got::add_global_tls_with_rel): Removed.
4942 (Output_data_got::add_global_tls_with_rela): Removed.
4943 (Output_data_got::add_local_tls): Removed.
4944 (Output_data_got::add_local_tls_with_rel): Removed.
4945 (Output_data_got::add_local_tls_with_rela): Removed.
4946 * output.h (Output_data_got::add_global): Added got_type parameter.
4947 (Output_data_got::add_global_with_rel): Likewise.
4948 (Output_data_got::add_global_with_rela): Likewise.
4949 (Output_data_got::add_global_pair_with_rel): New function.
4950 (Output_data_got::add_global_pair_with_rela): New function.
4951 (Output_data_got::add_local): Added got_type parameter.
4952 (Output_data_got::add_local_with_rel): Likewise.
4953 (Output_data_got::add_local_with_rela): Likewise.
4954 (Output_data_got::add_local_pair_with_rel): New function.
4955 (Output_data_got::add_local_pair_with_rela): New function.
4956 (Output_data_got::add_global_tls): Removed.
4957 (Output_data_got::add_global_tls_with_rel): Removed.
4958 (Output_data_got::add_global_tls_with_rela): Removed.
4959 (Output_data_got::add_local_tls): Removed.
4960 (Output_data_got::add_local_tls_with_rel): Removed.
4961 (Output_data_got::add_local_tls_with_rela): Removed.
4962 * resolve.cc (Symbol::override_base_with_special): Removed
4963 reference to has_got_offset_ field.
4964 * symtab.cc (Symbol::init_fields): Replaced initialization
4965 of got_offset_ with got_offsets_. Removed initialization
4967 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
4968 (Symbol::got_offset): Likewise.
4969 (Symbol::set_got_offset): Likewise.
4970 (Symbol::has_tls_got_offset): Removed.
4971 (Symbol::tls_got_offset): Removed.
4972 (Symbol::set_tls_got_offset): Removed.
4973 (Symbol::got_offset_): Removed.
4974 (Symbol::tls_mod_got_offset_): Removed.
4975 (Symbol::tls_pair_got_offset_): Removed.
4976 (Symbol::got_offsets_): New field.
4977 (Symbol::has_got_offset): Removed.
4978 (Symbol::has_tls_mod_got_offset): Removed.
4979 (Symbol::has_tls_pair_got_offset): Removed.
4980 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
4981 (Target_x86_64::Scan::local): Updated callers of Output_data_got
4983 (Target_x86_64::Scan::global): Likewise.
4984 (Target_x86_64::Relocate::relocate): Likewise.
4985 (Target_x86_64::Relocate::relocate_tls): Likewise.
4987 2008-03-25 Ben Elliston <bje@au.ibm.com>
4989 * yyscript.y: Fix spelling error in comment.
4991 2008-03-24 Ian Lance Taylor <iant@google.com>
4993 * options.h (class General_options): Define build_id option.
4994 * layout.h (class Layout): Declare write_build_id, create_note,
4995 create_build_id. Add build_id_note_ member.
4996 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
4997 "libiberty.h", "md5.h", "sha1.h".
4998 (Layout::Layout): Initialize eh_frame_data_,
4999 eh_frame_hdr_section_, and build_id_note_.
5000 (Layout::finalize): Call create_build_id.
5001 (Layout::create_note): New function, broken out of
5002 Layout::create_gold_note.
5003 (Layout::create_gold_note): Call create_note.
5004 (Layout::create_build_id): New function.
5005 (Layout::write_build_id): New function.
5006 (Close_task_runner::run): Call write_build_id.
5008 * x86_64.cc: Correct license to GPLv3.
5010 2008-03-23 Ian Lance Taylor <iant@google.com>
5012 * options.cc: Include "demangle.h".
5013 (parse_optional_string): New function.
5014 (parse_long_option): Handle takes_optional_argument.
5015 (parse_short_option): Update dash_z initializer. Handle
5016 takes_optional_argument.
5017 (General_options::General_options): Initialize do_demangle_.
5018 (General_options::finalize): Set do_demangle_. Handle demangling
5020 * options.h (parse_optional_string): Declare.
5021 (struct One_option): Add optional_arg field. Update constructor.
5022 Update call constructor calls. Add takes_optional_argument
5024 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
5025 (DEFINE_optional_string): Define.
5026 (General_options::demangle): Change from DEFINE_bool to
5027 DEFINE_optional_string.
5028 (General_options::no_demangle): New function.
5029 (General_options::do_demangle): New function.
5030 (General_options::set_do_demangle): New function.
5031 (General_options::execstack_status_): Move definition to end of
5033 (General_options::static_): Likewise.
5034 (General_options::do_demangle_): New field.
5035 * object.cc (big_endian>::get_symbol_location_info): Call
5036 Options::do_demangle, not Options::demangle.
5037 * symtab.cc (demangle): Likewise.
5039 2008-03-22 Ian Lance Taylor <iant@google.com>
5041 * gold.h: Include <cstddef> and <sys/types.h>
5042 * options.h: Include <cstring>.
5044 2008-03-21 Ian Lance Taylor <iant@google.com>
5046 * Added source code to GNU binutils.