1 2009-11-05 Ian Lance Taylor <iant@google.com>
4 * output.cc (Output_segment::add_output_section): Add missing
7 2009-11-04 Ian Lance Taylor <iant@google.com>
10 * object.h (class Object): Add is_needed and set_is_needed
11 methods. Add is_needed_ field. Make bool fields into bitfields.
12 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
13 defined in a dynamic object and referenced by a regular object,
14 set is_needed for the dynamic object.
15 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
16 if the file is marked with as_needed and it is not needed.
18 2009-11-04 Ian Lance Taylor <iant@google.com>
21 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
22 tags if data is discarded by linker script.
23 * i386.cc (Target_i386::do_finalize_sections): Likewise.
24 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
25 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
26 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
28 2009-11-04 Ian Lance Taylor <iant@google.com>
30 * layout.cc (Layout::get_output_section): Add is_interp and
31 is_dynamic_linker_section parameters. Change all callers.
32 (Layout::choose_output_section): Likewise.
33 (Layout::make_output_section): Likewise.
34 (Layout::add_output_section_data): Add is_dynamic_linker_section
35 parameter. Change all callers.
36 * layout.h (class Layout): Update declarations.
37 * output.h (class Output_section): Add is_interp, set_is_interp,
38 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
39 Add is_interp_, is_dynamic_linker_section_ fields. Change
40 generate_code_fills_at_write_ to a bitfield.
41 * output.cc (Output_section::Output_sections): Initialize new
43 (Output_segment::add_output_section): Add do_sort parameter.
46 2009-11-03 Ian Lance Taylor <iant@google.com>
49 * options.h (class General_options): Add --warn-common.
50 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
51 merging two common symbols.
52 (Symbol_table::should_override): Handle --warn-common when merging
53 a common symbol with a defined symbol. Use report_resolve_problem
54 for multiple definitions.
55 (Symbol_table::report_resolve_problem): New function.
56 * symtab.h (class Symbol_table): Declare report_resolve_problem.
58 2009-11-03 Doug Kwan <dougkwan@google.com>
60 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
62 (Target_arm::stub_factory): New method definition.
63 (Target_arm::new_arm_input_section,
64 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
65 Target_arm::reloc_uses_thumb_bit): New method declarations.
66 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
68 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
70 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
71 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
72 New method definitions.
74 2009-11-03 Ian Lance Taylor <iant@google.com>
76 * options.h (class General_options): Add --warn_constructors.
78 2009-11-03 Ian Lance Taylor <iant@google.com>
81 * defstd.cc (in_section): Add entries for __rel_iplt_start,
82 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
84 2009-11-03 Ian Lance Taylor <iant@google.com>
87 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
89 (install-pdf): New target.
90 (install-data_yes): Look up one directory to find mkinstalldirs.
92 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
94 * po/Make-in (.po.gmo): Don't generate .gmo files in source
97 2009-10-30 Doug Kwan <dougkwan@google.com>
99 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
101 2009-10-30 Doug Kwan <dougkwan@google.com>
103 * arm.cc (Stub_addend_reader): New struct template definition
104 and partial specializations.
105 (Stub_addend_reader::operator()): New method definition for a
106 partially specialized template.
108 2009-10-30 Doug Kwan <dougkwan@google.com>
110 * arm.cc (Arm_relobj::processor_specific_flags): New method
112 (Arm_relobj::do_read_symbols): New method declaration.
113 (Arm_relobj::processor_specific_flags_): New data member declaration.
114 (Arm_dynobj): New class definition.
115 (Target_arm::do_finalize_sections): Add input_objects parameter.
116 (Target_arm::do_adjust_elf_header): New method declaration.
117 (Target_arm::are_eabi_versions_compatible,
118 (Target_arm::merge_processor_specific_flags): New method declaration.
119 (Target_arm::do_make_elf_object): New overloaded method definitions
121 (Arm_relobj::do_read_symbols): New method definition.
122 (Arm_dynobj::do_read_symbols): Ditto.
123 (Target_arm::do_finalize_sections): Add input_objects parameters.
124 Merge processor-specific flags from all input objects.
125 (Target_arm::are_eabi_versions_compatible,
126 Target_arm::merge_processor_specific_flags,
127 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
128 New method definitions.
129 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
130 Input_objects pointer type parameter.
131 * layout.cc (Layout::finalize): Pass input objects to target's.
132 finalize_sections function.
133 * output.cc (Output_file_header::do_sized_write): Set ELF file
134 header's processor-specific flags.
135 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
136 Input_objects pointer type parameter.
137 * sparc.cc (Target_sparc::do_finalize_sections): Same.
138 * target.h (Input_objects): New forward class declaration.
139 (Target::processor_specific_flags,
140 Target::are_processor_specific_flags_sect): New method definitions.
141 (Target::finalize_sections): Add input_objects parameter.
142 (Target::Target): Initialize processor_specific_flags_ and
143 are_processor_specific_flags_set_.
144 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
146 (Target::set_processor_specific_flags): New method definition.
147 (Target::processor_specific_flags_,
148 Target::are_processor_specific_flags_set_): New data member
150 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
151 Input_objects pointer type parameter.
153 2009-10-30 Doug Kwan <dougkwan@google.com>
155 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
157 2009-10-28 Ian Lance Taylor <iant@google.com>
159 * object.h (class Relobj): Drop options parameter from
160 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
161 do_scan_relocs, do_relocate. Change all callers.
162 (class Sized_relobj): Drop options parameters from
163 do_gc_process_relocs, do_scan_relocs, do_relocate,
164 do_relocate_sections, relocate_sections, emit_relocs_scan,
165 emit_relocs_scan_reltype. Change all callers.
166 (struct Relocate_info): Remove options field and all references to
168 * reloc.h (class Read_relocs): Remove options constructor
169 parameter and options_ field. Change all callers.
170 (class Gc_process_relocs, class Scan_relocs): Likewise.
171 (class Relocate_task): Likewise.
172 * target-reloc.h (scan_relocs): Remove options parameter. Change
174 (scan_relocatable_relocs): Likewise.
175 * target.h (class Sized_target): Remove options parameter from
176 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
178 * gc.h (gc_process_relocs): Remove options parameter. Change all
180 * arm.cc: Update functions to remove options parameters.
182 * powerpc.cc: Likewise.
183 * sparc.cc: Likewise.
184 * x86_64.cc: Likewise.
185 * testsuite/testfile.cc: Likewise.
187 2009-10-28 Doug Kwan <dougkwan@google.com>
189 * arm.cc (Arm_relobj): New class definition.
190 (Arm_relobj::scan_sections_for_stubs,
191 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
192 New method definitions.
194 2009-10-28 Cary Coutant <ccoutant@google.com>
196 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
197 (Plugin::cleanup_done_): New member.
198 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
199 (Plugin_manager::cleanup_done_): Remove.
200 (Plugin_manager::add_input_file): Edit error message.
201 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
202 (Plugin_manager::cleanup): Remove use of cleanup_done_.
204 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
206 * fileread.cc: (File_read::View::~View): Use the new
207 data_ownership_ filed.
208 (File_read::~File_read): Dispose the new whole_file_view_.
209 (File_read::open): Mmap the whole file if needed.
210 (File_read::open): Use whole_file_view_ instead of contents_.
211 (File_read::find_view): Use whole_file_view_ if applicable.
212 (File_read::do_read): Use whole_file_view_ instead of contents_.
213 (File_read::make_view): Use whole_file_view_ instead of contents_,
214 update File_read::View::View call.
215 (File_read::find_or_make_view): Update File_read::View::View
217 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
219 (File_read::View::Data_ownership): New enum.
220 (File_read::View::View): Replace bool mapped_ with Data_ownership
222 (File_read::View::mapped_): Remove (replaced by data_ownership_).
223 (File_read::View::data_ownership_): New field.
224 (File_read::contents_): Remove (replaced by whole_file_view_).
225 (File_read::whole_file_view_): New field.
226 * options.h (class General_options): Add --keep-files-mapped.
228 2009-10-27 Cary Coutant <ccoutant@google.com>
230 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
231 * testsuite/Makefile.am (plugin_test_5): New test case.
232 * testsuite/Makefile.in: Regenerate.
234 2009-10-25 Doug Kwan <dougkwan@google.com>
236 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
237 from private to protected to allow access by child class.
238 (Sized_relobj::do_relocate_sections): New method declaration.
239 (Sized_relobj::relocate_sections): Virtualize.
240 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
241 Sized_relobj::relocate_sections. Instantiate template explicitly
242 for different target sizes and endianity.
244 2009-10-24 Doug Kwan <dougkwan@google.com>
246 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
247 (Arm_input_section::as_arm_input_section): New method.
248 (Arm_output_section): New class definition.
249 (Arm_output_section::create_stub_group,
250 Arm_output_section::group_sections): New method definitions.
252 2009-10-22 Doug Kwan <dougkwan@google.com>
254 * arm.cc (Arm_input_section): New class definition.
255 (Arm_input_section::init, Arm_input_section:do_write,
256 Arm_input_section::set_final_data_size,
257 Arm_input_section::do_reset_address_and_file_offset): New method
260 2009-10-21 Doug Kwan <dougkwan@google.com>
262 * arm.cc (Stub_table, Arm_input_section): New forward class
264 (Stub_table): New class defintion.
265 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
266 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
267 New method definition.
269 2009-10-21 Doug Kwan <dougkwan@google.com>
271 * arm.cc: Update copyright comments.
272 (Target_arm): New forward class template declaration.
273 (Arm_address): New type.
274 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
275 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
276 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
278 (Insn_template): Same.
279 (DEF_STUBS): New macro.
280 (Stub_type): New enum type.
281 (Stub_template): New class definition.
284 (Stub_factory): Same.
285 (Target_arm::Target_arm): Initialize may_use_blx_ and
286 should_force_pic_veneer_.
287 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
288 Target_arm::should_force_pic_veneer,
289 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
290 Target_arm::using_thumb_only, Target_arm:;default_target): New
292 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
293 New data member declarations.
294 (Insn_template::size, Insn_template::alignment): New method defintions.
295 (Stub_template::Stub_template): New method definition.
296 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
297 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
298 (Stub_factory::Stub_factory): New method definition.
299 * gold.h (string_hash): New template.
300 * output.h (Input_section_specifier::hash_value): Use
302 (Input_section_specifier::string_hash): Remove.
303 * stringpool.cc (Stringpool_template::string_hash): Use
306 2009-10-20 Doug Kwan <dougkwan@google.com>
308 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
309 symbols of relaxed input sections.
310 * output.h (Output_section::find_relaxed_input_section): Make
313 2009-10-16 Doug Kwan <dougkwan@google.com>
315 * dynobj.cc (Versions::Versions): Initialize version_script_.
316 Only insert base version symbol definition for a shared object
317 if version script defines any version versions.
318 (Versions::define_base_version): New method definition.
319 (Versions::add_def): Check that base version is not needed.
320 (Versions::add_need): Define base version lazily.
321 * dynobj.h (Versions::define_base_version): New method declaration.
322 (Versions::needs_base_version_): New data member declaration.
323 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
324 (check_DATA): Add no_version_test.stdout.
325 (libno_version_test.so, no_version_test.o no_version_test.stdout):
327 * testsuite/Makefile.in: Regenerate.
328 * testsuite/no_version_test.c: New file.
329 * testsuite/no_version_test.sh: Ditto.
331 2009-10-16 Doug Kwan <dougkwan@google.com>
333 * expression.cc (class Segment_start_expression): New class definition.
334 (Segment_start_expression::value): New method definition.
335 (script_exp_function_segment_start): Return a new
336 Segment_start_expression.
337 * gold/script-c.h (script_saw_segment_start_expression): New function
339 * script-sections.cc (Script_sections::Script_sections): Initialize
340 SAW_SEGMENT_START_EXPRESSION_ to false.
341 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
342 and -Tbbs options to specify section addresses if given in
343 command line and no SEGMENT_START expression is seen in a script.
344 * script-sections.h (Script_sections::saw_segment_start_expression,
345 Script_sections::set_saw_segment_start_expression): New method
347 (Script_sections::saw_segment_start_expression_): New data member
349 * script.cc (script_saw_segment_start_expression): New function.
350 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
351 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
352 script_test_7.sh and script_test_8.sh.
353 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
354 script_test_8.stdout.
355 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
356 (script_test_6, script_test_6.stdout, script_test_7,
357 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
358 * Makefile.in: Regenerate.
359 * testsuite/script_test_6.sh: New file.
360 * testsuite/script_test_6.t: Same.
361 * testsuite/script_test_7.sh: Same.
362 * testsuite/script_test_7.t: Same.
363 * testsuite/script_test_8.sh: Same.
365 2009-10-16 Doug Kwan <dougkwan@google.com>
367 * output.cc (Output_segment::set_section_list_address): Cast
368 expressions to unsigned long long type to avoid format warnings.
370 2009-10-15 Ian Lance Taylor <iant@google.com>
372 * script.cc (Script_options::add_symbol_assignment): Always add a
373 dot assignment to script_sections_.
374 * script-sections.cc (Script_sections::add_dot_assignment):
375 Initialize if necessary.
377 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
378 program headers with no load segment if there is a linker script.
380 * layout.cc (Layout::set_segment_offsets): Align the file offset
381 to the segment aligment for -N or -n with no load segment.
382 * output.cc (Output_segment::add_output_section): Don't crash if
383 the first section is a TLS section.
384 (Output_segment::set_section_list_addresses): Print an error
385 message if the address moves backward in a linker script.
387 (Output_section_element_input::set_section_addresses): Don't
388 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
389 (Orphan_output_section::set_section_addresses): Likewise.
391 2009-10-15 Doug Kwan <dougkwan@google.com>
393 * layout.cc (Layout::finish_dynamic_section): Generate tags
394 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
395 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
396 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
398 2009-10-14 Ian Lance Taylor <iant@google.com>
400 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
402 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
403 data_shdr fields of relinfo.
404 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
405 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
406 R_386_TLS_LDO_32, adjust based on section flags.
407 (Target_i386::Relocate::fix_up_ldo): Remove.
409 2009-10-13 Ian Lance Taylor <iant@google.com>
411 Add support for -pie.
412 * options.h (class General_options): Add -pie and
414 (General_options::output_is_position_independent): Test -pie.
415 (General_options::output_is_executable): Return true if not shared
417 (General_options::output_is_pie): Remove.
418 * options.cc (General_options::finalize): Reject incompatible uses
420 * gold.cc (queue_middle_tasks): A -pie link is not static.
421 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
422 * symtab.cc (Symbol::final_value_is_known): Return false if
423 output_is_position_independent.
424 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
425 output_is_position_independent.
426 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
427 output_is_position_independent.
428 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
429 output_is_position_independent.
430 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
432 (basic_pie_test.o, basic_pie_test): New targets.
433 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
434 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
435 (two_file_pie_test): New target.
436 * testsuite/Makefile.in: Rebuild.
437 * README: Remove note saying that -pie is not supported.
439 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
441 * options.h (class General_options): Add -init and -fini.
442 * layout.cc (Layout::finish_dynamic_section): Emit
443 given init and fini functions.
445 2009-10-13 Sriraman Tallam <tmsriram@google.com>
447 * gc.h (gc_process_relocs): Check if icf is enabled using new
449 * gold.cc (queue_initial_tasks): Likewise.
450 (queue_middle_tasks): Likewise.
451 * object.cc (do_layout): Likewise.
452 * symtab.cc (is_section_folded): Likewise.
453 * main.cc (main): Likewise.
454 * reloc.cc (Read_relocs::run): Likewise.
455 (Sized_relobj::do_scan_relocs): Likewise.
456 * icf.cc (is_function_ctor_or_dtor): New function.
457 (Icf::find_identical_sections): Check if function is ctor or dtor when
459 * options.h (General_options::icf): Change option to be an enum.
460 (Icf_status): New enum.
461 (icf_enabled): New method.
462 (icf_safe_folding): New method.
463 (set_icf_status): New method.
464 (icf_status_): New variable.
465 * (options.cc) (General_options::finalize): Set icf_status_.
466 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
467 icf_test and icf_keep_unique_test to use the --icf enum flag.
468 * testsuite/icf_safe_test.sh: New file.
469 * testsuite/icf_safe_test.cc: New file.
471 2009-10-12 Sriraman Tallam <tmsriram@google.com>
473 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
474 includes to gc.h and icf.h.
475 * arm.cc: Include gc.h.
478 * powerpc.cc: Likewise.
479 * sparc.cc: Likewise.
480 * x86_64.cc: Likewise.
481 * gc.h: Include icf.h.
483 2009-10-11 Ian Lance Taylor <iant@google.com>
485 * plugin.cc: Include "gold.h" before other header files.
487 2009-10-10 Chris Demetriou <cgd@google.com>
489 * options.h (Input_file_argument::Input_file_type): New enum.
490 (Input_file_argument::is_lib_): Replace with...
491 (Input_file_argument::type_): New member.
492 (Input_file_argument::Input_file_argument): Take Input_file_type
493 'type' rather than boolean 'is_lib' as second argument.
494 (Input_file_argument::is_lib): Use type_.
495 (Input_file_argument::is_searched_file): New function.
496 (Input_file_argument::may_need_search): Handle is_searched_file.
497 * options.cc (General_options::parse_library): Support -l:filename.
498 (General_options::parse_just_symbols): Update for Input_file_argument
500 (Command_line::process): Likewise.
501 * archive.cc (Archive::get_file_and_offset): Likewise.
502 * plugin.cc (Plugin_manager::release_input_file): Likewise.
503 * script.cc (read_script_file, script_add_file): Likewise.
504 * fileread.cc (Input_file::Input_file): Likewise.
505 (Input_file::will_search_for): Handle is_searched_file.
506 (Input_file::open): Likewise.
507 * readsyms.cc (Read_symbols::get_name): Likewise.
508 * testsuite/Makefile.am (searched_file_test): New test.
509 * testsuite/Makefile.in: Regenerate.
510 * testsuite/searched_file_test.cc: New file.
511 * testsuite/searched_file_test_lib.cc: New file.
513 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
514 Ian Lance Taylor <iant@google.com>
516 * descriptor.cc: Include <cstdio> and "binary-io.h".
517 (Descriptors::open): Open the files in binary mode always.
518 * script.cc (Lex::get_token): Treat \r as whitespace.
520 2009-10-09 Ian Lance Taylor <iant@google.com>
522 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
524 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
525 Ian Lance Taylor <iant@google.com>
527 * configure.ac: Check for readv function also.
528 * fileread.cc (readv): Define if not HAVE_READV.
529 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
531 * config.in: Regenerate.
532 * configure: Regenerate.
534 2009-10-09 Doug Kwan <dougkwan@google.com>
536 * layout.cc (Layout::make_output_section): Call target hook to make
537 ordinary output section.
538 (Layout::finalize): Adjust parameter list of call the
540 * layout.h (class Layout::section_list): New method.
541 * merge.h (Output_merge_base::entsize): Change visibility to public.
542 (Output_merge_base::is_string, Output_merge_base::do_is_string):
544 (Output_merge_string::do_is_string): New method.
545 * object.cc (Sized_relobj::do_setup): renamed from
546 Sized_relobj::set_up.
547 * object.h (Sized_relobj::adjust_shndx,
548 Sized_relobj::initializ_input_to_output_maps,
549 Sized_relobj::free_input_to_output_maps): Change visibilities to
551 (Sized_relobj::setup): Virtualize.
552 (Sized_relobj::do_setup): New method declaration.
553 (Sized_relobj::invalidate_section_offset,
554 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
555 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
556 * options.cc (parse_int): New function.
557 * options.h (parse_int): New declaration.
558 (DEFINE_int): New macro.
559 (stub_group_size): New option.
560 * output.cc (Output_section::Output_section): Initialize memebers
561 merge_section_map_, merge_section_by_properties_map_,
562 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
563 (Output_section::add_input_section): Handled deferred code-fill
564 generation and remove an old comment.
565 (Output_section::add_relaxed_input_section): New method definition.
566 (Output_section::add_merge_input_section): Use merge section by
567 properties map to speed to search. Update merge section maps
569 (Output_section::build_relaxation_map): New method definition.
570 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
572 (Output_section::relax_input_section): Renamed to
573 Output_section::convert_input_sections_to_relaxed_sections and change
574 interface to take a vector of pointers to relaxed sections.
575 (Output_section::find_merge_section,
576 Output_section::find_relaxed_input_section): New method definitions.
577 (Output_section::is_input_address_mapped,
578 Output_section::output_offset, Output_section::output_address):
579 Use output section data maps to speed up searching.
580 (Output_section::find_starting_output_address): Add comments.
581 (Output_section::do_write,
582 Output_section::write_to_postprocessing_buffer): Do code-fill
583 generation as appropriate.
584 (Output_section::get_input_sections): Invalidate relaxed input section
586 (Output_section::restore_states): Adjust type of checkpoint .
587 Invalidate relaxed input section map.
588 * output.h (Output_merge_base): New class declaration.
589 (Input_section_specifier): New class defintion.
590 (class Output_relaxed_input_section) Change base class to
591 Output_section_data_build.
592 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
593 base class initializer.
594 (Output_section::add_relaxed_input_section): New method declaration.
595 (Output_section::Input_section): Change visibility to protected.
596 (Output_section::Input_section::relobj,
597 Output_section::Input_section::shndx): Handle relaxed input sections.
598 Output_section::input_sections) Change visibility to protected. Also
599 define overload to return a non-const pointer.
600 (Output_section::Merge_section_properties): New class defintion.
601 (Output_section::Merge_section_by_properties_map,
602 Output_section::Output_section_data_by_input_section_map,
603 Output_section::Relaxation_map): New types.
604 (Output_section::relax_input_section): Rename method to
605 Output_section::convert_input_sections_to_relaxed_sections and change
606 interface to take a vector of relaxed section pointers.
607 (Output_section::find_merge_section,
608 Output_section::find_relaxed_input_section,
609 Output_section::build_relaxation_map,
610 Output_section::convert_input_sections_in_list_to_relaxed_sections):
611 New method declarations.
612 (Output_section::merge_section_map_
613 Output_section::merge_section_by_properties_map_,
614 Output_section::relaxed_input_section_map_,
615 Output_section::is_relaxed_input_section_map_valid_,
616 Output_section::generate_code_fills_at_write_): New data members.
618 (Output_section_element_input::set_section_addresses): Call
619 current_data_size and addralign methods of relaxed input sections.
620 (Orphan_output_section::set_section_addresses): Call current_data_size
621 and addralign methods of relaxed input sections.
622 * symtab.cc (Symbol_table::compute_final_value): Extract template
623 from the body of Symbol_table::sized_finalize_symbol.
624 (Symbol_table::sized_finalized_symbol): Call
625 Symbol_table::compute_final_value.
626 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
627 (Symbol_table::compute_final_value): New templated method declaration.
628 * target.cc (Target::do_make_output_section): New method defintion.
629 * target.h (Target::make_output_section): New method declaration.
630 (Target::relax): Add more parameters for input objects, symbol table
631 and layout. Adjust call to do_relax.
632 (Target::do_make_output_section): New method declaration.
633 (Target::do_relax): Add parameters for input objects, symbol table
636 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
638 * pread.c: Include stdio.h.
640 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
642 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
645 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
647 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
648 Change read_shndx type to unsigned int.
649 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
651 (Sized_dwarf_line_info::read_line_mappings): Likewise.
652 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
653 Change read_shndx type to unsigned int.
654 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
656 (Sized_dwarf_line_info::read_line_mappings): Likewise.
657 * layout.cc (Layout::create_symtab_sections): Cast the result of
658 local_symcount * symsize to off_t in the gold_assert.
660 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
662 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
663 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
665 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
666 (Arm_relocate_functions::thm_abs5): New function.
667 (Arm_relocate_functions::abs12): New function.
668 (Arm_relocate_functions::abs16): New function.
669 (Arm_relocate_functions::base_abs): New function.
670 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
671 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
672 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
674 (Scan::global): Likewise.
675 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
676 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
677 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
678 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
681 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
683 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
684 (Arm_relocate_functions::movt_prel): New function.
685 (Arm_relocate_functions::thm_movw_prel_nc): New function.
686 (Arm_relocate_functions::thm_movt_prel): New function.
687 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
688 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
689 (Scan::global, Relocate::relocate): Likewise.
690 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
692 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
694 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
696 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
698 (class Incremental_inputs_header): New class.
699 (Incremental_inputs_header_writer): Edit comment.
700 (Incremental_inputs_entry): New class.
701 (Incremental_inputs_entry_writer): Edit comment.
702 (Sized_incremental_binary::do_find_incremental_inputs_section):
703 Add *strtab_shndx parameter, fill it.
704 (Sized_incremental_binary::do_check_inputs): New method.
705 (Incremental_checker::can_incrementally_link_output_file): Use
706 Sized_incremental_binary::check_inputs.
707 (Incremental_inputs::report_command_line): Save command line in
710 (Incremental_binary::find_incremental_inputs_section): New
712 (Incremental_binary::do_find_incremental_inputs_section): Add
713 strtab_shndx parameter.
714 (Incremental_binary::do_check_inputs): New pure virtual method.
715 (Sized_incremental_binary::do_check_inputs): Declare.
716 (Incremental_checker::Incremental_checker): Add incremental_inputs
717 parameter, use it to initialize incremental_inputs_.
718 (Incremental_checker::incremental_inputs_): New field.
719 (Incremental_checker::command_line): New method.
720 (Incremental_checker::inputs): New method.
721 (Incremental_checker::command_line_): New field.
723 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
725 * incremental.cc: Include <cstdarg> and "target-select.h".
726 (vexplain_no_incremental): New function.
727 (explain_no_incremental): New function.
728 (Incremental_binary::error): New method.
729 (Sized_incremental_binary::do_find_incremental_inputs_section): New
731 (make_sized_incremental_binary): New function.
732 (open_incremental_binary): New function.
733 (can_incrementally_link_file): Add checks if output is ELF and has
735 * incremental.h: Include "elfcpp_file.h" and "output.h".
736 (Incremental_binary): New class.
737 (Sized_incremental_binary): New class.
738 (open_incremental_binary): Declare.
739 * object.cc (is_elf_object): Use
740 elfcpp::Elf_recognizer::is_elf_file.
741 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
742 * output.h (Output_file::filesize): New method.
744 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
746 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
748 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
749 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
751 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
753 (Arm_relocate_functions::movw_abs_nc): New function.
754 (Arm_relocate_functions::movt_abs): New function.
755 (Arm_relocate_functions::thm_movw_abs_nc): New function.
756 (Arm_relocate_functions::thm_movt_abs): New function.
757 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
758 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
759 (Scan::global): Likewise.
760 (Relocate::relocate): Likewise.
761 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
763 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
765 * arm.cc (Arm_relocate_functions::got_prel) New function.
766 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
767 (Relocate::relocate): Likewise.
768 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
770 2009-10-06 Ian Lance Taylor <iant@google.com>
772 * options.h (class General_options): Define
773 split_stack_adjust_size parameter.
774 * object.h (class Object): Add uses_split_stack_ and
775 has_no_split_stack_ fields. Add uses_split_stack and
776 has_no_split_stack accessor functions. Declare
777 handle_split_stack_section.
778 (class Reloc_symbol_changes): Define.
779 (class Sized_relobj): Define Function_offsets. Declare
780 split_stack_adjust, split_stack_adjust_reltype, and
782 * object.cc (Object::handle_split_stack_section): New function.
783 (Sized_relobj::do_layout): Call handle_split_stack_section.
784 * dynobj.cc (Sized_dynobj::do_layout): Call
785 handle_split_stack_section.
786 * reloc.cc (Sized_relobj::relocate_sections): Call
787 split_stack_adjust for executable sections in split_stack
788 objects. Pass reloc_map to relocate_section.
789 (Sized_relobj::split_stack_adjust): New function.
790 (Sized_relobj::split_stack_adjust_reltype): New function.
791 (Sized_relobj::find_functions): New function.
792 * target-reloc.h: Include "object.h".
793 (relocate_section): Add reloc_symbol_changes parameter. Change
795 * target.h (class Target): Add calls_non_split method. Declare
796 do_calls_non_split virtual method. Declare match_view and
798 * target.cc: Include "elfcpp.h".
799 (Target::do_calls_non_split): New function.
800 (Target::match_view): New function.
801 (Target::set_view_to_nop): New function.
802 * gold.cc (queue_middle_tasks): Give an error if mixing
803 split-stack and non-split-stack objects with -r.
804 * i386.cc (Target_i386::relocate_section): Add
805 reloc_symbol_changes parameter.
806 (Target_i386::do_calls_non_split): New function.
807 * x86_64.cc (Target_x86_64::relocate_section): Add
808 reloc_symbol_changes parameter.
809 (Target_x86_64::do_calls_non_split): New function.
810 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
812 * powerpc.cc (Target_powerpc::relocate_section): Add
813 reloc_symbol_changes parameter.
814 * sparc.cc (Target_sparc::relocate_section): Add
815 reloc_symbol_changes parameter.
816 * configure.ac: Call AM_CONDITIONAL for the default target.
817 * configure: Rebuild.
818 * testsuite/Makefile.am (TEST_AS): New variable.
819 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
820 (check_DATA): Add split_i386 and split_x86_64 files.
821 (SPLIT_DEFSYMS): Define.
822 (split_i386_[1234n].o): New targets.
823 (split_i386_[124]): New targets.
824 (split_i386_[1234r].stdout): New targets.
825 (split_x86_64_[1234n].o): New targets.
826 (split_x86_64_[124]): New targets.
827 (split_x86_64_[1234r].stdout): New targets.
828 (MOSTLYCLEANFILES): Add new executables.
829 * testsuite/split_i386.sh: New file.
830 * testsuite/split_x86_64.sh: New file.
831 * testsuite/split_i386_1.s: New file.
832 * testsuite/split_i386_2.s: New file.
833 * testsuite/split_i386_3.s: New file.
834 * testsuite/split_i386_4.s: New file.
835 * testsuite/split_i386_n.s: New file.
836 * testsuite/split_x86_64_1.s: New file.
837 * testsuite/split_x86_64_2.s: New file.
838 * testsuite/split_x86_64_3.s: New file.
839 * testsuite/split_x86_64_4.s: New file.
840 * testsuite/split_x86_64_n.s: New file.
841 * testsuite/testfile.cc (Target_test): Update relocation_section
843 * testsuite/Makefile.in: Rebuild.
845 2009-10-06 Ian Lance Taylor <iant@google.com>
847 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
848 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
849 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
850 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
851 the address on ldo_addrs_.
852 (Target_i386::Relocate::fix_up_ldo): New function.
854 2009-10-06 Rafael Espindola <espindola@google.com>
856 * plugin.cc (add_input_library): New.
857 (Plugin::load): Add add_input_library to tv.
858 (Plugin_manager::add_input_file): Add the is_lib argument.
859 (add_input_file): Update call to Plugin_manager::add_input_file.
860 (add_input_library): New.
861 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
863 2009-09-30 Doug Kwan <dougkwan@google.com>
865 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
866 symbol and call Symbol::may_need_copy_reloc to determine if
867 a copy reloc is needed.
868 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
869 nocopyreloc is given in command line.
870 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
871 given in command line.
872 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
873 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
874 of the removed Target_i386::may_need_copy_reloc.
875 * options.h (copyreloc): New option with default value false.
876 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
877 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
878 instead of the removed Target_powerpc::may_need_copy_reloc.
879 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
880 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
881 instead of the removed Target_sparc::may_need_copy_reloc.
882 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
883 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
884 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
885 instead of the removed Target_x86_64::may_need_copy_reloc.
887 2009-09-30 Ian Lance Taylor <iant@google.com>
889 * object.h (class Object): Remove target_ field, and target,
890 sized_target, and set_target methods.
891 (Object::sized_target): Remove.
892 (class Sized_relobj): Update declarations. Remove sized_target.
893 * object.cc (Sized_relobj::setup): Remove target parameter.
895 (Input_objects::add_object): Don't do anything with the target.
896 (make_elf_sized_object): Add punconfigured parameter. Change all
897 callers. Set or test parameter target.
898 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
900 * parameters.cc (Parameters::set_target): Change parameter type to
902 (Parameters::default_target): Remove.
903 (set_parameters_target): Change parameter type to be non-const.
904 (parameters_force_valid_target): New function.
905 (parameters_clear_target): New function.
906 * parameters.h (class Parameters): Update declarations. Remove
907 default_target method. Add sized_target and clear_target
908 methods. Change target_ to be non-const.
909 (set_parameters_target): Update declaration.
910 (parameters_force_valid_target): Declare.
911 (parameters_clear_target): Declare.
912 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
913 as NULL if we aren't searching.
914 (Add_symbols::run): Don't check for compatible target.
915 * fileread.cc (Input_file::open_binary): Call
916 parameters_force_valid_target.
917 * gold.cc (queue_middle_tasks): Likewise.
918 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
919 set_target on object.
920 * dynobj.h (class Sized_dynobj): Update declarations.
921 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
922 make_elf_object returns NULL.
923 (Archive::include_member): Don't check whether object target is
925 * output.cc (Output_section::add_input_section): Get target from
927 (Output_section::relax_input_section): Likewise.
928 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
930 (Sized_relobj::do_scan_relocs): Likewise.
931 (Sized_relobj::relocate_sections): Likewise.
932 * resolve.cc (Symbol_table::resolve): Likewise.
933 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
934 parameter. Change all callers.
935 (Symbol_table::add_from_object): Get target from parameters.
936 (Symbol_table::add_from_relobj): Don't check object target.
937 (Symbol_table::add_from_dynobj): Likewise.
938 (Symbol_table::define_special_symbol): Get target from
940 * symtab.h (class Symbol_table): Update declaration.
941 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
942 parameter. Change all callers. Clear parameter target.
943 (Binary_test): Test target here.
944 * testsuite/object_unittest.cc (gold_testsuite): Remove
945 target_test_pointer parameter. Change all callers.
946 (Object_test): Test target here.
948 2009-09-26 Ian Lance Taylor <iant@google.com>
950 * testsuite/initpri1.c: Don't try to use constructor priorities if
951 compiling with gcc before 4.3.
953 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
955 * testsuite/retain_symbols_file_test.sh (check_present): Change
956 output file name to retain_symbols_file_test.stdout.
957 (check_absent): Likewise.
959 2009-09-18 Craig Silverstein <csilvers@google.com>
961 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
962 * options.cc: Include <cerrno> and <fstream>.
963 (General_options::finalize): Parse -retain-symbols-file tag.
964 * options.h: New flag.
965 (General_options): New method should_retain_symbol, new
966 variable symbols_to_retain.
967 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
968 should_retain_symbol map.
969 * testsuite/Makefile.am (retain_symbols_file_test): New test.
970 * testsuite/Makefile.in: Regenerate.
971 * testsuite/retain_symbols_file_test.sh: New file.
973 2009-09-18 Nick Clifton <nickc@redhat.com>
975 * po/es.po: Updated Spanish translation.
977 2009-09-17 Doug Kwan <dougkwan@google.com>
979 * debug.h (DEBUG_RELAXATION): New constant.
980 (DEBUG_ALL): Add DEBUG_RELAXATION.
981 (debug_string_to_enum): Add relaxation debug option.
983 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
984 Layout::Relaxation_debug_check::read_sections,
985 Layout::Relaxation_debug_check::read_sections): New method definitions.
986 (Layout::Layout): Initialize data members
987 record_output_section_data_from_scrips_,
988 script_output_section_data_list_ and relaxation_debug_check_.
989 (Layout::save_segments, Layout::restore_segments,
990 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
991 Layout::relaxation_loop_body): New method definitions.
992 (Layout::finalize): Support relaxation. Move section layout code to
993 Layout::relaxation_loop_body.
994 (Layout::set_asection_address_from_script): Move code for orphan
995 section placement out.
996 (Layout::place_orphan_sections_in_script): New method definition.
997 * layout.h (Output_segment_headers, Output_file_header):
998 New forward class declarations.
999 (Layout::~Layout): Define.
1000 (Layout::new_output_section_data_from_script): New method definition.
1001 (Layout::place_orphan_sections_in_script): New method declaration.
1002 (Layout::Segment_states): New type declaration.
1003 (Layout::save_segments, Layout::restore_segments,
1004 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1005 Layout::relaxation_loop_body): New method declarations.
1006 (Layout::Output_section_data_list): New type declaration.
1007 (Layout::Relaxation_debug_check): New class definition.
1008 (Layout::record_output_section_data_from_script_,
1009 Layout::script_output_section_data_list_, Layout::segment_states_,
1010 Layout::relaxation_debug_check_): New data members.
1011 * output.cc: (Output_section_headers::do_size): New method definition.
1012 (Output_section_headers::Output_section_headers): Move size
1013 computation to Output_section_headers::do_size.
1014 (Output_segment_headers::do_size): New method definition.
1015 (Output_file_header::Output_file_header): Move size computation to
1016 Output_file_header::do_size and call it.
1017 (Output_file_header::do_size): New method definition.
1018 (Output_data_group::Output_data_group): Adjust call to
1019 Output_section_data.
1020 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
1021 (Output_symtab_xindex::do_write): Add array bound check.
1022 (Output_section::Input_section::print_to_mapfile): Handle
1023 RELAXED_INPUT_SECTION_CODE.
1024 (Output_section::Output_section): Initialize data member checkpoint_.
1025 (Output_section::~Output_section): Delete checkpoint object pointed
1027 (Output_section::add_input_section): Always add an Input_section if
1029 (Output_section::add_merge_input_section): Add assert.
1030 (Output_section::relax_input_section): New method definition.
1031 (Output_section::set_final_data_size): Set load address to zero for
1032 an unallocated section.
1033 (Output_section::do_address_and_file_offset_have_reset_values):
1034 New method definition.
1035 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
1036 Handle relaxed input section.
1037 (Output_section::sort_attached_input_sections): Checkpoint input
1038 section list lazily.
1039 (Output_section::get_input_sections): Change type of input_sections to
1040 list of Simple_input_section pointers. Checkpoint input section list
1041 lazily. Also handle relaxed input sections.
1042 (Output_section::add_input_section_for_script): Take a reference to
1043 a Simple_input_section object instead of Relobj pointer and section
1044 index as parameter. Handle relaxed input sections.
1045 (Output_section::save_states, Output_section::restore_states): New
1047 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
1048 (Output_data::is_data_size_fixed): New method definition.
1049 (Output_data::reset_addresss_and_file_offset): Do not reset data size
1051 (Output_data::address_and_file_offset_have_reset_values): New method
1053 (Output_data::do_address_and_file_offset_have_reset_values): New method
1055 (Output_data::set_data_size): Check that data size is not fixed.
1056 (Output_data::fix_data_size): New method definition.
1057 (Output_data::is_data_size_fixed_): New data member.
1058 (Output_section_headers::set_final_data_size): New method definition.
1059 (Output_section_headers::do_size): New method declaration.
1060 (Output_segment_headers::set_final_data_size): New method definition.
1061 (Output_segment_headers::do_size): New method declaration.
1062 (Output_file_header::set_final_data_size)::New method definition.
1063 (Output_file_header::do_size)::New method declaration.
1064 (Output_section_data::Output_section_data): Add new parameter
1065 is_data_size_fixed and use it to fix data size.
1066 (Output_data_const::Output_data_const): Adjust call to base class
1067 constructor and fix data size.
1068 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
1069 base class constructor and fix data size.
1070 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
1071 base class constructor and fix data size.
1072 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
1073 class constructor and fix data size.
1074 (Output_data_group::set_final_data_size): New method definition.
1075 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
1076 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
1077 class constructor and fix data size.
1078 (Output_relaxed_input_section): New class definition.
1079 (Output_section::Simple_input_section): New class definition.
1080 (Output_section::get_input_sections): Adjust parameter list.
1081 (Output_section::add_input_section_for_script): Same.
1082 (Output_section::save_states, Output_section::restore_states,
1083 Output_section::do_address_and_file_offset_have_reset_values,
1084 (Output_section::Input_section::Input_section): Handle
1085 RELAXED_INPUT_SECTION_CODE. Add new overload for
1086 Output_relaxed_input_section.
1087 (Output_section::Input_section::is_input_section,
1088 Output_section::Input_section::set_output_section): Handle relaxed
1090 (Output_section::Input_section::is_relaxed_input_section,
1091 Output_section::Input_section::output_section_data,
1092 Output_section::Input_section::relaxed_input_section): New method
1094 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
1096 (Output_section::Input_section::u1_): Update comments.
1097 (Output_section::Input_section::u2_): Add new union member poris.
1098 (Output_section::Checkpoint_output_section): New classs definition.
1099 (Output_section::relax_input_section): New method declaration.
1100 (Output_section::checkpoint_): New data member.
1101 (Output_segment): Update comments.
1102 (Output_segment::Output_segment): Un-privatize copy constructor.
1103 (Output_segment::operator=): Un-privatize.
1104 * script-sections.cc (Output_section_element::Input_section_list):
1105 Change element type to Output_section::Simple_input_section.
1106 (Output_section_element_dot_assignment::set_section_addresses):
1107 Register output section data for relaxation clean up.
1108 (Output_data_exression::Output_data_expression): Adjust call to base
1109 constructor to fix data size.
1110 (Output_section_element_data::set_section_addresses): Register
1111 Output_data_expression object for relaxation clean up.
1112 (struct Input_section_info): Replace Relobj pointer and section index
1113 pair with Output_section::Simple_input_section and Convert struct to a
1115 (Input_section_sorter::operator()): Adjust access to
1116 Input_section_info data member to use accessors.
1117 (Output_section_element_input::set_section_addresses): Use layout
1118 parameter. Adjust code to use Output_section::Simple_input_section
1119 and Input_secction_info classes. Register filler for relaxation
1121 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
1122 and section index pair with Output_section::Simple_input_section
1123 class. Adjust code accordingly.
1124 (Phdrs_element::release_segment): New method definition.
1125 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
1127 (Script_sections::release_segments): New method definition.
1128 * gold/script-sections.h (Script_sections::release_segments): New
1130 * gold/target.h (Target::may_relax, Target::relax,
1131 Target::do_may_relax, Target::do_relax): New method definitions.
1133 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1135 * arm.cc (has_signed_unsigned_overflow): New function.
1136 (Arm_relocate_functions::abs8): New function.
1137 (Target_arm::Scan::local): Handle R_ARM_ABS8.
1138 (Target_arm::Scan::global): Likewise.
1139 (Target_arm::relocate::relocate): Likewise.
1140 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1143 2009-09-16 Cary Coutant <ccoutant@google.com>
1145 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
1146 * testsuite/Makefile.in: Regenerate.
1148 2009-09-11 Nick Clifton <nickc@redhat.com>
1150 * po/gold.pot: Updated by the Translation project.
1152 2009-09-08 Cary Coutant <ccoutant@google.com>
1154 * output.cc (Output_file::open): Add execute permission to empty file.
1155 * testsuite/Makefile.am (permission_test): New test.
1156 * testsuite/Makefile.in: Regenerate.
1158 2009-09-02 Ian Lance Taylor <iant@google.com>
1160 * output.cc (Output_file::resize): Call map_no_anonymous rather
1163 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
1165 * gold.cc: Include "incremental.h".
1166 (queue_initial_tasks): Call Incremental_checker methods.
1167 * incremental.cc: Include "output.h".
1168 (Incremental_checker::can_incrementally_link_output_file): New
1170 * incremental.h (Incremental_checker): New class.
1172 * output.cc (Output_file::open_for_modification): New method.
1173 (Output_file::map_anonymous): Changed return type to bool. Record
1175 (Output_file::map_no_anonymous): New method, broken out of map.
1176 (Output_file::map): Use map_no_anonymous and map_anonymous.
1177 * output.h (class Output_file): Update declarations.
1179 2009-08-24 Cary Coutant <ccoutant@google.com>
1181 * options.h (Command_line::Pre_options): New class.
1182 (Command_line::pre_options): New member.
1183 * options.cc (gold::options::ready_to_register): New variable.
1184 (One_option::register_option): Do nothing if not registering options.
1185 Assert if same short option registered twice.
1186 (General_options::General_options): Turn off option registration when
1188 (Command_line::Pre_options::Pre_options): New constructor.
1190 2009-08-24 Cary Coutant <ccoutant@google.com>
1192 * options.h (General_options::no_keep_memory): Remove incorrect
1195 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1197 * Makefile.am (am__skiplex, am__skipyacc): New.
1198 * Makefile.in: Regenerate.
1200 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1202 * Makefile.am (AM_CPPFLAGS): Renamed from ...
1203 (INCLUDES): ... this.
1204 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
1205 (AM_CPPFLAGS): Renamed from ...
1206 (INCLUDE): ... this.
1207 * Makefile.in, testsuite/Makefile.in: Regenerate.
1209 * Makefile.in: Regenerate.
1210 * aclocal.m4: Likewise.
1211 * config.in: Likewise.
1212 * configure: Likewise.
1213 * testsuite/Makefile.in: Likewise.
1215 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1216 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1217 * Makefile.in: Regenerate.
1218 * testsuite/Makefile.in: Regenerate.
1220 2009-08-19 Cary Coutant <ccoutant@google.com>
1222 * resolve.cc (Symbol_table::resolve): Don't complain about defined
1223 symbols in shared libraries overridden by hidden or internal symbols
1224 in the main program.
1226 2009-08-19 Chris Demetriou <cgd@google.com>
1228 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
1229 checking source file names in error messages.
1231 2009-08-18 Doug Kwan <dougkwan@google.com>
1233 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
1234 an elcpp::Ehdr as parameter. Adjust call to set_target.
1235 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
1236 an elfcpp::Ehdr as parameter.
1237 * object.cc (Object::set_target): Remove the version that looks up
1238 a target and sets it.
1239 (Sized_relobj::setup): Take a Target object instead of
1240 an elfcpp::Ehdr as parameter. Adjust call to set_target.
1241 (make_elf_sized_object): Find target and ask target to
1243 * object.h: (Object::set_target): Remove the version that looks up
1244 a target and sets it.
1245 (Sized_relobj::setup): Take a Target object instead of
1246 an elfcpp:Ehdr as parameter.
1247 * target.cc: Include dynobj.h.
1248 (Target::do_make_elf_object_implementation): New.
1249 (Target::do_make_elf_object): New.
1250 * target.h (Target::make_elf_object): New template declaration.
1251 (Target::do_make_elf_object): New method declarations.
1252 (Target::do_make_elf_object_implementation): New template declaration.
1254 2009-08-14 Ian Lance Taylor <iant@google.com>
1256 * gold.h (FUNCTION_NAME): Define.
1257 (gold_unreachable): Use FUNCTION_NAME.
1259 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1261 * icf.cc (Icf::find_identical_sections): Issue a warning when a
1262 symbol in the --keep-unique list is not found.
1264 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1266 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
1267 been maked as --keep-unique.
1268 (Icf::unfold_section): New function.
1269 * icf.h (Icf::unfold_section): New function.
1270 * options.h (General_options::keep_unique): New option.
1271 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
1272 * testsuite/Makefile.in: Regenerate.
1273 * testsuite/icf_keep_unique_test.sh: New file.
1274 * testsuite/icf_keep_unique_test.cc: New file.
1276 2009-08-12 Cary Coutant <ccoutant@google.com>
1279 * resolve.cc (Symbol_table::resolve): Check for references from
1280 dynamic objects to hidden and internal symbols.
1281 * testsuite/Makefile.am (hidden_test.sh): New test.
1282 * testsuite/Makefile.in: Regenerate.
1283 * testsuite/hidden_test.sh: New script.
1284 * testsuite/hidden_test_1.c: New test source.
1285 * testsuite/hidden_test_main.c: New test source.
1287 2009-08-11 Doug Kwan <dougkwan@google.com>
1289 * arm.cc: Update comments.
1290 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
1291 segment to locate the .ARM.exidx section if present.
1293 2009-08-09 Doug Kwan <dougkwan@google.com>
1295 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
1298 2009-08-07 Sriraman Tallam <tmsriram@google.com>
1299 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
1302 2009-08-06 Sriraman Tallam <tmsriram@google.com>
1304 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
1305 valid tls_segment only for non-debug-section relocations.
1306 * testsuite/Makefile.am: Add gc_tls_test.
1307 * testsuite/Makefile.in: Regenerate.
1308 * testsuite/gc_tls_test.cc: New file.
1309 * testsuite/gc_tls_test.sh: New file.
1311 2009-08-05 Sriraman Tallam <tmsriram@google.com>
1315 * Makefile.am (CCFILES): Add icf.cc.
1317 * Makefile.in: Regenerate.
1318 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
1319 * gc.h (gc_process_relocs): Populate lists used by icf to contain
1320 section, symbol and addend information for the relocs.
1321 * gold.cc (queue_middle_tasks): Call identical code folding.
1322 * gold.h: Add defines for multimap.
1323 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
1324 to the call of finalize_local_symbols.
1325 * main.cc (main): Create object of class Icf.
1326 * object.cc (Sized_relobj::do_layout): Allow this function to be
1327 called twice during icf.
1328 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
1329 to sections marked as identical by icf.
1330 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
1332 (Sized_relobj::do_section_entsize): New function.
1333 * object.h (Object::section_entsize): New function.
1334 (Object::do_section_entsize): New pure virtual function.
1335 (Relobj::finalize_local_symbols): Add new parameter.
1336 (Relobj::do_section_entsize): New function.
1337 * options.h (General_options::icf): New option.
1338 (General_options::icf_iterations): New option.
1339 (General_options::print_icf_sections): New option.
1340 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
1341 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
1342 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
1344 * symtab.cc (Symbol_table::is_section_folded): New function.
1345 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
1346 to sections marked as identical by icf.
1347 * symtab.h (Symbol_table::set_icf): New function.
1348 (Symbol_table::icf): New function.
1349 (Symbol_table::is_section_folded): New function.
1350 (Symbol_table::icf_): New data member.
1351 * target-reloc.h (relocate_section): Ignore sections folded by icf.
1352 * testsuite/Makefile.am: Add commands to build icf_test.
1353 * testsuite/Makefile.in: Regenerate.
1354 * testsuite/icf_test.sh: New file.
1355 * testsuite/icf_test.cc: New file.
1357 2009-07-24 Chris Demetriou <cgd@google.com>
1359 * layout.cc (is_compressible_debug_section): Fix incorrect
1360 comment about compressed section names.
1362 2009-07-20 Ian Lance Taylor <ian@airs.com>
1365 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
1367 2009-07-16 Ian Lance Taylor <iant@google.com>
1370 * layout.h: #include <map>.
1371 (class Kept_section): Change from struct to class. Add accessors
1372 and setters. Add section size to Comdat_group mapping. Change
1373 Comdat_group to std::map. Add is_comdat_ field. Add
1374 linkonce_size field in union.
1375 (class Layout): Update declaration of find_or_add_kept_section.
1376 Don't declare find_kept_object.
1377 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1378 parameter. Add object, shndx, is_comdat, and is_group_name
1379 parameters. Change all callers. Adjust for new Kept_section.
1380 (Layout::find_kept_object): Remove.
1381 * object.cc (Sized_relobj::include_section_group): Update use of
1382 Kept_section. Rename secnum to shndx. Only record
1383 Kept_comdat_section if sections are the same size.
1384 (Sized_relobj::include_linkonce_section): Update use of
1385 Kept_section. Only record Kept_comdat_section if sections are the
1386 same size. Set size of linkonce section.
1387 (Sized_relobj::map_to_kept_section): Update call to
1388 get_kept_comdat_section.
1389 * object.h (class Sized_relobj): Rename fields in
1390 Kept_comdat_section to drop trailing underscores; change object
1391 field to Relobj*. Change Kept_comdat_section_table to store
1392 struct rather than pointer.
1393 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1394 Add kept_object and kept_shndx parameters. Change all callers.
1395 (Sized_relobj::get_kept_comdat_section): Change return type to
1396 bool. Add kept_object and kept_shndx parameters. Change all
1398 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1399 Layout::find_or_add_kept_section.
1401 2009-07-09 Ian Lance Taylor <iant@google.com>
1403 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1404 Reserve space in the hash table.
1406 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1408 * fileread.cc (File_read::get_mtime): New method.
1409 * fileread.h (Timespec): New structure.
1410 (File_read::get_mtime): New method.
1411 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1412 Renamed from timestamp_nsec.
1413 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1415 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1417 (Incremental_inputs::report_archive): Save mtime; style fix.
1418 (Incremental_inputs::report_obejct): Save mtime; style fix.
1419 (Incremental_inputs::report_script): Save mtime; style fix.
1420 (Incremental_inputs::finalize_inputs): Style fix.
1421 (Incremental_inputs::finalize): Style fix.
1422 (Incremental_inputs::create_input_section_data): Store inputs
1424 * incremental.h (Incremental_inputs::report_script): Add mtime
1426 (Incremental_inputs::Input_info::Input_info): Intialize only one
1428 (Incremental_inputs::Input_info::archive): Move to nameless
1430 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1431 (Incremental_inputs::Input_info::script): Move to nameless union.
1432 (Incremental_inputs::mtime): New field.
1433 * script.cc (read_input_script): Pass file mtime to
1435 * script.h (Script_info::inputs): Style fix.
1437 2009-07-01 Ian Lance Taylor <ian@airs.com>
1439 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1442 2009-06-24 Ian Lance Taylor <iant@google.com>
1445 * layout.cc (Layout::choose_output_section): If we find an
1446 existing section, update the flags.
1447 (Layout::create_notes): New function, broken out of
1449 (Layout::finalize): Don't create note sections.
1450 (Layout::create_note): Don't crash if linker script discards
1452 (Layout::create_gold_note): Likewise.
1453 (Layout::create_build_id): Likewise. Don't set
1454 after_input_sections on the section.
1455 (Layout::create_executable_stack_info): Remove target parameter.
1457 * layout.h (class Layout): Declare create_notes. Update
1458 declaration of create_executable_stack_info.
1459 * gold.cc (queue_middle_tasks): Call create_notes.
1460 * output.cc (Output_section::update_flags_for_input_section): Move
1461 here from output.h. If SHF_ALLOC flag is newly set, mark address
1463 * output.h (Output_data::mark_address_invalid): New function.
1464 (class Output_section): Only declare, not define,
1465 update_flags_for_input_section. Remove set_flags.
1467 2009-06-24 Ian Lance Taylor <iant@google.com>
1469 * script-sections.cc (Output_section_definition::
1470 set_section_addresses): Rename shadowing local load_address to
1473 2009-06-24 Ian Lance Taylor <iant@google.com>
1476 * reloc.cc (relocate_sections): Skip empty relocation sections.
1478 2009-06-23 Ian Lance Taylor <iant@google.com>
1481 * layout.cc (Layout::create_note): Use choose_output_section
1482 rather than make_output_section.
1484 2009-06-23 Ian Lance Taylor <iant@google.com>
1487 * options.cc (General_options::parse_V): Set printed_version_.
1488 (General_options::General_options): Initialize printed_version_.
1489 * options.h (class General_options): Add printed_version_ field.
1490 * gold.cc (queue_initial_tasks): If there are no input files,
1491 don't give a fatal error if we printed the version information.
1492 (queue_middle_tasks): If using -r with a shared object, give a
1493 fatal error rather than an ordinary error.
1495 2009-06-23 Ian Lance Taylor <iant@google.com>
1498 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1499 (Layout::make_output_section): Set have_stabstr_section_ if we see
1500 a .stab*str section.
1501 (Layout::finalize): Call link_stabs_sections.
1502 (Layout::link_stabs_sections): New file.
1503 * layout.h (class Layout): Add have_stabstr_section_ field.
1504 Declare link_stabs_sections.
1506 2009-06-23 Doug Kwan <dougkwan@google.com>
1508 * Makefile.am (libgold_a_LIBADD): New.
1509 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1510 * Makefile.in: Regenerate.
1511 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1512 * configure: Regenerate.
1513 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1514 * fileread.cc: Include sys/state.h
1515 * gold.h: Declare memmem and strndup if found missing.
1516 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1518 2009-06-23 Ian Lance Taylor <iant@google.com>
1520 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
1521 * configure: Rebuild.
1523 2009-06-23 Ian Lance Taylor <iant@google.com>
1526 * object.cc (Object::section_contents): Don't try to get a view if
1527 the section has length zero.
1528 (Object::handle_gnu_warning_section): If the section is empty, use
1529 the name of the section as the warning.
1531 2009-06-23 Ian Lance Taylor <iant@google.com>
1534 * stringpool.h (class Stringpool_template): Add optimize_ field.
1535 (Stringpool_template::set_optimize): New function.
1536 * stringpool.cc (Stringpool_template::Stringpool_template):
1537 Initialize optimize_ field.
1538 (Stringpool_template::set_string_offsets): Test local optimize
1539 fild rather than parameter.
1540 * layout.cc (Layout::Layout): Call set_optimize on the section
1543 2009-06-22 Ian Lance Taylor <iant@google.com>
1546 * yyscript.y: Parse TARGET.
1547 * script.cc (script_set_target): New function.
1548 * script-c.h (script_set_target): Declare.
1549 * options.cc (General_options::string_to_object_format): Rename
1550 from string_to_object_format in anonymous namespace. Change
1552 * options.h (class General_options): Declare
1553 string_to_object_format.
1555 2009-06-22 Ian Lance Taylor <iant@google.com>
1557 * script-sections.cc (Script_sections::create_segments): Don't put
1558 program headers in a PT_LOAD segment if -n or -N.
1560 2009-06-22 Ian Lance Taylor <iant@google.com>
1563 * options.h (class General_options): Add -z lazy and -z now. Sort
1564 -z options into alphabetical order.
1565 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
1567 2009-06-21 Ian Lance Taylor <iant@google.com>
1569 * layout.cc (Layout::make_output_section): Call
1570 Target::new_output_section.
1571 (Layout::attach_allocated_section_to_segment): Put large section
1572 sections in a separate load segment with the large segment flag
1574 (Layout::segment_precedes): Sort large data segments after other
1576 (align_file_offset): New static function.
1577 (Layout::set_segment_offsets): Use align_file_offset.
1578 * output.h (class Output_section): Add is_small_section_ and
1579 is_large_section_ fields.
1580 (Output_section::is_small_section): New function.
1581 (Output_section::set_is_small_section): New function.
1582 (Output_section::is_large_section): New function.
1583 (Output_section::set_is_large_section): New function.
1584 (Output_section::is_large_data_section): New function.
1585 (class Output_segment): Add is_large_data_segment_ field.
1586 (Output_segment::is_large_data_segment): New function.
1587 (Output_segment::set_is_large_data_segment): New function.
1588 * output.cc (Output_section::Output_section): Initialize new
1590 (Output_segment::Output_segment): Likewise.
1591 (Output_segment::add_output_section): Add assertion that large
1592 data sections always go in large data segments. Force small data
1593 sections to the end of the list of data sections. Force small BSS
1594 sections to the start of the list of BSS sections. For large BSS
1595 sections to the end of the list of BSS sections.
1596 * symtab.h (class Symbol): Declare is_common_shndx.
1597 (Symbol::is_defined): Check Symbol::is_common_shndx.
1598 (Symbol::is_common): Likewise.
1599 (class Symbol_table): Define enum Commons_section_type. Update
1600 declarations. Add small_commons_ and large_commons_ fields.
1601 * symtab.cc (Symbol::is_common_shndx): New function.
1602 (Symbol_table::Symbol_table): Initialize new fields.
1603 (Symbol_table::add_from_object): Put small and large common
1604 symbols in the right list.
1605 (Symbol_table::sized_finalized_symbol): Check
1606 Symbol::is_common_shndx.
1607 (Symbol_table::sized_write_globals): Likewise.
1608 * common.cc (Symbol_table::do_allocate_commons): Allocate new
1609 common symbol lists. Don't call do_allocate_commons_list if the
1611 (Symbol_table::do_allocate_commons_list): Remove is_tls
1612 parameter. Add comons_section_type parameter. Change all
1613 callers. Handle small and large common symbols.
1614 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
1615 Symbol::is_common_shndx.
1616 * resolve.cc (symbol_to_bits): Likewise.
1617 * target.h (Target::small_common_shndx): New function.
1618 (Target::small_common_section_flags): New function.
1619 (Target::large_common_shndx): New function.
1620 (Target::large_common_section_flags): New function.
1621 (Target::new_output_section): New function.
1622 (Target::Target_info): Add small_common_shndx, large_common_shndx,
1623 small_common_section_flags, and large_common_section_flags
1625 (Target::do_new_output_section): New virtual function.
1626 * arm.cc (Target_arm::arm_info): Initialize new fields.
1627 * i386.cc (Target_i386::i386_info): Likewise.
1628 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1630 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
1631 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1632 (Target_x86_64::do_new_output_section): New function.
1633 * configure.ac: Define conditional MCMODEL_MEDIUM.
1634 * testsuite/Makefile.am (check_PROGRAMS): Add large.
1635 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
1636 (large_LDFLAGS): Define.
1637 * testsuite/large.c: New file.
1638 * testsuite/testfile.cc (Target_test::test_target_info):
1639 Initialize new fields.
1640 * configure, testsuite/Makefile.in: Rebuild.
1642 2009-06-05 Doug Kwan <dougkwan@google.com>
1644 * Makefile.am (CCFILES): Add target.cc.
1645 * Makefile.in: Regenerate.
1646 * i386.cc (class Target_i386): Define new virtual method to
1647 override do_is_local_label_name in parent.
1648 * object.cc (Sized_relobj::do_count_local_symbols): Discard
1649 local symbols if --discard-locals or -X is given.
1650 * options.h (class General_options): Declare new options
1651 '--discard-locals' and '-X' for discarding locals.
1652 * target.h (class Target): Define new methods is_local_label_name.
1653 Declare new virtual method do_is_local_label_name.
1654 * target.cc: New file.
1655 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
1656 (check_SCRIPTS): Add discard_locals_test.sh.
1657 (check_DATA): Add discard_local_tests.syms.
1658 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
1659 (discard_local_tests.syms, discard_locals_test.o): New make rules.
1660 * testsuite/Makefile.in: Regenerate.
1661 * testsuite/discard_locals_test.c: New file.
1662 * testsuite/discard_locals_test.sh: Same.
1664 2009-06-05 Doug Kwan <dougkwan@google.com>
1666 * object.cc (Sized_relobj::Sized_relobj): Initialize
1667 discarded_eh_frame_shndx_ to -1U.
1668 (Sized_relobj::do_layout): Record index of a discard .eh_frame
1670 (Sized_relobj::do_count_local_symbols): Skip local symbols in
1671 a discarded .eh_frame section.
1672 (Sized_relobj::do_finalize_local_symbols): Ditto.
1673 * object.h (class Sized_relobj): Declare new member
1674 discarded_eh_frame_shndx_.
1675 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
1676 (local_labels_test.o, local_labels_test): New rules.
1677 * testsuite/Makefile.in: Regenerate.
1679 2009-06-04 Doug Kwan <dougkwan@google.com>
1681 * layout.cc (Layout::section_name_mapping): Add mapping for
1682 special ARM sections.
1684 2009-06-03 Doug Kwan <dougkwan@google.com>
1686 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
1687 (utils::has_overflow): Same.
1689 2009-06-03 Ian Lance Taylor <iant@google.com>
1691 * layout.cc (Layout::section_name_mapping): New array, replacing
1692 Layout::linkonce_mapping.
1693 (Layout::section_name_mapping_count): New variable, replacing
1694 Layout::linkonce_mapping_count.
1695 (Layout::linkonce_output_name): Remove.
1696 (Layout::output_section_name): Rewrite.
1697 * layout.h (class Layout): Rename Linkonce_mapping to
1698 Section_name_mapping, linkonce_mapping to section_name_mapping,
1699 linkonce_mapping_count to section_name_mapping_count. Don't
1700 declare linkonce_output_name.
1702 2009-06-03 Doug Kwan <dougkwan@google.com>
1704 * gold/arm.cc (namespace utils): New.
1705 (Target_arm::reloc_is_non_pic): Define new method.
1706 (class Arm_relocate_functions): New.
1707 (Target_arm::Relocate::relocate): Handle relocation types used by
1710 2009-06-03 Ian Lance Taylor <iant@google.com>
1712 * arm.cc (Target_arm::scan::global): Use || instead of |.
1714 2009-06-02 Doug Kwan <dougkwan@google.com>
1716 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
1717 issued_non_pic_error_.
1718 (class Target_arm::Scan): Declare new method check_non_pic.
1719 Define new method symbol_needs_plt_entry.
1720 Declare new data member issued_non_pic_error_.
1721 (class Target_arm::Relocate): Declare new method
1722 should_apply_static_reloc.
1723 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
1724 (Target_arm::Scan::check_non_pic): Define new method.
1725 (Target_arm::Scan::local): Handle a small subset of reloc types used
1727 (Target_arm::Scan::local): Same.
1728 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
1730 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
1732 * incremental.cc (Incremental_inputs::report_command_line): Filter
1733 out --incremental-* options.
1735 2009-05-29 Doug Kwan <dougkwan@google.com>
1737 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
1739 (class Target_arm): Update comment.
1740 (Target_arm::Target_arm): Initialize new data members GOT_,
1741 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
1742 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
1743 and Target_arm::rel_dyn_section.
1744 Declare new_enum Target_arm::Got_type.
1745 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
1747 Update commments for member do_dynsym_value.
1748 (Target_arm::got_size, Target_arm::plt_section,
1749 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
1750 new methods inside class defintion.
1751 (Target_arm::got_section): Define new method.
1752 (Target_arm::rel_dyn_section): Same.
1753 (Output_data_plt_arm): New template class.
1754 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
1755 (Output_data_plt_arm:do_adjust_output_section): Define new method.
1756 (Output_data_plt_arm::add_entry): Same.
1757 (Output_data_plt_arm::first_plt_entry): Define new
1758 static data member for PLT instruction template.
1759 (Output_data_plt_arm::plt_entry): Same.
1760 (Output_data_plt_arm::do_write): Define new method.
1761 (Target_arm::make_plt_entry): Same.
1762 (Target_arm::do_finalize_sections): Same.
1763 (Target_arm::do_dynsym_value): Same.
1765 2009-05-28 Doug Kwan <dougkwan@google.com>
1767 * Makefile.am (TARGETSOURCES): Add arm.cc.
1768 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
1769 * Makefile.in: Regenerate.
1771 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
1773 2009-05-26 Doug Kwan <dougkwan@google.com>
1775 * options.cc (General_options::parse_exclude_libs). Fix a comment.
1776 (General_options::check_excluded_libs): Strip off directories in
1777 archive name before matching like GNU ld does.
1778 * testsuite/Makefile.am (MOSTLYCLEANFILES,
1779 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
1780 (exclude_libs_test_LDFLAGS): Add linker option
1781 -Wl,--exclude-libs,libexclude_libs_test_3
1782 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
1783 an explicit archive without using -l.
1784 (alt/libexclude_libs_test_3.a): New make rule.
1785 * testsuite/Makefile.in: Regenerate.
1786 * testsuite/exclude_libs_test.c : Declare lib3_default().
1788 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
1789 * exclude_libs_test_3.c: New file.
1791 2009-05-26 Nick Clifton <nickc@redhat.com>
1793 * po/id.po: New Indonesian translation.
1794 * po/gold.pot: Updated template file.
1796 2009-05-22 Sriraman Tallam <tmsriram@google.com>
1798 * testsuite/Makefile.am: Add -ffunction-sections to compile
1799 gc_comdat_test files. Add -Wl,--gc-sections to build
1801 * testsuite/Makefile.in: Regenerate.
1802 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
1804 2009-05-21 Sriraman Tallam <tmsriram@google.com>
1806 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
1807 kept comdat section was garbage collected.
1808 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
1809 * testsuite/Makefile.in: Regenerate.
1810 * testsuite/gc_comdat_test.sh: New file.
1811 * testsuite/gc_comdat_test_1.cc: New file.
1812 * testsuite/gc_comdat_test_2.cc: New file.
1814 2009-05-19 Doug Kwan <dougkwan@google.com>
1816 * archive.cc (Archive::Archive): Move constructor from archive.h
1817 to here. Initialize no_export_.
1818 (Archive::get_elf_object_for_member): Set no_export flag of object.
1819 * archive.h (Archive::Archive): Move constructor body to
1821 (Archive::no_export): New method.
1822 (Archive::no_export_): New field.
1823 * object.h (Object::Object): Initialize no_export_ to false.
1824 (Object::no_export, Object::set_no_export): New methods.
1825 (Object::no_export_): New field.
1826 * options.cc (General_options::parse_exclude_libs): New method.
1827 (General_options::check_excluded_libs) Same.
1828 * options.h (exclude_libs): New option.
1829 (General_options::check_excluded_libs): New method declaration.
1830 (General_options::excluded_libs_): New field.
1831 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
1832 default or protected visibility if an object has no-export flag set.
1833 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
1834 (check_SCRIPTS): Add exclude_libs_test.sh.
1835 (check_DATA): Add exclude_libs_test.syms.
1836 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
1837 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
1838 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
1839 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
1840 (exclude_libs_test.syms, libexclude_libs_test_1.a,
1841 libexclude_libs_test_2.a): New rules.
1842 * testsuite/Makefile.in: Regenerate.
1843 * testsuite/exclude_libs_test.c: New file.
1844 * testsuite/exclude_libs_test.sh: Ditto.
1845 * testsuite/exclude_libs_test_1.c: Ditto.
1846 * testsuite/exclude_libs_test_2.c: Ditto.
1848 2009-05-15 Ian Lance Taylor <iant@google.com>
1850 * configure.ac: Check for declarations for cases where libiberty.h
1851 checks HAVE_DECL_xxx.
1852 * configure, config.in: Rebuild.
1854 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
1856 * gold.h (Incremental_argument_list): Remove (invalid) forward
1858 * incremental.cc (Incremental_inputs::report_achive): New method.
1859 (Incremental_inputs::report_object): New method.
1860 (Incremental_inputs::report_script): New method.
1861 (Incremental_inputs::finalize_inputs): New method.
1862 (Incremental_inputs::finalize): Call finalize_inputs().
1863 (Incremental_inputs::sized_create_incremental_inputs_section_data):
1864 Create inputs entries.
1865 * incremental.h (Incremental_input_type): New enum.
1866 (Incremental_inputs::Incremental_input): Initialize new fields.
1867 (Incremental_inputs::report_inputs): New method.
1868 (Incremental_inputs::report_achive): New method.
1869 (Incremental_inputs::report_object): New method.
1870 (Incremental_inputs::report_script): New method.
1871 (Incremental_inputs::finalize_inputs): New method.
1872 (Incremental_inputs::Input_info): New struct.
1873 (Incremental_inputs::Input_info_map): New typedef.
1874 (Incremental_inputs::lock_): New field.
1875 (Incremental_inputs::Inputs_): New field.
1876 (Incremental_inputs::Inputs_map): New field.
1877 * main.cc (main): Call Incremental_input::report_inputs.
1878 * options.h (Input_argument_list): Typedef moved from
1880 (Input_file_group::Files): Remove, use ::Input_argument_list.
1881 (Input_file_group::Input_argument_list): Remove, use
1882 ::Input_argument_list.
1883 * plugin.cc (Plugin_manager::add_input_file): Add error in
1885 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
1887 * script.cc (read_input_script): Call
1888 Incremental_input::report_script.
1889 * script.h (Script_info): New class.
1891 2009-04-27 Ian Lance Taylor <iant@google.com>
1893 * x86_64.cc (do_adjust_output_section): Set entsize to
1896 2009-04-23 Elliott Hughes <enh@google.com>
1898 * output.cc (Output_file::close): After short writes, continue
1899 writing from the correct offset in the buffer being written.
1901 2009-04-23 Chris Demetriou <cgd@google.com>
1903 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
1904 * configure: Regenerate.
1905 * config.in: Regenerate.
1906 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
1907 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
1909 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
1911 * incremental.cc (Incremental_inputs_header_data): Renamed from
1912 Incremental_input_header_data.
1913 (Incremental_inputs_header_data::data_size): New field.
1914 (Incremental_inputs_header_data::put_input_file_count): Renamed
1915 from input_file_count.
1916 (Incremental_inputs_header_data::put_command_line_offset): Renamed
1917 from command_line_offset.
1918 (Incremental_inputs_header_data::put_reserved): Renamed from
1920 (Incremental_inputs_entry_data): Renamed from
1921 Incremental_input_entry_data.
1922 (Incremental_inputs_entry_data::data_size): New field.
1923 (Incremental_inputs::report_command_line): New method.
1924 (Incremental_inputs::finalize): New method.
1925 (Incremental_inputs::create_incremental_inputs_data): New method.
1926 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
1927 * incremental.h: New file.
1928 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
1929 (Layout::finalize): Create incremental inputs section in
1931 (Layout::create_incremental_info_sections): New method.
1932 * layout.h (Layout::incremental_inputs): New method.
1933 (Layout::create_incremental_info_sections): New method.
1934 (Layout::incremental_inputs_): New field.
1935 * main.cc (main): Notify Incremental_input of the command line.
1937 2009-04-01 Ian Lance Taylor <iant@google.com>
1938 Mikolaj Zalewski <mikolajz@google.com>
1940 * gold.h (reserve_unordered_map): Define, three versions, one for
1941 each version of Unordered_map.
1942 * layout.cc (Layout::Layout): Remove options parameter. Add
1943 number_of_input_files parameter. Don't initialize options_.
1944 Initialize number_of_input_files_ and resized_signatures_. Move
1945 sections_are_attached_.
1946 (Layout::layout_group): Reserve space for group_signatures_.
1947 (Layout::find_or_add_kept_section): Change name parameter to be a
1948 reference. Resize signatures_ map when it gets large enough.
1949 (Layout::layout_eh_frame): Use parameters->options() instead of
1951 (Layout::make_output_section): Likewise.
1952 (Layout::attach_allocated_section_to_segment): Likewise.
1953 (Layout::finalize, Layout::create_executable_stack): Likewise.
1954 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
1955 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
1956 * layout.h (class Layout): Update declarations. Remove options_
1957 field. Add number_of_input_files_ and resized_signatures_
1958 fields. Move sections_are_attached_ field.
1959 * main.cc (main): Pass number of input files to Layout
1960 constructor. Don't pass options.
1962 2009-03-30 Ian Lance Taylor <iant@google.com>
1964 * ffsll.c (ffsll): Correct implementation.
1966 2009-03-27 Ian Lance Taylor <iant@google.com>
1968 * ffsll.c: New file.
1969 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
1970 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
1971 * ftruncate.c (ftruncate): Declare before definition.
1972 * mremap.c (mremap): Likewise.
1973 * pread.c (pread): Likewise.
1974 * configure, Makefile.in, config.in: Rebuild.
1976 * mremap.c: New file.
1977 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
1978 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
1979 (mremap): Declare if HAVE_MREMAP is not defined.
1980 * configure, Makefile.in, config.in: Rebuild.
1982 2009-03-27 Cary Coutant <ccoutant@google.com>
1984 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
1985 position independent.
1986 * sparc.cc (Target_sparc::check_non_pic): Likewise.
1987 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
1989 2009-03-24 Cary Coutant <ccoutant@google.com>
1991 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
1993 (needs_dynamic_reloc): Likewise.
1995 2009-03-24 Ian Lance Taylor <iant@google.com>
1997 * yyscript.y (file_cmd): Recognize EXTERN.
1998 (extern_name_list, extern_name_list_body): New nonterminals.
1999 * script.cc (script_add_extern): Define.
2000 * script-c.h (script_add_extern): Declare.
2002 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
2004 * object.cc (is_elf_object): Define.
2005 * object.h (is_elf_object): Declare.
2006 * archive.cc (Archive::get_elf_object_for_member): Call
2008 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
2010 2009-03-24 Elliott Hughes <enh@google.com>
2012 * output.cc (Output_file::map_anonymous): Define.
2013 (Output_file::map): Use map_anonymous. If the regular mmap fails,
2014 try an anonymous one. Report the size if the mmap fails.
2015 * output.h (class Output_file): Declare map_anonymous.
2017 2009-03-24 Ian Lance Taylor <iant@google.com>
2019 * target-select.cc (instantiate_target): Don't acquire the lock if
2020 the instantiated_target_ field has already been set.
2022 2009-03-23 Ian Lance Taylor <iant@google.com>
2024 * gold-threads.h (class Initialize_lock): Define.
2025 * gold-threads.cc (class Initialize_lock_once): Define.
2026 (initialize_lock_control): New static variable.
2027 (initialize_lock_pointer): New static variable.
2028 (initialize_lock_once): New static function.
2029 (Initialize_lock::Initialize_lock): Define.
2030 (Initialize_lock::initialize): Define.
2031 * target-select.h: Include "gold-threads.h".
2032 (class Target_selector): Add lock_ and initialize_lock_ fields.
2033 Don't define instantiate_target, just declare it.
2034 * target-select.cc (Target_selector::Target_selector): Initialize
2036 (Target_selector::instantiate_target): Define.
2037 * descriptors.h: Include "gold-threads.h".
2038 (class Descriptors): Add initialize_lock_ field.
2039 * descriptors.cc (Descriptors::Descriptors): Initialize new
2041 (Descriptors::open): Use initialize_lock_ field
2042 * errors.h (class Errors): Add initialize_lock_ field.
2043 * errors.cc (Errors::Errors): Initialize new field.
2044 (Errors::initialize_lock): Use initialize_lock_ field.
2045 * powerpc.cc (class Target_selector_powerpc): Remove
2046 instantiated_target_ field. In do_recognize call
2047 instantiate_target rather than do_instantiate_target. In
2048 do_instantiate_target just allocate a new target.
2049 * sparc.cc (class Target_selector_sparc): Likewise.
2051 * freebsd.h: New file.
2052 * i386.cc: Include "freebsd.h".
2053 (Target_i386): Derive from Target_freebsd rather than
2055 (Target_selector_i386): Derive from Target_selector_freebsd rather
2056 than Target_selector.
2057 * x86_64.cc: Include "freebsd.h".
2058 (Target_x86_64): Derive from Target_freebsd rather than
2060 (Target_selector_x86_64): Derive from Target_selector_freebsd
2061 rather than Target_selector.
2062 * target.h (class Target): Add adjust_elf_header and
2063 do_adjust_elf_header.
2064 * output.cc (Output_file_header:: do_sized_write): Call target
2065 adjust_elf_header routine.
2066 * configure.tgt: Set targ_osabi.
2067 * configure.ac: Define GOLD_DEFAULT_OSABI.
2068 * parameters.cc (Parameters::default_target): Pass
2069 GOLD_DEFAULT_OSABI to select_target.
2070 * target-select.h (class Target_selector): Make instantiate_target
2071 protected rather than private.
2072 * Makefile.am (HFILES): Add freebsd.h.
2073 * configure, Makefile.in, config.in: Rebuild.
2075 * merge.cc (do_add_input_section): Correct pend value. Change
2076 message about last entry not being null terminated from error to
2079 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
2081 * incremental.cc: New file.
2082 * Makefile.am (CCFILES): Add incremental.cc.
2083 * Makefile.in: Rebuild.
2085 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
2087 * layout.cc (Layout::output_section_name): Preserve names
2088 of '.note.' sections.
2090 2009-03-19 Ian Lance Taylor <iant@google.com>
2092 * descriptors.cc (Descriptors::open): Check that the options are
2093 valid before using them.
2095 2009-03-18 Ian Lance Taylor <iant@google.com>
2097 * script-sections.h: Include <list>.
2098 (class Script_sections): Change Sections_elements from std::vector
2099 to std::list. Typedef public Elements_iterator. Add
2100 orphan_section_placement_, data_segment_align_start_, and
2101 saw_data_segment_align_ fields. Remove data_segment_align_index_
2103 * script-sections.cc (class Orphan_section_placement): New class.
2104 (class Sections_element): Add virtual functions is_relro and
2105 orphan_section_init. Remove virtual function place_orphan_here.
2106 (class Output_section_definition): Add is_relro and
2107 orphan_section_init. Remove place_orphan_here.
2108 (class Orphan_output_section): Likewise.
2109 (Script_sections::Script_sections): Update for field changes.
2110 (Script_sections::data_segment_align): Set saw_data_segment_align_
2111 and data_segment_align_start_, not data_segment_align_index.
2112 (Script_sections::data_segment_relro_end): Check
2113 saw_data_segment_align_. Use data_segment_align_start_ rather
2114 than data_segment_align_index_.
2115 (Script_sections::place_orphan): Rewrite to use
2116 Orphan_section_placement.
2118 2009-03-17 Ian Lance Taylor <iant@google.com>
2120 * archive.cc (Archive::add_symbols): Check for a version attached
2121 to the symbol name in the archive map.
2122 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
2123 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
2124 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
2125 (ver_test_11.a): New target.
2126 * testsuite/Makefile.in: Rebuild.
2128 * configure.ac: Check for chsize and posix_fallocate. Replace
2130 * ftruncate.c: New file, from gnulib.
2131 * output.cc (posix_fallocate): Define dummy version if not
2132 HAVE_POSIX_FALLOCATE.
2133 (Output_file::map): Call posix_fallocate rather than lseek and
2135 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
2136 * configure, Makefile.in, config.in: Rebuild.
2138 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
2140 * layout.h (Layout::create_note): Add section_name parameter.
2141 * layout.cc (Layout::create_note): Likewise.
2142 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
2144 2009-03-17 Ian Lance Taylor <iant@google.com>
2146 * descriptors.cc: Include "options.h".
2147 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
2148 (Descriptors::open): Always use O_CLOEXEC when opening a new
2149 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
2150 then set FD_CLOEXEC.
2152 * sparc.cc (class Target_sparc): Add has_got_section.
2153 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
2154 make sure we have a GOT section.
2156 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
2157 (Target_sparc::Scan::local): Likewise.
2158 (Target_sparc::Scan::global): Likewise.
2159 (Target_sparc::Relocate::relocate): Likewise.
2160 (Target_sparc::Relocate::relocate_tls): Likewise.
2162 * symtab.cc (Symbol_table::define_default_version): New function,
2163 broken out of add_from_object.
2164 (Symbol_table::add_from_object): Call define_default_version.
2165 (Symbol_table::define_special_symbol): Add resolve_oldsym
2166 parameter. Change all callers. If the version for a symbol comes
2167 from a version script, resolve it with the symbol with the same
2168 name with no version. Also add the symbol without a version if
2170 (do_define_in_output_data): If resolving with oldsym, don't delete
2172 (do_define_in_output_segment): Likewise.
2173 (do_define_as_constant): Likewise.
2174 * symtab.h (class Symbol_table): Update declarations.
2176 2009-03-13 Ian Lance Taylor <iant@google.com>
2178 * readsyms.cc (Read_symbols::incompatible_warning): New function.
2179 (Read_symbols::requeue): New function.
2180 (Read_symbols::do_read_symbols): If make_elf_object fails because
2181 the target type is not configured, and the file was searched for,
2182 issue a warning and retry with the next directory.
2183 (Add_symbols::run): If the file has an incompatible format, and
2184 it was searched for, requeue the Read_symbols task. On error,
2186 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
2187 dirindex parameter to constructor. Change all callers. Declare
2188 incompatible_warning and requeue.
2189 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
2190 input_argument_ and input_group_ fields. Add them to
2191 constructor. Change all callers.
2192 (class Read_script): Add dirindex_ field. Add it to constructor.
2194 * archive.cc (Archive::setup): Remove input_objects parameter.
2196 (Archive::get_file_and_offset): Likewise.
2197 (Archive::read_all_symbols): Likewise.
2198 (Archive::read_symbols): Likewise.
2199 (Archive::get_elf_object_for_member): Remove input_objects
2200 parameter. Add punconfigured parameter. Change all callers.
2201 (Archive::add_symbols): Change return type to bool. Check return
2202 value of include_member.
2203 (Archive::include_all_members): Likewise.
2204 (Archive::include_member): Change return type to bool. Return
2205 false if first included object has incompatible target. Set
2206 included_member_ field.
2207 (Add_archive_symbols::run): If add_symbols returns false, requeue
2209 * archive.h (class Archive): Add included_member_ field.
2210 Initialize it in constructor. Add input_file and searched_for
2211 methods. Update declarations.
2212 (class Add_archive_symbols): Add dirpath_, dirindex_, and
2213 input_argument_ fields. Add them to constructor. Change all
2215 * script.cc: Include "target-select.h".
2216 (class Parser_closure): Add skip_on_incompatible_target_ and
2217 found_incompatible_target_ fields. Add
2218 skip_on_incompatible_target parameter to constructor. Change all
2219 callers. Add methods skip_on_incompatible_target,
2220 clear_skip_on_incompatible_target, found_incompatible_target, and
2221 set_found_incompatible_target.
2222 (read_input_script): Add dirindex parameter. Change all callers.
2223 If parser finds an incompatible target, requeue Read_symbols
2225 (script_set_symbol): Clear skip_on_incompatible_target in
2227 (script_add_assertion, script_parse_option): Likewise.
2228 (script_start_sections, script_add_phdr): Likewise.
2229 (script_check_output_format): New function.
2230 * script.h (read_input_script): Update declaration.
2231 * script-c.h (script_check_output_format): Declare.
2232 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
2233 (ignore_cmd): Remove OUTPUT_FORMAT.
2234 * fileread.cc (Input_file::Input_file): Add explicit this.
2235 (Input_file::will_search_for): New function.
2236 (Input_file::open): Add pindex parameter. Change all callers.
2237 * fileread.h (class Input_file): Add input_file_argument method.
2238 Declare will_search_for. Update declarations.
2239 * object.cc (make_elf_object): Add punconfigured parameter.
2241 * object.h (class Object): Make input_file public. Add
2242 searched_for method.
2243 (make_elf_object): Update declaration.
2244 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
2246 * dirsearch.h (class Dirsearch): Update declaration.
2247 * options.h (class General_options): Add --warn-search-mismatch.
2248 * parameters.cc (Parameters::is_compatible_target): New function.
2249 * parameters.h (class Parameters): Declare is_compatible_target.
2250 * workqueue.cc (Workqueue::add_blocker): New function.
2251 * workqueue.h (class Workqueue): Declare add_blocker.
2253 * fileread.cc (Input_file::open): Remove options parameter.
2255 (Input_file::open_binary): Likewise.
2256 * script.cc (read_input_script): Likewise.
2257 * readsyms.h (class Read_symbols): Remove options_ field. Remove
2258 options parameter from constructor. Change all callers.
2259 (class Read_script): Likewise.
2260 * fileread.h (class Input_file): Update declarations.
2261 * script.h (read_input_script): Update declaration.
2263 2009-03-10 Nick Clifton <nickc@redhat.com>
2265 * po/es.po: New Spanish translation.
2267 2009-03-06 Cary Coutant <ccoutant@google.com>
2269 * options.cc (parse_short_option): Keep dash_z from registering itself.
2271 2009-03-03 Ian Lance Taylor <iant@google.com>
2274 * target-reloc.h (relocate_section): Pass output_section to
2276 * i386.cc (Target_i386::should_apply_static_reloc): Add
2277 output_section parameter. Change all callers.
2278 (Target_i386::Relocate::relocate): Add output_section parameter.
2279 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2280 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2281 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2282 * testsuite/two_file_shared.sh: New script.
2283 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
2284 (check_DATA): Add two_file_shared.dbg.
2285 (two_file_shared.dbg): New target.
2286 * testsuite/Makefile.in: Rebuild.
2288 2009-03-01 Ian Lance Taylor <iant@google.com>
2290 * configure.ac: Check for byteswap.h.
2291 * configure: Rebuild.
2292 * config.in: Rebuild.
2294 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
2296 * layout.cc (Layout::find_or_add_kept_section): New function.
2297 (Layout::add_comdat): Removed.
2298 * layout.h (struct Kept_section): Move out of class Layout.
2299 Remove trailing underscores from field names. Add group_sections
2300 field. Rename group_ field to is_group. Change all uses.
2301 (class Layout): Declare find_or_add_kept_section, not add_comdat.
2302 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
2303 comdat_groups_ field.
2304 (Sized_relobj::include_section_group): Use
2305 find_or_add_kept_section and Kept_section::group_sections.
2306 (Sized_relobj::include_linkonce_section): Likewise.
2307 * object.cc (class Sized_relobj): Don't define Comdat_group or
2308 Comdat_group_table. Remove find_comdat_group and
2309 add_comdat_group. Remove comdat_groups_ field.
2310 * plugin.cc (include_comdat_group): Use
2311 Layout::find_or_add_kept_section.
2313 2009-02-28 Ian Lance Taylor <iant@google.com>
2315 * README: --gc-sections and map files are now supported. Document
2316 some build requirements.
2319 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
2320 relocatable link set the value of the section symbol to zero.
2321 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
2322 relocatable link don't include the section address in the local
2325 2009-02-27 Ian Lance Taylor <iant@google.com>
2328 * options.h (class Search_directory): Add is_system_directory.
2329 (class General_options): Declare is_in_system_directory.
2330 * options.cc (get_relative_sysroot): Make static.
2331 (get_default_sysroot): Make static.
2332 (General_optoins::is_in_system_directory): New function.
2333 * fileread.cc (Input_file::is_in_system_directory): New function.
2334 * fileread.h (class Input_file): Declare is_in_system_directory.
2335 * object.h (class Object): Add is_in_system_directory.
2336 (class Input_objects): Remove system_library_directory_ field.
2337 * object.cc (Input_objects::add_object): Don't set
2338 system_library_directory_.
2339 (input_objects::found_in_system_library_directory): Remove.
2340 * symtab.cc (Symbol_table::write_globals): Remove input_objects
2341 parameter. Change all callers.
2342 (Symbol_table::sized_write_globals): Likewise.
2343 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
2344 Call Object::is_in_system_directory.
2345 * symtab.h (class Symbol_table): Update declarations.
2348 * descriptors.h (Open_descriptor): Add is_on_stack field.
2349 * descriptors.cc (Descriptors::open): If the descriptor is on the
2350 top of the stack, remove it. Initialize is_on_stack field.
2351 (Descriptors::release): Only add pod to stack if it is not on the
2353 (Descriptors::close_some_descriptor): Clear stack_next and
2357 * output.cc (Output_section::find_starting_output_address): Rename
2358 from starting_output_address; add PADDR parameter; change return
2360 * output.h (class Output_section): Declare
2361 find_starting_output_address instead of starting_output_address.
2362 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
2363 section symbol for which we can't find a merge section.
2366 * symtab.cc (Symbol_table::add_from_object): If the visibility is
2367 hidden or internal, force the symbol to be local.
2368 * resolve.cc (Symbol::override_visibility): Define.
2369 (Symbol::override_base): Use override_visibility.
2370 (Symbol_table::resolve): Likewise.
2371 (Symbol::override_base_with_special): Likewise.
2372 (Symbol_table::override_with_special): If the visibility is hidden
2373 or internal, force the symbol to be local.
2374 * symtab.h (class Symbol): Add set_visibility and
2375 override_visibility.
2376 * testsuite/ver_test_1.sh: New file.
2377 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2378 (check_DATA): Add ver_test_1.syms.
2379 (ver_test_1.syms): New target.
2380 * testsuite/Makefile.in: Rebuild.
2382 2009-02-25 Cary Coutant <ccoutant@google.com>
2384 * layout.cc (Layout::choose_output_section): Don't rename sections
2385 when using a linker script that has a SECTIONS clause.
2386 * Makefile.in: Regenerate.
2388 * testsuite/Makefile.am (script_test_5.sh): New test case.
2389 * testsuite/Makefile.in: Regenerate.
2390 * testsuite/script_test_5.cc: New file.
2391 * testsuite/script_test_5.sh: New file.
2392 * testsuite/script_test_5.t: New file.
2394 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
2396 * archive.cc (Archive::include_member): Update calls to add_symbols.
2397 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2398 the Layout argument.
2399 * dynobj.h (do_add_symbols): Add the Layout argument.
2400 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2402 * object.h (Object::add_symbols): Add the Layout argument.
2403 (Object::do_add_symbols): Add the Layout argument.
2404 (Sized_relobj::do_add_symbols): Add the Layout argument.
2405 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2406 Unify the two versions.
2407 (Add_plugin_symbols): Remove.
2408 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2409 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2410 (Add_plugin_symbols): Remove.
2411 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2412 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2413 (Add_symbols::run): Make it work with Pulginobj.
2415 2009-02-06 Ian Lance Taylor <iant@google.com>
2417 * object.cc (Sized_relobj::do_layout): Make info message start
2418 with lower case letter.
2420 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2422 * binary.cc: Fix file comment.
2424 * options.h (enum Incremental_disposition): Define.
2425 (class General_options): Add new options: --incremental,
2426 --incremental_changed, --incremental_unchanged,
2427 --incremental_unknown. Add incremental_disposition_ and
2428 implicit_incremental_ fields.
2429 (General_options::incremental_disposition): New function.
2430 (class Position_dependent_options): Add incremental_disposition
2432 (Position_dependent_options::copy_from_options): Set incremental
2434 * options.cc (General_options::parse_incremental_changed): New
2436 (General_options::parse_incremental_unchanged): New function.
2437 (General_options::parse_incremental_unknown): New function.
2438 (General_options::General_options): Initialize new fields
2439 incremental_disposition_ and implicit_incremental_.
2440 (General_options::finalize): Check for uasge of --incremental-*
2441 without --incremental.
2443 2009-02-06 Chris Demetriou <cgd@google.com>
2445 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2446 pointer and to report location as the file name associated with
2448 (gold_undefined_symbol_at_location): New function to replace the
2449 old gold_undefined_symbol functionality.
2450 * target-reloc.h (relocate_section): Update to use
2451 gold_undefined_symbol_at_location.
2452 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2453 Call gold_undefined_symbol function rather than gold_error.
2454 * errors.h (Errors::undefined_symbol): Take location as a
2455 string, rather than calculating it from a relocation.
2456 * errors.cc (Errors::fatal): Print "fatal error:" before the
2458 (Errors::error, Errors::error_at_location): Print "error: "
2459 before the formatted message.
2460 (Errors::undefined_symbol): Take location as a string, rather
2461 than calculating it from a relocation.
2462 (gold_undefined_symbol_at_location): New function akin to
2463 old gold_undefined_symbol, calculates location from relocation.
2464 (gold_undefined_symbol): Change to take only a Symbol pointer
2465 and to report location as the file name associated with the symbol.
2466 * testsuite/debug_msg.sh: Update for changed error messages.
2467 * testsuite/undef_symbol.sh: Likewise.
2469 2009-02-04 Duncan Sands <baldrick@free.fr>
2472 * reduced_debug_output.h
2473 (Output_reduced_debug_abbrev_section::failed): Use format for
2475 (Output_reduced_debug_info_section::faild): Likewise.
2477 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2479 * script.cc (Lazy_demangler): New class.
2480 (Version_script_info::get_symbol_version_helper): Demangle a
2483 2009-01-29 Cary Coutant <ccoutant@google.com>
2485 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2487 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2489 2009-01-28 Ian Lance Taylor <iant@google.com>
2491 * version.cc (version_string): Bump to 1.9.
2493 * gold.h: Include <cstring> and <stdint.h>.
2494 * version.cc: Include <cstdio>.
2495 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2497 * reduced_debug_output.cc (insert_into_vector): Rename from
2498 Insert_into_vector; change all callers. Use Swap_unaligned to
2499 avoid aliasing issue; remove union since it is unnecessary.
2501 2009-01-27 Sriraman Tallam <tmsriram@google.com>
2503 * Makefile.am (CCFILES): Add gc.cc.
2505 * Makefile.in: Regenerate.
2506 * gold.cc (Gc_runner): New class.
2507 (queue_initial_tasks): Call garbage collection related tasks
2508 when corresponding options are invoked.
2509 (queue_middle_gc_tasks): New function.
2510 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2511 processed early before laying out sections during garbage collection.
2512 * gold.h (queue_middle_gc_tasks): New function.
2513 (is_prefix_of): Move from "layout.cc".
2514 * i386.cc (Target_i386::gc_process_relocs): New function.
2515 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2516 * main.cc (main): Create object of class "Garbage_collection".
2517 * object.cc (Relobj::copy_symbols_data): New function.
2518 (Relobj::is_section_name_included): New function.
2519 (Sized_relobj::do_layout): Allow this function to be called twice
2520 during garbage collection and defer layout of section during the
2522 * object.h (Relobj::get_symbols_data): New function.
2523 (Relobj::is_section_name_included): New function.
2524 (Relobj::copy_symbols_data): New function.
2525 (Relobj::set_symbols_data): New function.
2526 (Relobj::get_relocs_data): New function.
2527 (Relobj::set_relocs_data): New function.
2528 (Relobj::is_output_section_offset_invalid): New pure virtual function.
2529 (Relobj::gc_process_relocs): New function.
2530 (Relobj::do_gc_process_relocs): New pure virtual function.
2531 (Relobj::sd_): New data member.
2532 (Sized_relobj::is_output_section_offset_invalid): New function.
2533 (Sized_relobj::do_gc_process_relocs): New function.
2534 * options.h (General_options::gc_sections): Modify to not be a no-op.
2535 (General_options::print_gc_sections): New option.
2536 * plugin.cc (Plugin_finish::run): Remove function call to
2537 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
2538 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
2539 * reloc.cc (Read_relocs::run): Add task to process relocs and
2540 determine unreferenced sections when doing garbage collection.
2541 (Gc_process_relocs): New class.
2542 (Sized_relobj::do_gc_process_relocs): New function.
2543 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
2544 sections that are garbage collected.
2545 * reloc.h (Gc_process_relocs): New class.
2546 * sparc.cc (Target_sparc::gc_process_relocs): New function.
2547 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
2548 symbols whose corresponding sections are garbage collected.
2549 (Symbol_table::Symbol_table): Add new parameter for the garbage
2551 (Symbol_table::gc_mark_undef_symbols): New function.
2552 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2553 (Symbol_table::gc_mark_dyn_syms): New function.
2554 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
2556 (Symbol_table::add_from_object): Likewise.
2557 (Symbol_table::add_from_relobj): When building shared objects, do not
2558 treat externally visible symbols as garbage.
2559 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
2560 table information for static and relocatable links.
2561 * symtab.h (Symbol_table::set_gc): New function.
2562 (Symbol_table::gc): New function.
2563 (Symbol_table::gc_mark_undef_symbols): New function.
2564 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2565 (Symbol_table::gc_mark_dyn_syms): New function.
2566 (Symbol_table::gc_): New data member.
2567 * target.h (Sized_target::gc_process_relocs): New pure virtual
2569 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
2570 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2572 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
2574 * options.h (General_options::gc_sections): Define as a no-op for now.
2575 (General_options::no_keep_memory): Ditto.
2576 (General_options::Bshareable): Define.
2577 * options.cc (General_options::finalize): Honor -Bshareable.
2579 2009-01-20 Andreas Schwab <schwab@suse.de>
2581 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
2582 read the value in the contents, since we don't use it. Use the
2583 template endianness when writing.
2584 (Relocate::relocate): Use it for R_PPC_REL16_HA.
2586 2009-01-19 Andreas Schwab <schwab@suse.de>
2588 * configure.tgt (powerpc64-*): Fix targ_obj.
2590 2009-01-15 Ian Lance Taylor <iant@google.com>
2592 * object.cc (Sized_relobj::write_local_symbols): Don't write out
2593 local symbols when stripping all symbols.
2595 2009-01-14 Cary Coutant <ccoutant@google.com>
2597 * output.cc (Output_reloc): Add explicit instantiations.
2599 2009-01-14 Cary Coutant <ccoutant@google.com>
2601 * archive.cc (Archive::get_elf_object_for_member): Remove call
2602 to File_read::claim_for_plugin.
2603 * descriptors.cc (Descriptors::open): Remove reference to
2605 (Descriptors::claim_for_plugin): Remove.
2606 * descriptors.h (Descriptors::claim_for_plugin): Remove.
2607 (Descriptors::is_claimed): Remove.
2608 (claim_descriptor_for_plugin): Remove.
2609 * fileread.cc (File_read::claim_for_plugin): Remove.
2610 * fileread.h (File_read::claim_for_plugin): Remove.
2611 (File_read::descriptor): Reopen descriptor if necessary.
2612 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
2613 (Plugin_manager::all_symbols_read): Add task parameter. Change
2615 (Plugin_manager::get_input_file): New function.
2616 (Plugin_manager::release_input_file): New function.
2617 (Pluginobj::Pluginobj): Add filesize parameter and initialize
2618 corresponding data member.
2619 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
2620 and pass to base constructor. Change all callers.
2621 (get_input_file, release_input_file): New functions.
2622 (make_sized_plugin_object): Add filesize parameter. Change all callers.
2623 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
2624 (Plugin_manager::all_symbols_read): Add task parameter.
2625 (Plugin_manager::get_input_file): New function.
2626 (Plugin_manager::release_input_file): New function.
2627 (Plugin_manager::task_): New data member.
2628 (Pluginobj::Pluginobj): Add filesize parameter.
2629 (Pluginobj::filename): New function.
2630 (Pluginobj::descriptor): New function.
2631 (Pluginobj::filesize): New function.
2632 (Pluginobj::filesize_): New data member.
2633 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
2634 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
2635 File_read::claim_for_plugin; use Object::unlock to unlock the file.
2637 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
2638 with archive libraries.
2639 * testsuite/Makefile.in: Regenerate.
2640 * testsuite/plugin_test.c (struct sym_info): New type.
2641 (get_input_file, release_input_file): New static variables.
2642 (onload): Capture new transfer vector entries.
2643 (claim_file_hook): Stop reading at end of file according to filesize.
2644 Factor out parsing of readelf output into separate function.
2645 (all_symbols_read_hook): Exercise get_input_file and release_input_file
2646 APIs and get the source file name from the symbol table. Convert
2647 source file name to corresponding object file name. Print info
2648 message when adding new input files.
2649 (parse_readelf_line): New function.
2650 * testsuite/plugin_test_1.sh: Add checks for new info messages.
2651 * testsuite/plugin_test_2.sh: Likewise.
2652 * testsuite/plugin_test_3.sh: Likewise.
2653 * testsuite/plugin_test_4.sh: New test case.
2655 2009-01-07 Ian Lance Taylor <iant@google.com>
2657 * version.cc (version_string): Bump to 1.8.
2659 2008-12-23 Cary Coutant <ccoutant@google.com>
2661 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
2662 * plugin.cc (Plugin_manager::finish): Rename as
2663 layout_deferred_objects. Move cleanup to separate function.
2664 (Plugin_manager::cleanup): New function.
2665 (Plugin_finish::run): Call layout_deferred_objects and cleanup
2667 * plugin.h (Plugin_manager::finish): Rename as
2668 layout_deferred_objects.
2669 (Plugin_manager::cleanup): New function.
2670 (Plugin_manager::cleanup_done): New field.
2672 2008-12-23 Cary Coutant <ccoutant@google.com>
2674 * plugin.cc (is_visible_from_outside): New function.
2675 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
2676 so we don't return "IR only" status for exported symbols or -r links.
2678 * testsuite/Makefile.am (plugin_test_3): New test case.
2679 * testsuite/Makefile.in: Regenerate.
2680 * testsuite/plugin_test_3.sh: New file.
2682 2008-12-22 Cary Coutant <ccoutant@google.com>
2684 * object.cc (Sized_relobj::layout_section): New function.
2685 (Sized_relobj::do_layout): Defer layout of input sections until after
2686 plugin has provided replacement files.
2687 (Sized_relobj::do_layout_deferred_sections): New function.
2688 * object.h (Relobj::set_section_offset): Remove virtual keyword.
2689 (Relobj::layout_deferred_sections): New function.
2690 (Relobj::do_layout_deferred_sections): New function.
2691 (Sized_relobj::do_layout_deferred_sections): New function.
2692 (Sized_relobj::layout_section): New function.
2693 (Sized_relobj::Deferred_layout): New structure.
2694 (Sized_relobj::deferred_layout_): New field.
2695 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
2696 Change all callers. Layout deferred sections.
2697 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
2699 (Plugin_hook::run): Move code from do_plugin_hook inline.
2700 (Plugin_hook::do_plugin_hook): Remove.
2701 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
2702 (Plugin_manager::finish): Renamed, was cleanup.
2703 (Plugin_manager::should_defer_layout): New function.
2704 (Plugin_manager::add_deferred_layout_object): New function.
2705 (Plugin_manager::Deferred_layout_list): New type.
2706 (Plugin_manager::deferred_layout_objects_): New field.
2707 (Plugin_hook::do_plugin_hook): Remove.
2709 2008-12-17 Ian Lance Taylor <iant@google.com>
2711 * options.h (class General_options): Add --no case for
2714 2008-12-16 Cary Coutant <ccoutant@google.com>
2716 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
2718 (Plugin_manager::claim_file): Create plugin object even if
2719 plugin did not call the add_symbols callback.
2720 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
2721 asking for more symbols than were added.
2722 * testsuite/Makefile.am (plugin_test_1): Add test case with
2724 (empty.syms): New target.
2725 * testsuite/Makefile.in: Regenerate.
2726 * testsuite/plugin_test.c (claim_file_hook): Add new debug
2727 message. Don't call add_symbols if no globals.
2728 (all_symbols_read_hook): Don't provide replacement for empty
2731 2008-12-12 Ian Lance Taylor <iant@google.com>
2733 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
2734 r_type == 0 for a local symbol with r_sym == 0.
2735 (scan_relocatable_relocs): Pass r_sym to
2736 local_non_section_strategy.
2737 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
2740 * configure.ac: Update test for TLS descriptors: they are
2741 supported as of glibc 2.9.
2742 * configure: Rebuild.
2744 2008-12-11 Ian Lance Taylor <iant@google.com>
2747 * target-reloc.h (Default_scan_relocatable_relocs): For each
2748 function, map r_type == 0 to RELOC_DISCARD.
2750 2008-12-10 Cary Coutant <ccoutant@google.com>
2752 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
2753 object to override a kept COMDAT group from a plugin object.
2755 2008-12-09 Ian Lance Taylor <iant@google.com>
2758 * yyscript.y (file_cmd): Handle INPUT.
2760 * testsuite/initpri1.c: Change all declarations to be full
2761 prototypes by adding void, to avoid compiler warnings.
2763 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
2765 * options.cc (General_options::parse_plugin_opt): New.
2766 (General_options::add_plugin): The argument now is just the filename.
2767 (General_options::add_plugin_option): New.
2768 * options.h (plugin_opt): New.
2769 (add_plugin): Change argument name.
2770 (add_plugin_option): New.
2771 * plugin.cc (Plugin::load): Don't parse the plugin option.
2772 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
2773 (Plugin::add_option): New.
2774 (Plugin::args_): Change type.
2775 (Plugin::filename_): New.
2776 (Plugin_manager::add_plugin_option): New.
2777 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
2778 * testsuite/Makefile.in: Regenerate.
2780 2008-12-05 Cary Coutant <ccoutant@google.com>
2782 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
2783 Handle --strip-lto-sections option.
2784 * options.h (strip_lto_sections): New option.
2786 2008-12-01 Cary Coutant <ccoutant@google.com>
2788 * plugin.cc (ld_plugin_message): Change format parameter to const.
2789 Fix mismatch between new[] and delete.
2791 2008-11-14 Cary Coutant <ccoutant@google.com>
2793 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
2796 2008-11-05 Craig Silverstein <csilvers@google.com>
2798 * options.cc (General_options::parse_dynamic_list): New function.
2799 * options.h (General_options): New flags dynamic_list,
2800 dynamic_list_data, dynamic_list_cpp_new, and
2801 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
2802 (General_options::in_dynamic_list): New function.
2803 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
2804 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
2805 (Lex::can_continue_name): Likewise.
2807 (read_script_file): New parameter script_options.
2808 (read_dynamic_list): New function.
2809 (Script_options::define_dynamic_list): New function.
2810 (dynamic_list_keyword_parsecodes): New variable.
2811 (dynamic_list_keywords): New variable.
2812 * script.h (Script_options::define_dynamic_list): New function
2814 (read_dynamic_list): New function prototype.
2815 * symtab.cc (strprefix): New macro.
2816 (Symbol::should_add_dynsym_entry): Support dynamic_list,
2817 dynamic_list_data, dynamic_list_cpp_new, and
2818 dynamic_list_cpp_typeinfo.
2819 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
2820 (dynamic_list_expr): New rule.
2821 (dynamic_list_nodes): Likewise.
2822 (dynamic_list_node): Likewise.
2823 * testsuite/Makefile.am (dynamic_list): New test.
2824 * testsuite/Makefile.in: Regenerated.
2825 * testsuite/dynamic_list.t: New file.
2826 * testsuite/dynamic_list.sh: New file.
2828 2008-11-05 Craig Silverstein <csilvers@google.com>
2830 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
2831 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
2832 (t11_last): Likewise.
2833 * testsuite/ver_test_6.c (main): Likewise.
2835 2008-10-07 Cary Coutant <ccoutant@google.com>
2837 * options.c (General_options::finalize): Add check for -static and
2839 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
2842 2008-10-02 Cary Coutant <ccoutant@google.com>
2844 * plugin.cc (make_sized_plugin_object): Fix conditional
2845 compilation to work when not all targets are enabled.
2847 2008-09-29 Cary Coutant <ccoutant@google.com>
2849 * archive.cc (Archive::get_file_and_offset): Use filename instead
2850 of name to get library path.
2851 (Archive::include_member): Unlock external member of a thin archive.
2853 * testsuite/Makefile.am (TEST_AR): New variable.
2854 (thin_archive_test_1): New test.
2855 (thin_archive_test_2): New test.
2856 * testsuite/Makefile.in: Regenerate.
2857 * testsuite/thin_archive_main.cc: New file.
2858 * testsuite/thin_archive_test_1.cc: New file.
2859 * testsuite/thin_archive_test_2.cc: New file.
2860 * testsuite/thin_archive_test_3.cc: New file.
2861 * testsuite/thin_archive_test_4.cc: New file.
2863 2008-09-29 Cary Coutant <ccoutant@google.com>
2865 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
2866 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
2868 (Sized_relobj::do_finalize_local_symbols): Likewise.
2869 (Sized_relobj::map_to_kept_section): Likewise.
2870 * object.h (Sized_relobj::invalid_address): New constant.
2871 (Sized_relobj::do_output_section_offset): Check for invalid_address
2873 * output.cc (Output_reloc::local_section_offset): Use constant
2874 invalid_address instead of -1U.
2875 (Output_reloc::get_address): Likewise.
2876 (Output_section::output_address): Change -1U to -1ULL.
2877 * output.h (Output_reloc::invalid_address): New constant.
2878 * reloc.cc (Sized_relobj::write_sections): Use constant
2879 invalid_address instead of -1U.
2880 (Sized_relobj::relocate_sections): Likewise.
2881 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
2882 values for merge sections.
2883 * target-reloc.h (relocate_for_relocatable): Use constant
2884 invalid_address instead of -1U.
2886 2008-09-19 Cary Coutant <ccoutant@google.com>
2888 Add plugin functionality for link-time optimization (LTO).
2889 * configure.ac (plugins): Add --enable-plugins option.
2890 * configure: Regenerate.
2891 * config.in: Regenerate.
2892 * Makefile.am (LIBDL): New variable.
2893 (CCFILES): Add plugin.cc.
2894 (HFILES): Add plugin.h.
2895 (ldadd_var): Add LIBDL.
2896 * Makefile.in: Regenerate.
2898 * archive.cc: Include "plugin.h".
2899 (Archive::setup): Don't preread archive symbols when using a plugin.
2900 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
2901 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
2903 (Archive::include_member): Add symbols from plugin objects.
2904 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
2905 * descriptors.cc (Descriptors::open): Check for file descriptors
2906 abandoned by plugins.
2907 (Descriptors::claim_for_plugin): New function.
2908 * descriptors.h (Descriptors::claim_for_plugin): New function.
2909 (Open_descriptor::is_claimed): New field.
2910 (claim_descriptor_for_plugin): New function.
2911 * fileread.cc (File_read::claim_for_plugin): New function.
2912 * fileread.h (File_read::claim_for_plugin): New function.
2913 (File_read::descriptor): New function.
2914 * gold.cc: Include "plugin.h".
2915 (queue_initial_tasks): Add task to call plugin hooks for generating
2917 * main.cc: Include "plugin.h".
2918 (main): Load plugin libraries.
2919 * object.h (Pluginobj): Declare.
2920 (Object::pluginobj): New function.
2921 (Object::do_pluginobj): New function.
2922 (Object::set_target): New function.
2923 * options.cc: Include "plugin.h".
2924 (General_options::parse_plugin): New function.
2925 (General_options::General_options): Initialize plugins_ field.
2926 (General_options::add_plugin): New function.
2927 * options.h (Plugin_manager): Declare.
2928 (General_options): Add --plugin option.
2929 (General_options::has_plugins): New function.
2930 (General_options::plugins): New function.
2931 (General_options::add_plugin): New function.
2932 (General_options::plugins_): New field.
2933 * plugin.cc: New file.
2934 * plugin.h: New file.
2935 * readsyms.cc: Include "plugin.h".
2936 (Read_symbols::do_read_symbols): Check for archive before checking
2937 for ELF file. Call plugin hooks to claim files.
2938 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
2939 from a real object file; force override when processing replacement
2941 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
2942 (Symbol::init_base_object): Likewise.
2943 (Symbol::init_base_output_data): Likewise.
2944 (Symbol::init_base_output_segment): Likewise.
2945 (Symbol::init_base_constant): Likewise.
2946 (Symbol::init_base_undefined): Likewise.
2947 (Symbol::output_section): Assert that object is not a plugin.
2948 (Symbol_table::add_from_pluginobj): New function.
2949 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
2951 (Symbol_table::sized_write_globals): Likewise.
2952 (Symbol_table::add_from_pluginobj): Instantiate template.
2953 * symtab.h (Sized_pluginobj): Declare.
2954 (Symbol::in_real_elf): New function.
2955 (Symbol::set_in_real_elf): New function.
2956 (Symbol::in_real_elf_): New field.
2957 (Symbol_table::add_from_pluginobj): New function.
2959 * testsuite/Makefile.am (AM_CFLAGS): New variable.
2960 (LIBDL): New variable.
2962 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
2963 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
2964 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
2965 (MOSTLYCLEANFILES): Likewise.
2966 * testsuite/Makefile.in: Regenerate.
2967 * testsuite/plugin_test.c: New file.
2968 * testsuite/plugin_test_1.sh: New file.
2969 * testsuite/plugin_test_2.sh: New file.
2971 2008-09-16 Ian Lance Taylor <iant@google.com>
2973 * target-reloc.h (relocate_section): Check whether a symbol is
2974 defined by the ABI before reporting an undefined symbol error.
2975 * target.h (Target::is_defined_by_abi): Make parameter const.
2976 (Target::do_is_defined_by_abi): Likewise.
2977 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
2978 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
2979 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
2980 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
2981 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
2982 * testsuite/Makefile.in: Rebuild.
2984 * fileread.cc (make_view): Add casts to avoid warning.
2986 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2988 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
2989 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2991 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
2993 * options.h (General_options::output_is_executable): New.
2994 (General_options::output_is_pie): New.
2995 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
2996 for shared libraries.
2997 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2999 2008-09-11 Chris Demetriou <cgd@google.com>
3001 * options.h (origin): New -z option.
3002 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
3003 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
3006 2008-09-05 Cary Coutant <ccoutant@google.com>
3008 * fileread.cc (File_read::make_view): Add check for attempt to map
3011 2008-09-05 Cary Coutant <ccoutant@google.com>
3013 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
3014 explicit instantiations.
3016 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
3019 * options.cc (General_options::finalize): Allow undefined symbols
3020 in shlibs if linking -shared.
3023 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
3024 symbols as not needing a dynsym entry.
3026 2008-08-20 Craig Silverstein <csilvers@google.com>
3028 * fileread.cc (File_read::open): Do not lock the file unless it
3029 was successfully opened.
3031 2008-08-14 Cary Coutant <ccoutant@google.com>
3033 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
3034 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
3035 * testsuite/tls_test.cc (struct int128): 128-bit struct
3036 for testing TLS relocs with non-zero addend.
3037 (v12): New TLS variable.
3039 (t_last): Add check for v12.
3040 * testsuite/tls_test.h (t12): New function.
3041 * testsuite/tls_test_main.cc (thread_routine): Call new test.
3043 2008-08-13 Ian Lance Taylor <iant@google.com>
3045 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
3046 set tls_segment_ or relro_segment_.
3047 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
3049 * output.h (Output_section::clear_is_relro): New function.
3050 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
3051 sections specially even when output_data_ is empty.
3052 (Output_segment::maximum_alignment): When first section is relro,
3053 only force alignment for PT_LOAD segments.
3054 * script.cc (script_data_segment_align): New function.
3055 (script_data_segment_relro_end): New function.
3056 * script-c.h (script_data_segment_align): Declare.
3057 (script_data_segment_relro_end): Declare.
3058 * script-sections.h (class Script_sections): Declare
3059 data_segment_align and data_segment_relro_end. Add fields
3060 segment_align_index_ and saw_relro_end_.
3061 * script-sections.cc (class Sections_element): Add set_is_relro
3062 virtual function. Add new bool* parameter to place_orphan_here.
3063 Add get_output_section virtual function.
3064 (class Output_section_definition): Add set_is_relro. Add new
3065 bool* parameter to place_orphan_here. Add get_output_section.
3066 Add is_relro_ field.
3067 (Output_section_definition::Output_section_definition): Initialize
3068 evaluated_address_, evaluated_load_address, evaluated_addralign_,
3069 and is_relro_ fields.
3070 (Output_section_definition::place_orphan_here): Add is_relro
3072 (Output_section_definition::set_section_addresses): Set relro for
3074 (Output_section_definition::alternate_constraint): Likewise.
3075 (class Orphan_output_section): Add new bool* parameter to
3076 place_orphan_here. Add get_output_section.
3077 (Orphan_output_section::place_orphan_here): Add is_relro
3079 (Script_sections::Script_sections): Initialize
3080 data_segment_align_index_ and saw_relro_end_.
3081 (Script_sections::data_segment_align): New function.
3082 (Script_sections::data_segment_relro_end): New function.
3083 (Script_sections::place_orphan): Set or clear is_relro.
3084 (Script_sections::set_section_addresses): Force alignment of first
3086 * yyscript.y (exp): Call script_data_segment_align and
3087 script_data_segment_relro_end.
3088 * testsuite/relro_script_test.t: New file.
3089 * testsuite/relro_test.cc (using_script): Declare.
3090 (t1, t2): Test using_script.
3091 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
3092 (relro_script_test_SOURCES): Define.
3093 (relro_script_test_DEPENDENCIES): Define.
3094 (relro_script_test_LDFLAGS): Define.
3095 (relro_script_test_LDADD): Define.
3096 (relro_script_test.so): New target.
3097 * testsuite/Makefile.in: Rebuild.
3099 2008-08-06 Cary Coutant <ccoutant@google.com>
3101 * archive.cc (Archive::total_archives, Archive::total_members)
3102 (Archive::total_members_loaded): New variables.
3103 (Archive::setup): Add parameter. Add option to preread
3105 (Archive::read_armap): Add counter.
3106 (Archive::get_file_and_offset): New function.
3107 (Archive::get_elf_object_for_member): New function.
3108 (Archive::read_all_symbols): New function.
3109 (Archive::read_symbols): New function.
3110 (Archive::add_symbols): Add counters.
3111 (Archive::include_all_members): Use armap to find members if it's
3113 (Archive::include_member): Skip reading symbols if already read.
3114 Factored code into Archive::get_file_and_offset and
3115 Archive::get_elf_object_for_member. Changed call to
3116 Mapfile::report_include_archive_member.
3117 (Archive::print_stats): New function.
3118 * archive.h: Declare Object and Read_symbols_data classes.
3119 (Archive::Archive): Add initializers for new members.
3120 (Archive::setup): Add parameter.
3121 (Archive::print_stats): New function.
3122 (Archive::total_archives, Archive::total_members)
3123 (Archive::total_members_loaded): New variables.
3124 (Archive::get_file_and_offset): New function.
3125 (Archive::get_elf_object_for_member): New function.
3126 (Archive::read_all_symbols): New function.
3127 (Archive::read_symbols): New function.
3128 (Archive::Archive_member): New class.
3129 (Archive::members_): New member.
3130 (Archive::num_members_): New member.
3131 * main.cc: Include archive.h.
3132 (main): Call Archive::print_stats.
3133 * mapfile.cc (Mapfile::report_include_archive_member): Delete
3134 archive parameter; member_name is now the fully-decorated name.
3135 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
3136 * options.h: (General_options): Add --preread-archive-symbols option.
3137 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
3140 2008-08-04 Ian Lance Taylor <iant@google.com>
3142 * symtab.h (Symbol::use_plt_offset): New function.
3143 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
3144 * powerpc.cc (Relocate::relocate): Likewise.
3145 * sparc.cc (Relocate::relocate): Likewise.
3146 * x86_64.cc (Relocate::relocate): Likewise.
3147 * testsuite/weak_plt.sh: New test.
3148 * testsuite/weak_plt_main.cc: New test.
3149 * testsuite/weak_plt_shared.cc: New test.
3150 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
3151 (check_PROGRAMS): Add weak_plt.
3152 (check_DATA): Add weak_plt_shared.so.
3153 (weak_plt_main_pic.o, weak_plt): New targets.
3154 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
3155 * testsuite/Makefile.in: Rebuild.
3157 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
3159 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
3160 * testsuite/Makefile.in: Rebuild.
3162 2008-08-04 Alan Modra <amodra@bigpond.net.au>
3164 * Makefile.am (POTFILES.in): Set LC_ALL=C.
3165 * Makefile.in: Regenerate.
3166 * po/POTFILES.in: Regenerate.
3168 2008-07-29 Ian Lance Taylor <iant@google.com>
3170 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
3171 symbols before other symbols.
3172 * testsuite/script_test_2.cc (test_addr): Declare.
3173 (test_addr_alias): Declare.
3174 (main): Check that test_addr and test_addr_alias have the right
3176 * testsuite/script_test_2.t: Define test_addr_alias and
3179 2008-07-24 Ian Lance Taylor <iant@google.com>
3182 * descriptors.cc: New file.
3183 * descriptors.h: New file.
3184 * gold-threads.h (class Hold_optional_lock): New class.
3185 * fileread.cc: Include "descriptors.h".
3186 (File_read::~File_read): Release descriptor rather than closing
3188 (File_read::open) [file]: Call open_descriptor rather than open.
3189 Set is_descriptor_opened_.
3190 (File_read::open) [memory]: Assert that descriptor is not open.
3191 (File_read::reopen_descriptor): New function.
3192 (File_read::release): Release descriptor.
3193 (File_read::do_read): Make non-const. Reopen descriptor.
3194 (File_read::read): Make non-const.
3195 (File_read::make_view): Reopen descriptor.
3196 (File_read::do_readv): Likewise.
3197 * fileread.h (class File_read): Add is_descriptor_opened_ field.
3198 Update declarations.
3199 * layout.cc: Include "descriptors.h".
3200 (Layout::create_build_id): Use open_descriptor rather than open.
3201 * output.cc: Include "descriptors.h".
3202 (Output_file::open): Use open_descriptor rather than open.
3203 * archive.cc (Archive::const_iterator): Change Archive to be
3205 (Archive::begin, Archive::end): Make non-const.
3206 (Archive::count_members): Likewise.
3207 * archive.h (class Archive): Update declarations.
3208 * object.h (Object::read): Make non-const.
3209 * Makefile.am (CCFILES): Add descriptors.cc.
3210 (HFILES): Add descriptors.h.
3211 * Makefile.in: Rebuild.
3214 * gold.h: Always include <clocale>. Add Solaris workarounds
3215 following code in binutils/sysdep.h.
3218 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
3219 this->eh_frame_hdr_ is NULL before using it.
3221 * dynobj.cc (Versions::Versions): Update comment.
3223 * dynobj.cc (Versions::Versions): If there is an soname, use it as
3224 the base version name.
3226 * stringpool.cc (Stringpool_template::add_with_length): Set key to
3227 array size plus one.
3228 (Stringpool_template::set_string_offsets): Subtract one from key
3229 before using it as an array index.
3230 (Stringpool_template::get_offset_with_length): Likewise.
3231 (Stringpool_template::write_to_buffer): Likewise.
3232 * stringpool.h (Stringpool_template::get_offset_from_key):
3235 2008-07-23 Ian Lance Taylor <iant@google.com>
3238 * object.h (Merged_symbol_value::value): Do our best to handle a
3242 * script.cc (Version_script_info::get_versions): Don't add empty
3243 version tag to return value.
3244 (Version_script_info::get_symbol_version_helper): Change return
3245 type to bool. Add pversion parameter. Change all callers.
3246 (script_register_vers_node): Don't require a non-NULL tag.
3247 * script.h (class Version_script_info): Update declarations.
3248 (Version_script_info::get_symbol_version): Change return type to
3249 bool. Add version parameter. Change all callers.
3250 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
3251 handling. Handle an empty version from a version script.
3252 (Symbol_table::define_special_symbol): Likewise.
3253 * testsuite/ver_test_10.script: New file.
3254 * testsuite/ver_test_10.sh: New file.
3255 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
3256 (check_DATA): Add ver_test_10.syms.
3257 (ver_test_10.syms, ver_test_10.so): New target.
3258 * testsuite/Makefile.in: Rebuild.
3260 2008-07-23 Simon Baldwin <simonb@google.com>
3262 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
3263 to zero for undefined symbols from dynamic libraries.
3265 2008-07-23 Ian Lance Taylor <iant@google.com>
3267 * symtab.cc (Symbol_table::resolve): Remove version parameter.
3269 * symtab.h (class Symbol_table): Update declaration.
3270 * testsuite/ver_test_9.cc: New file.
3271 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
3272 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
3273 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
3274 (ver_test_9.so, ver_test_9.o): New targets.
3275 * testsuite/Makefile.in: Rebuild.
3277 2008-07-22 Ian Lance Taylor <iant@google.com>
3279 * options.h (class General_options): Define --check-sections.
3280 * layout.cc (Layout::set_segment_offsets): Handle
3283 * options.h (class General_options): Define -n/--nmagic and
3285 * options.cc (General_options::finalize): For -n/--nmagic or
3286 -N/--omagic, set -static.
3287 * layout.cc (Layout::attach_allocated_section_to_segment): If
3288 -N/--omagic, don't put read-only and read-write sections in
3290 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
3291 finding a read-only segment.
3292 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
3293 don't set the minimum segment alignment to the common page size,
3294 and don't set the file offset to the address modulo the page size.
3295 * script-sections.cc (Script_sections::create_segments): If
3296 -n/--omagic, don't put read-only and read-write sections in
3299 * cref.cc: New file.
3301 * options.h (class General_options): Add --print-symbol-counts.
3302 * main.cc (main): Issue defined symbol report if requested.
3303 * archive.cc (Archive::interpret_header): Make into a const member
3305 (Archive::add_symbols): Call Input_objects::archive_start and
3307 (Archive::const_iterator): Define new class.
3308 (Archive::begin, Archive::end): New functions.
3309 (Archive::include_all_members): Rewrite to use iterator.
3310 (Archive::count_members): New function.
3311 * archive.h (class Archive): Update declarations.
3312 (Archive::filename): New function.
3313 * object.cc: Include "cref.h".
3314 (Sized_relobj::Sized_relobj): Initialize defined_count_.
3315 (Sized_relobj::do_get_global_symbol_counts): New function.
3316 (Input_objects::add_object): Add object to cross-referencer.
3317 (Input_objects::archive_start): New function.
3318 (Input_objects::archive_stop): New function.
3319 (Input_objects::print_symbol_counts): New function.
3320 * object.h: Declare Cref and Archive.
3321 (Object::get_global_symbol_counts): New function.
3322 (Object::do_get_global_symbol_counts): New pure virtual function.
3323 (class Sized_relobj): Add defined_count_ field. Update
3325 (class Input_objects): Add cref_ field. Update constructor.
3326 Update declarations.
3327 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
3329 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
3331 (Sized_dynobj::do_get_global_symbol_counts): New function.
3332 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
3333 defined_count_. Update declarations. Define Symbols typedef.
3334 * symtab.cc (Symbol_table::add_from_relobj): Add defined
3335 parameter. Change all callers.
3336 (Symbol_table::add_from_dynobj): Add sympointers and defined
3337 parameters. Change all callers.
3338 * symtab.h (class Symbol_table): Update declarations.
3339 * Makefile.am (CCFILES): Add cref.cc.
3340 (HFILES): Add cref.h.
3341 * Makefile.in: Rebuild.
3343 2008-07-22 Simon Baldwin <simonb@google.com>
3345 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
3346 to zero when writing undefined symbols.
3348 2008-07-22 Ian Lance Taylor <iant@google.com>
3350 * output.cc (Output_section::add_input_section): Don't try to
3351 merge empty merge sections.
3353 2008-07-21 Craig Silverstein <csilvers@google.com>
3355 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3356 Include symbol version in error message.
3358 2008-07-20 Chris Demetriou <cgd@google.com>
3360 * configure.ac (gold_cv_c_random_seed): New configured variable.
3361 (RANDOM_SEED_CFLAGS): New substituted variable.
3362 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
3363 * configure: Rebuild.
3364 * Makefile.in: Likewise.
3365 * testsuite/Makefile.in: Likewise.
3367 2008-07-18 Ian Lance Taylor <iant@google.com>
3369 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
3370 where we see NAME/NULL and NAME/VERSION as separate symbols.
3371 * testsuite/ver_test_main.cc (main): Call t4.
3372 (t4, t4_2a): Define.
3373 * testsuite/ver_test_2.cc (t4_2): Define.
3374 * testsuite/ver_test_2.script: Put t4_2a in VER2.
3375 * testsuite/ver_test_4.cc (t4_2a): Define.
3376 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3377 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3379 2008-07-17 Ian Lance Taylor <iant@google.com>
3381 * dynobj.cc (Versions::add_def): If we give an error about a
3382 missing version, go ahead and create the version anyhow.
3384 2008-07-10 Ian Lance Taylor <iant@google.com>
3386 Handle output sections with more than 0x7fffffff bytes.
3387 * object.h (class Relobj): Change map_to_output_ to
3388 output_sections_, and just keep a section pointer. Change all
3389 uses. Move comdat group support to Sized_relobj.
3390 (Relobj::is_section_specially_mapped): Remove.
3391 (Relobj::output_section): Remove poff parameter. Change all
3393 (Relobj::output_section_offset): New function.
3394 (Relobj::set_section_offset): Rewrite.
3395 (Relobj::map_to_output): Remove.
3396 (Relobj::output_sections): New function.
3397 (Relobj::do_output_section_offset): New pure virtual function.
3398 (Relobj::do_set_section_offset): Likewise.
3399 (class Sized_relobj): Add section_offsets_ field. Add comdat
3400 group support from Relobj. Update declarations.
3401 (Sized_relobj::get_output_section_offset): New function.
3402 (Sized_relobj::do_output_section_offset): New function.
3403 (Sized_relobj::do_set_section_offset): New function.
3404 * object.cc (Relobj::output_section_address): Remove.
3405 (Sized_relobj::Sized_relobj): Initialize new fields.
3406 (Sized_relobj::include_section_group): Cast find_kept_object to
3408 (Sized_relobj::include_linkonce_section): Likewise.
3409 (Sized_relobj::do_layout): Use separate arrays for output section
3411 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3413 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3414 output_sections and section_offsets.
3415 (Sized_relobj::write_local_symbols): Likewise.
3416 (map_to_kept_section): Compute output address directly.
3417 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3418 output_sections and section_offsets.
3419 (Sized_relobj::write_sections): Likewise.
3420 (Sized_relobj::relocate_sections): Likewise.
3421 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3422 * output.h (class Output_reloc): Update declarations. Change
3423 u2_.relobj to Sized_relobj*.
3424 (class Output_data_reloc): Change add functions to use
3426 * output.cc (Output_reloc::Output_reloc): Change relobj to
3428 (Output_reloc::local_section_offset): Change return type to
3429 Elf_Addr. Use get_output_section_offset.
3430 (Output_reloc::get_address): Likewise.
3431 (Output_section::is_input_address_mapped): Don't call
3432 is_section_specially_mapped.
3433 (Output_section::output_offset): Likewise.
3434 (Output_section::output_address): Likewise.
3435 (Output_section::starting_output_address): Likewise.
3436 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3437 parameter to Sized_relobj*.
3438 (Copy_relocs::need_copy_reloc): Likewise.
3439 (Copy_relocs::save): Likewise.
3440 * copy-relocs.h (class Copy_relocs): Update declarations.
3441 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3442 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3443 * target-reloc.h (relocate_for_relocatable): Change
3444 offset_in_output_section type to Elf_Addr. Change code that uses
3446 * layout.cc (Layout::layout): Always set *off.
3447 * mapfile.cc (Mapfile::print_input_section): Use
3448 output_section_offset.
3449 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3451 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3452 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3453 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3455 2008-07-03 Ian Lance Taylor <iant@google.com>
3457 * layout.cc (Layout::include_section): Do not discard unrecognized
3458 SHT_STRTAB sections.
3460 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3462 * script.cc (Lex::can_continue_name): Make '?' allowable in
3463 version-script names.
3464 * testsuite/version_script.map: Change glob pattern to use '?'
3466 2008-06-30 Manish Singh <yosh@gimp.org>
3469 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3472 2008-06-30 Ian Lance Taylor <iant@google.com>
3476 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3477 versions]: Don't try to read the value in the contents, since we
3478 don't use it. Use the template endianness when writing.
3480 2008-06-25 Cary Coutant <ccoutant@google.com>
3482 * fileread.cc (File_read::make_view): Assert on zero-length view.
3483 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3484 symbol table when there are no symbols to read.
3486 2008-06-23 Craig Silverstein <csilvers@google.com>
3488 * version.cc (version_string): Bump to 1.7
3490 2008-06-18 Craig Silverstein <csilvers@google.com>
3492 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3493 constant 0xFFFF to type Valtype.
3494 (Powerpc_relocate_functions::rel16_ha): Likewise.
3496 2008-06-17 Ian Lance Taylor <iant@google.com>
3498 * output.h (Output_section::Input_section): Initialize p2align_ to
3499 zero for Output_section_data constructors.
3500 (Output_section::Input_section::addralign): If not an input
3501 section, return the alignment of the Output_section_data.
3502 * testsuite/copy_test.cc: New file.
3503 * testsuite/copy_test_1.cc: New file.
3504 * testsuite/copy_test_2.cc: New file.
3505 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3506 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3507 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3508 (copy_test_1_pic.o, copy_test_1.so): New targets.
3509 (copy_test_2_pic.o, copy_test_2.so): New targets.
3510 * testsuite/Makefile.in: Rebuild.
3512 * script-sections.cc (Script_sections::place_orphan): Initialize
3513 local variable exact.
3515 2008-06-13 David Edelsohn <edelsohn@gnu.org>
3517 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3519 2008-06-12 David Edelsohn <edelsohn@gnu.org>
3520 David S. Miller <davem@davemloft.net>
3522 * powerpc.cc: New file.
3523 * Makefile.am (TARGETSOURCES): Add powerpc.cc
3524 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
3525 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
3526 * Makefile.in: Rebuild.
3528 2008-06-09 Ian Lance Taylor <iant@google.com>
3530 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
3532 (throwing, orig_terminate): New static variables.
3533 (terminate_handler): New static function.
3534 (t2): Set terminate handler.
3536 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
3539 * binary.cc (Binary_to_elf::sized_convert): Fix .data
3542 2008-05-30 Cary Coutant <ccoutant@google.com>
3544 * archive.cc (Archive::include_all_members) Correct to step
3545 over symbol table and extended name table in thin archives.
3547 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
3550 * target-reloc.h (relocate_for_relocatable): Fix new_offset
3553 2008-05-28 Caleb Howe <cshowe@google.com>
3555 * reduced_debug_output.cc: New file.
3556 * reduced_debug_output.h: New file.
3557 * options.h (class General_options): Add --strip-debug-non-line.
3558 * options.cc (General_options::finalize): Add strip_debug_non_line
3559 to the strip heirarchy.
3560 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
3562 * layout.cc: Include "reduced_debug_output.h".
3563 (Layout::Layout): Initialize new fields.
3564 (line_only_debug_sections): New static array.
3565 (is_lines_only_debug_sections): New static inline function.
3566 (Layout::include_section): Handle --strip-debug-non-line.
3567 (Layout::make_output_section): If --strip-debug-non-line, build
3568 new output sections for .debug_abbrev and .debug_info.
3569 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
3570 gold. Warn about possible overflow.
3571 (read_signed_LEB_128): Likewise.
3572 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
3573 (read_signed_LEB_128): Declare.
3574 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
3575 (HFILES): Add reduced_debug_output.h.
3576 * Makefile.in: Rebuild.
3578 2008-05-21 Ian Lance Taylor <iant@google.com>
3580 * mapfile.cc: New file.
3581 * mapfile.h: New file.
3582 * options.h (class General_options): Add -M/--print-map and -Map.
3583 * options.cc (General_options::finalize): Make -M equivalent to
3585 * main.cc: Include <cstdio> and "mapfile.h".
3586 (main): Open mapfile if requested.
3587 * gold.cc (class Middle_runner): Add mapfile_ field. Update
3588 constructor. Change caller.
3589 (queue_initial_tasks): Add mapfile parameter. Change caller.
3590 (queue_middle_tasks): Likewise.
3591 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
3593 * archive.cc: Include "mapfile.h".
3594 (Archive::add_symbols): Add mapfile parameter. Change all
3595 callers. Pass mapfile, symbol, and reason to include_member.
3596 (Archive::include_all_members): Add mapfile parameter. Change all
3598 (Archive::include_member): Add mapfile, sym, and why parameters.
3599 Change all callers. Report inclusion to map file.
3600 * archive.h: Include "fileread.h".
3601 (class Archive): Update declarations.
3602 (Archive::file): New const method.
3603 (class Add_archive_symbols): Add mapfile_ field. Update
3604 constructor. Change all callers.
3605 * readsyms.h (class Read_symbols): Likewise.
3606 (class Finish_group): Likewise.
3607 (class Read_script): Likewise.
3608 * common.cc: Include "mapfile.h".
3609 (Symbol_table::allocate_commons): Add mapfile parameter. Change
3611 (Symbol_table::do_allocate_commons): Likewise.
3612 (Symbol_table::do_allocate_commons_list): Likewise. Report common
3613 symbol allocation to mapfile.
3614 * common.h (class Allocate_commons_task): Add mapfile_ field.
3615 Update constructor. Change all callers.
3616 * symtab.h (class Symbol_table): Update declarations.
3617 * layout.cc: Include "mapfile.h".
3618 (Layout_task_runner::run): Print information to mapfile.
3619 (Layout::create_gold_note): Change Output_data_fixed_space to
3620 Output_data_zero_fill.
3621 (Layout::create_build_id): Likewise.
3622 (Layout::print_to_mapfile): New function.
3623 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
3624 constructor. Change caller.
3625 (class Layout): Declare print_to_mapfile.
3626 * output.cc (Output_section::Input_section::print_to_mapfile): New
3628 (Output_section::add_input_section): If producing a map, always
3629 add to input_sections_ list.
3630 (Output_section::do_print_to_mapfile): New function.
3631 (Output_segment::print_sections_to_mapfile): New function.
3632 (Output_segment::print_section_list_to_mapfile): New function.
3633 * output.h: Include "mapfile.h".
3634 (Output_data::print_to_mapfile): New function.
3635 (Output_data::do_print_to_mapfile): New virtual function.
3636 (Output_segment_headers::do_print_to_mapfile): New function.
3637 (Output_file_header::do_print_to_mapfile): New function.
3638 (Output_data_const::do_print_to_mapfile): New function.
3639 (class Output_data_const_buffer): Add map_name_ field. Update
3640 constructor. Change all callers. Add do_print_to_mapfile
3642 (class Output_data_fixed_space): Likewise.
3643 (class Output_data_space): Likewise.
3644 (class Output_data_zero_fill): New class.
3645 (Output_data_strtab::do_print_to_mapfile): New function.
3646 (Output_data_reloc_base::do_print_to_mapfile): New function.
3647 (Output_relocatable_relocs::do_print_to_mapfile): New function.
3648 (Output_data_group::do_print_to_mapfile): New function.
3649 (Output_data_got::do_print_to_mapfile): New function.
3650 (Output_data_dynamic::do_print_to_mapfile): New function.
3651 (Output_symtab_xindex::do_print_to_mapfile): New function.
3652 (class Output_section): Declare do_print_to_mapflie. Declare
3653 print_to_mapfile in Input_section.
3654 (class Output_segment): Declare new functions.
3655 * object.h (Sized_relobj::symbol_count): New function.
3656 * script-sections.cc
3657 (Output_section_element_dot_assignment::set_section_addresses):
3658 Change Output_data_fixed_space to Output_data_zero_fill.
3659 (Output_data_expression::do_print_to_mapfile): New function.
3660 * script.cc (read_input_script): Add mapfile parameter. Change
3662 * script.h (read_input_script): Update declaration.
3663 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
3664 (Eh_frame::do_print_to_mapfile): New function.
3665 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
3666 (Output_merge_string::do_print_to_mapfile): New function.
3667 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
3669 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
3671 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
3673 * Makefile.am (CCFILES): Add mapfile.cc.
3674 (HFILES): Add mapfile.h.
3675 * Makefile.in: Rebuild.
3677 2008-05-19 Ian Lance Taylor <iant@google.com>
3679 * options.h (class General_options): Add -z relro.
3680 * layout.cc (Layout::Layout): Initialize relro_segment_.
3681 (Layout::add_output_section_data): Return the output section.
3682 (Layout::make_output_section): Rcognize relro sections and mark
3684 (Layout::attach_allocated_section_to_segment): Put relro sections
3685 in a PT_GNU_RELRO segment.
3686 (Layout::create_initial_dynamic_sections): Mark the .dynamic
3688 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
3690 (Layout::linkonce_mapping): Map d.rel.ro.local to
3692 (Layout::output_section_name): Us .data.rel.ro.local for any
3693 section which begins with that.
3694 * layout.h (class Layout): Update add_output_section_data
3695 declaration. Add relro_segment_ field.
3696 * output.cc (Output_section::Output_section): Initialize is_relro_
3697 and is_relro_local_ fields.
3698 (Output_segment::add_output_section): Group relro sections.
3699 (Output_segment::is_first_section_relro): New function.
3700 (Output_segment::maximum_alignment): If there is a relro section,
3701 align the segment to the common page size.
3702 (Output_segment::set_section_addresses): Track whether we are
3703 looking at relro sections. If the last section is a relro
3704 section, align to the common page size.
3705 (Output_segment::set_section_list_addresses): Add in_relro
3706 parameter. Change all callers. Align to the page size when
3707 moving from relro to non-relro section.
3708 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
3710 * output.h (class Output_section): Add is_relro_ and
3711 is_relro_local_ fields.
3712 (Output_section::is_relro): New function.
3713 (Output_section::set_is_relro): New function.
3714 (Output_section::is_relro_local): New function.
3715 (Output_section::set_is_relro_local): New function.
3716 (class Output_segment): Update declarations.
3717 * i386.cc (Target_i386::got_section): Mark .got section as relro.
3718 * sparc.cc (Target_sparc::got_section): Likewise.
3719 * x86_64.cc (Target_x86_64::got_section): Likewise.
3720 * testsuite/relro_test_main.cc: New file.
3721 * testsuite/relro_test.cc: New file.
3722 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
3723 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
3724 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
3725 (relro_test.so, relro_test_pic.o): New targets.
3726 * testsuite/Makefile.in: Rebuild.
3728 2008-05-16 Ian Lance Taylor <iant@google.com>
3730 * output.cc (Output_segment::add_output_section): Remove front
3732 * output.h (class Output_segment): Remove
3733 add_initial_output_section and overloaded add_output_section.
3734 Update declaration of remaining add_output_section.
3735 * layout.cc (Layout::create_interp): Call add_output_section
3736 rather than add_initial_output_section.
3737 (Layout::finish_dynamic_section): Likewise.
3739 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
3740 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
3741 know the dynamic type.
3742 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
3743 field. Initialize it in constructor.
3744 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
3745 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
3746 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
3749 * output.cc (Output_reloc::get_address): Change return type to
3751 * output.h (class Output_reloc): Update get_address declaration.
3752 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
3753 for section addresses.
3755 2008-05-09 Ian Lance Taylor <iant@google.com>
3758 * gold.cc (gold_nomem): Use return value of write.
3760 2008-05-08 Ian Lance Taylor <iant@google.com>
3762 * symtab.c (Symbol::init_base_output_data): Add version
3763 parameter. Change all callers.
3764 (Symbol::init_base_output_segment): Likewise.
3765 (Symbol::init_base_constant): Likewise.
3766 (Symbol::init_base_undefined): Likewise.
3767 (Sized_symbol::init_output_data): Likewise.
3768 (Sized_symbol::init_output_segment): Likewise.
3769 (Sized_symbol::init_constant): Likewise.
3770 (Sized_symbol::init_undefined): Likewise.
3771 (Symbol_table::do_define_in_output_data): If the new symbol has a
3772 version, mark it as the default.
3773 (Symbol_table::do_define_in_output_segment): Likewise.
3774 (Symbol_table::do_define_as_constant): Likewise.
3775 * symtab.h (class Symbol): Update declarations.
3776 (class Sized_symbol): Likewise.
3777 * resolve.cc (Symbol::override_version): New function.
3778 (Symbol::override_base): Call override_version.
3779 (Symbol::override_base_with_special): Likewise.
3780 * testsuite/ver_script_8.script: New file.
3781 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
3782 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
3783 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
3784 (ver_test_8_1.so, ver_test_8_2.so): New targets.
3786 2008-05-06 Ian Lance Taylor <iant@google.com>
3789 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
3791 (class General_options): Remove existing --undefined, and add
3792 --no-undefined instead. Add new --undefined as synonym for -u.
3793 * archive.cc (Archive::add_symbols): Check whether symbol was
3795 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
3796 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
3797 all uses. Add IS_UNDEFINED. Update declarations to split
3798 different versions of init_base. Declare init_base_undefined.
3799 (Symbol::is_defined): Handle IS_UNDEFINED.
3800 (Symbol::is_undefined): Likewise.
3801 (Symbol::is_weak_undefined): Call is_undefined.
3802 (Symbol::is_absolute): Handle IS_CONSTANT.
3803 (class Sized_symbol): Update declarations to split different
3804 versions of init. Declare init_undefined.
3805 (class Symbol_table): Declare new functions.
3806 * symtab.cc (Symbol::init_base_object): Rename from init_base.
3808 (Symbol::init_base_output_data): Likewise.
3809 (Symbol::init_base_output_segment): Likewise.
3810 (Symbol::init_base_constant): Likewise.
3811 (Symbol::init_base_undefined): New function.
3812 (Sized_symbol::init_object): Rename from init. Change all
3814 (Sized_symbol::init_output_data): Likewise.
3815 (Sized_symbol::init_output_segment): Likewise.
3816 (Sized_symbol::init_constant): Likewise.
3817 (Sized_symbol::init_undefined): New function.
3818 (Symbol_table::add_undefined_symbols_from_command_line): New
3820 (Symbol_table::do_add_undefined_symbols_from_command_line): New
3822 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
3823 (Symbol::output_section): Likewise.
3824 (Symbol::set_output_section): Likewise.
3825 (Symbol_table::sized_finalize_symbol): Likewise.
3826 (Symbol_table::sized_write_globals): Likewise.
3827 * resolve.cc (Symbol_table::should_override): Likewise.
3828 (Symbol::override_base_with_special): Likewise.
3830 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
3831 symbol, change it to have default visibility.
3832 * testsuite/protected_1.cc: New file.
3833 * testsuite/protected_2.cc: New file.
3834 * testsuite/protected_3.cc: New file.
3835 * testsuite/protected_main_1.cc: New file.
3836 * testsuite/protected_main_2.cc: New file.
3837 * testsuite/protected_main_3.cc: New file.
3838 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
3839 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
3840 (protected_1_LDFLAGS, protected_1_LDADD): Define.
3841 (protected_1.so): New target.
3842 (protected_1_pic.o, protected_2_pic.o): New targets.
3843 (protected_3_pic.o): New target.
3844 (check_PROGRAMS): Add protected_2.
3845 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
3846 (protected_2_LDFLAGS, protected_2_LDADD): Define.
3847 * testsuite/Makefile.in: Rebuild.
3849 * options.h (DEFINE_var): Add set_user_set_##varname__.
3850 (DEFINE_bool_alias): New macro.
3851 (class General_options): Define -Bstatic using DEFINE_bool_alias
3852 rather than DEFINE_special. Add --undefined as an alias for -z
3854 * options.cc (General_options::parse_Bstatic): Remove.
3856 * options.h (class General_options): Add --fatal-warnings.
3857 * main.cc (main): Implement --fatal-warnings.
3858 * errors.h (Errors::warning_count): New function.
3860 * options.h (class General_options): Add -Bsymbolic-functions.
3861 * symtab.h (Symbol::is_preemptible): Check for
3862 -Bsymbolic-functions.
3864 2008-05-05 Ian Lance Taylor <iant@google.com>
3866 * options.h (DEFINE_bool): For DASH_Z, create the negative option
3867 as noVARNAME rather than no-VARNAME.
3868 (class General_options): Add option -z combreloc.
3869 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
3871 (Output_reloc::sort_before) [SHT_REL]: New function.
3872 (Output_reloc::sort_before) [SHT_RELA]: New function.
3873 (class Output_data_reloc_base): Add sort_relocs_ field. Define
3874 Sort_relocs_comparison.
3875 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
3876 parameter. Change all callers.
3877 (Output_data_reloc::Output_data_reloc) [both versions]: Add
3878 sort_relocs parameter. Change all callers.
3879 * output.cc (Output_reloc::get_address): New function, broken out
3881 (Output_reloc::write_rel): Call it.
3882 (Output_reloc::compare): New function.
3883 (Output_data_reloc_base::do_write): Optionally sort relocs.
3885 * configure.ac: If targ_extra_obj is set, link it in.
3886 * configure.tgt: Initialize all variables.
3887 (x86_64*): Set targ_extra_obj and targ_extra_size.
3888 * configure: Rebuild.
3890 * object.cc (Sized_relobj::include_section_group): Adjust section
3891 indexes read from group data. Build vector to pass to
3893 * layout.cc (Layout::layout_group): Add flags and shndxes
3894 parameters. Remove contents parameter. Change caller. Update
3895 explicit instantiations.
3896 * layout.h (class Layout): Update layout_group declaration.
3897 * output.cc (Output_data_group::Output_data_group): Add flags and
3898 input_shndxes parameters. Remove contents parameter. Change
3900 (Output_data_group::do_write): Change input_sections_ to
3902 * output.h (class Output_data_group): Update constructor
3903 declaration. Rename input_sections_ to input_shndxes_.
3904 * testsuite/many_sections_test.cc: Add template.
3906 2008-04-30 Cary Coutant <ccoutant@google.com>
3908 * target-reloc.h (relocate_section): Fix dead-pointer bug.
3910 * layout.cc (Layout::include_section): Refactored check for debug
3912 (Layout::add_comdat): Add new parameters. Change type
3913 of signature parameter. Add object and shndx to signatures table.
3914 (Layout::find_kept_object): New function.
3915 * layout.h: Include <cstring>.
3916 (Layout::is_debug_info_section): New function.
3917 (Layout::add_comdat): Add new parameters.
3918 (Layout::find_kept_object): New function.
3919 (Layout::Kept_section): New struct.
3920 (Layout::Signatures): Change type of map range.
3921 * object.cc (Relobj::output_section_address): New function.
3922 (Sized_relobj::include_section_group): Add new parameters. Change
3923 calls to Layout::add_comdat. Change to build table of kept comdat
3924 groups and table mapping discarded sections to kept sections.
3925 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
3926 (Sized_relobj::do_layout): Change calls to include_section_group and
3927 include_linkonce_section.
3928 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
3929 value to zero when section is discarded.
3930 (Sized_relobj::map_to_kept_section): New function.
3931 * object.h (Relobj::output_section_address): New function.
3932 (Relobj::Comdat_group): New type.
3933 (Relobj::find_comdat_group): New function.
3934 (Relobj::Comdat_group_table): New type.
3935 (Relobj::Kept_comdat_section): New type.
3936 (Relobj::Kept_comdat_section_table): New type.
3937 (Relobj::add_comdat_group): New function.
3938 (Relobj::set_kept_comdat_section): New function.
3939 (Relobj::get_kept_comdat_section): New function.
3940 (Relobj::comdat_groups_): New field.
3941 (Relobj::kept_comdat_sections_): New field.
3942 (Symbol_value::input_value): Update comment.
3943 (Sized_relobj::map_to_kept_section) New function.
3944 (Sized_relobj::include_linkonce_section): Add new parameter.
3945 * target-reloc.h (Comdat_behavior): New type.
3946 (get_comdat_behavior): New function.
3947 (relocate_section): Add code to map a discarded section to the
3948 corresponding kept section when applying a relocation.
3950 2008-04-30 Craig Silverstein <csilvers@google.com>
3952 * dwarf_reader.cc (next_generation_count): New static var.
3953 (Addr2line_cache_entry): New struct.
3954 (addr2line_cache): New static var.
3955 (Dwarf_line_info::one_addr2line): Added caching.
3956 (Dwarf_line_info::clear_addr2line_cache): New function.
3957 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
3958 cache-size parameter.
3959 (Dwarf_line_info::one_addr2line_cache): New function.
3960 * symtab.cc (Symbol_table::detect_odr_violations): Pass
3961 new cache-size argument to one_addr2line(), and clear cache.
3963 2008-04-28 Cary Coutant <ccoutant@google.com>
3965 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
3966 R_386_PC8 relocations.
3968 2008-04-23 Ian Lance Taylor <iant@google.com>
3970 * object.cc (Sized_relobj::include_section_group): Check for
3971 invalid section group.
3973 * object.cc (make_elf_object): Correct test for 64-bit ELF file
3976 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
3977 than read for file header.
3978 * archive.cc (Archive::include_member): Likewise.
3980 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
3982 * aclocal.m4: Regenerate.
3983 * configure: Regenerate.
3985 2008-04-19 Ian Lance Taylor <iant@google.com>
3987 * version.cc (version_string): Bump to 1.6.
3989 * testsuite/Makefile.am (many_sections_r_test): New target.
3990 (many_sections_r_test_SOURCES): Remove.
3991 (many_sections_r_test_DEPENDENCIES): Remove.
3992 (many_sections_r_test_LDFLAGS): Remove.
3993 (many_sections_r_test_LDADD): Remove.
3995 * object.cc (Sized_relobj::do_add_symbols): Always pass
3996 local_symbol_count_ to add_from_relobj.
3998 * testsuite/Makefile.am (many_sections_check.h): Only check one in
3999 every thousand variables.
4000 * testsuite/Makefile.in: Rebuild.
4002 * object.cc (Xindex::initialize_symtab_xindex): New function.
4003 (Xindex::read_symtab_xindex): New function.
4004 (Xindex::sym_xindex_to_shndx): New function.
4005 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
4007 (Sized_relobj::do_initialize_xindex): New function.
4008 (Sized_relobj::do_read_symbols): Adjust section links.
4009 (Sized_relobj::symbol_section_and_value): Add is_ordinary
4010 parameter. Change all callers.
4011 (Sized_relobj::include_section_group): Adjust section links and
4012 symbol section indexes.
4013 (Sized_relobj::do_layout): Adjust section links.
4014 (Sized_relobj::do_count_local_symbols): Adjust section links and
4015 symbol section indexes.
4016 (Sized_relobj::do_finalize_local_symbols): Distinguish between
4017 ordinary and special symbols.
4018 (Sized_relobj::write_local_symbols): Add symtab_xindex and
4019 dynsym_xindex parameters. Change all callers. Adjust section
4020 links. Use SHN_XINDEX when needed.
4021 (Sized_relobj::get_symbol_location_info): Adjust section links.
4022 Don't get fooled by special symbols.
4023 * object.h (class Xindex): Define.
4024 (class Object): Add xindex_ parameter. Declare virtual functoin
4025 do_initialize_xindex.
4026 (Object::adjust_sym_shndx): New function.
4027 (Object::set_xindex): New protected function.
4028 (class Symbol_value): Add is_ordinary_shndx_ field.
4029 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
4030 (Symbol_value::value): Assert ordinary section.
4031 (Symbol_value::initialize_input_to_output_map): Likewise.
4032 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
4034 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
4036 (class Sized_relobj): Update declarations.
4037 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
4038 parameter. Change all callers.
4039 (Sized_relobj::adjust_shndx): New function.
4040 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
4042 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
4043 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
4044 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
4045 (Sized_dynobj::read_dynsym_section): Adjust section links.
4046 (Sized_dynobj::read_dynamic): Likewise.
4047 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
4049 (Sized_dynobj::do_initialize_xindex): New function.
4050 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
4051 do_initialize_xindex.
4052 (Sized_dynobj::adjust_shndx): New function.
4053 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
4054 dynsym_xindex_ fields.
4055 (Layout::finalize): Add a call to set_section_indexes before
4056 creating the symtab sections.
4057 (Layout::set_section_indexes): Don't do anything if the section
4058 already has a section index.
4059 (Layout::create_symtab_sections): Add shnum parameter. Change
4060 caller. Create .symtab_shndx section if needed.
4061 (Layout::create_shdrs): Add shstrtab_section parameter. Change
4063 (Layout::allocated_output_section_count): New function.
4064 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
4066 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
4067 fields. Update declarations.
4068 (Layout::symtab_xindex): New function.
4069 (Layout::dynsym_xindex): New function.
4070 (class Write_symbols_task): Add layout_ field.
4071 (Write_symbols_task::Write_symbols_task): Add layout parameter.
4073 * output.cc (Output_section_headers::Output_section_headers): Add
4074 shstrtab_section parameter. Change all callers.
4075 (Output_section_headers::do_sized_write): Store overflow values
4076 for section count and section string table section index in
4077 section header zero.
4078 (Output_file_header::do_sized_write): Check for overflow of
4079 section count and section string table section index.
4080 (Output_symtab_xindex::do_write): New function.
4081 (Output_symtab_xindex::endian_do_write): New function.
4082 * output.h (class Output_section_headers): Add shstrtab_section_.
4083 Update declarations.
4084 (class Output_symtab_xindex): Define.
4085 (Output_section::has_out_shndx): New function.
4086 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
4088 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
4090 (Sized_symbol::init): Likewise.
4091 (Symbol::output_section): Check for ordinary symbol.
4092 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
4093 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
4095 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
4096 Change all callers. Simplify handling of symbols from sections
4097 not included in the link.
4098 (Symbol_table::add_from_dynobj): Handle ordinary symbol
4100 (Weak_alias_sorter::operator()): Assert that symbols are
4102 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
4104 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
4105 parameters. Change all callers.
4106 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
4107 symbol distinction. Use SHN_XINDEX when needed.
4108 (Symbol_table::write_section_symbol): Add symtab_xindex
4109 parameter. Change all callers.
4110 (Symbol_table::sized_write_section_symbol): Likewise. Use
4111 SHN_XINDEX when needed.
4112 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
4114 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
4115 (Symbol::is_defined): Check is_ordinary.
4116 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
4117 (Symbol::is_absolute, Symbol::is_common): Likewise.
4118 (class Sized_symbol): Update declarations.
4119 (class Symbol_table): Update declarations.
4120 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
4121 parameters. Change all callers.
4122 (Sized_symbol::override): Likewise.
4123 (Symbol_table::override): Likewise.
4124 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
4125 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
4126 is_ordinary, and orig_st_shndx parameters. Change all callers.
4127 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
4128 to be in an ordinary section.
4129 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
4130 object and is_ordinary parameters. Change all callers.
4131 (Sized_dwarf_line_info::read_relocs): Add object parameter.
4132 Change all callers. Don't add undefined or non-ordinary symbols
4134 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
4136 * dwarf_reader.h (class Sized_dwarf_line_info): Update
4138 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
4139 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
4140 (Sized_relobj::relocate_sections): Likewise.
4141 * target-reloc.h (scan_relocs): Adjust section symbol index.
4142 (scan_relocatable_relocs): Likewise.
4143 * i386.cc (Scan::local): Check for ordinary symbols.
4144 * sparc.cc (Scan::local): Likewise.
4145 * x86_64.cc (Scan::local): Likewise.
4146 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
4147 to symbol_section_and_value.
4148 * testsuite/many_sections_test.cc: New file.
4149 * testsuite/Makefile.am (BUILT_SOURCES): Define.
4150 (check_PROGRAMS): Add many_sections_test.
4151 (many_sections_test_SOURCES): Define.
4152 (many_sections_test_DEPENDENCIES): Define.
4153 (many_sections_test_LDFLAGS): Define.
4154 (BUILT_SOURCES): Add many_sections_define.h.
4155 (many_sections_define.h): New target.
4156 (BUILT_SOURCES): Add many_sections_check.h.
4157 (many_sections_check.h): New target.
4158 (check_PROGRAMS): Add many_sections_r_test.
4159 (many_sections_r_test_SOURCES): Define.
4160 (many_sections_r_test_DEPENDENCIES): Define.
4161 (many_sections_r_test_LDFLAGS): Define.
4162 (many_sections_r_test_LDADD): Define.
4163 (many_sections_r_test.o): New target.
4164 * testsuite/Makefile.in: Rebuild.
4166 2008-04-17 Cary Coutant <ccoutant@google.com>
4168 * errors.cc (Errors::info): New function.
4169 (gold_info): New function.
4170 * errors.h (Errors::info): New function.
4171 * gold.h (gold_info): New function.
4172 * object.cc (Input_objects::add_object): Print trace output.
4173 * options.cc (options::parse_set): New function.
4174 (General_options::parse_wrap): Deleted.
4175 (General_options::General_options): Deleted initializer.
4176 * options.h (options::String_set): New typedef.
4177 (options::parse_set): New function.
4178 (DEFINE_set): New macro.
4179 (General_options::wrap): Changed to use DEFINE_set. Changed
4180 callers of any_wrap_symbols and is_wrap_symbol.
4181 (General_options::trace, General_options::trace_symbol):
4183 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
4184 (General_options::wrap_symbols_): Deleted.
4185 * symtab.cc (Symbol_table::add_from_object): Print trace output.
4187 2008-04-17 David S. Miller <davem@davemloft.net>
4189 * options.cc (General_options::parse_V): New function.
4190 * options.h: Add entries for -V and -Qy.
4192 2008-04-17 Ian Lance Taylor <iant@google.com>
4194 * common.cc (Symbol_table::allocate_commons): Remove options
4195 parameter. Change caller.
4196 (Symbol_table::do_allocate_commons): Remove options parameter.
4197 Change caller. Just call do_allocate_commons_list twice.
4198 (Symbol_table::do_allocate_commons_list): New function, broken out
4199 of do_allocate_commons.
4200 * common.h (class Allocate_commons_task): Remove options_ field.
4202 * symtab.cc (Symbol_table::Symbol_table): Initialize
4204 (Symbol_table::add_from_object): Put TLS common symbols on
4206 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
4207 which are IN_OUTPUT_DATA.
4208 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
4209 allocate_commons and do_allocate_commons declarations. Declare
4210 do_allocate_commons_list.
4211 * gold.cc (queue_middle_tasks): Update creation of
4212 Allocate_commons_task to not pass options.
4213 * testsuite/Makefile.am (INCLUDES): Add -I.. .
4214 (TLS_TEST_C_FLAGS): New variable.
4215 (tls_test_c_pic.o): New target.
4216 (tls_test_shared.so): Link in tls_test_c_pic.o.
4217 (tls_test_c_pic_ie.o): New target.
4218 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
4219 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
4220 (tls_test_c.o): New target.
4221 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
4222 (tls_pic_test_LDADD): Likewise.
4223 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
4224 (tls_shared_gd_to_ie_test_LDADD): Likewise.
4225 (tls_test_c_gnu2.o): New target.
4226 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
4228 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
4229 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
4230 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
4231 * testsuite/tls_test.cc: Include "config.h".
4232 (t_last): Call t11_last.
4233 * testsuite/tls_test.h (t11, t11_last): Declare.
4234 * testsuite/tls_test_c.c: New file.
4235 * testsuite/tls_test_main.cc (thread_routine): Call t11.
4236 * configure.ac: Check for OpenMP support.
4237 * configure, config.in, Makefile.in: Rebuild.
4238 * testsuite/Makefile.in: Rebuild.
4240 2008-04-16 Cary Coutant <ccoutant@google.com>
4242 * i386.cc (Target_i386::define_tls_base_symbol): New function.
4243 (Target_i386::tls_base_symbol_defined_): New field.
4244 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4245 (Target_i386::Scan::global): Likewise.
4246 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
4247 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
4248 (Target_x86_64::tls_base_symbol_defined_): New field.
4249 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4250 (Target_x86_64::Scan::global): Likewise.
4252 2008-04-16 Cary Coutant <ccoutant@google.com>
4254 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
4255 (Symbol::needs_plt_entry): Allow weak undefined symbols.
4256 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
4257 building shared libraries.
4258 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
4259 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
4260 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
4261 * testsuite/Makefile.in: Rebuild.
4262 * testsuite/weak_undef.h: New file.
4263 * testsuite/weak_undef_file1.cc: Add extra test cases.
4264 * testsuite/weak_undef_file2.cc: Likewise.
4265 * testsuite/weak_undef_test.cc: Likewise.
4267 2008-04-16 David S. Miller <davem@davemloft.net>
4269 * sparc.cc (Target_sparc::Scan): Change from struct to class.
4270 Add issued_non_pic_error_ field. Declare check_non_pic.
4271 (Target_sparc::Scan::check_non_pic): New function.
4272 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
4273 (Target_sparc::Scan::global): Likewise.
4275 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
4276 * configure: Rebuild.
4278 * options.h (DEFINE_enable): New macro.
4279 (new_dtags): New enable option.
4280 (initfirst, interpose, loadfltr, nodefaultlib,
4281 nodelete, nodlopen, nodump): New -z options.
4282 * layout.cc (Layout:finish_dynamic_section): If new
4283 dtags enabled, emit DT_RUNPATH. Also, emit a
4284 DT_FLAGS_1 containing any specified -z flags.
4286 2008-04-16 Ian Lance Taylor <iant@google.com>
4288 * copy-relocs.cc: New file.
4289 * copy-relocs.h: New file.
4290 * reloc.cc: Remove Copy_relocs code.
4291 * reloc.h: Likewise.
4292 * reloc-types.h (struct Reloc_types) [both versions]: Add
4293 get_reloc_addend_noerror.
4294 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
4295 variants of add_global which take an addend which must be zero.
4296 * i386.cc: Include "copy-relocs.h".
4297 (class Target_i386): Change type of copy_relocs_ to variable,
4299 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
4301 (Target_i386::do_finalize_sections): Change handling of
4303 * sparc.cc: Include "copy-relocs.h".
4304 (class Target_sparc): Change type of copy_relocs_ to variable,
4306 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
4308 (Target_sparc::do_finalize_sections): Change handling of
4310 * x86_64.cc: Include "copy-relocs.h".
4311 (class Target_x86_64): Change type of copy_relocs_ to variable,
4313 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
4314 class. Change all callers.
4315 (Target_x86_64::do_finalize_sections): Change handling of
4317 * Makefile.am (CCFILES): Add copy-relocs.cc.
4318 (HFILES): Add copy-relocs.h.
4320 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
4322 * testsuite/script_test_4.sh: Permit leading zeroes.
4324 2008-04-15 Ian Lance Taylor <iant@google.com>
4326 * script-sections.cc (Script_sections::create_segments): Use
4327 header_size_adjustment even when there is enough room for the
4329 * testsuite/script_test_4.sh: New file.
4330 * testsuite/script_test_4.t: New file.
4331 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
4332 (check_DATA): Add script_test_4.stdout.
4333 (MOSTLYCLEANFILES): Likewise.
4334 (script_test_4): New target.
4335 (script_test_4.stdout): New target.
4336 * testsuite/Makefile.in: Rebuild.
4338 * sparc.cc: Add definitions for Output_data_plt_sparc class
4341 2008-04-14 David S. Miller <davem@davemloft.net>
4343 * sparc.cc: New file.
4344 * Makefile.am (TARGETSOURCES): Add sparc.cc
4345 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
4346 * configure.tgt: Document targ_extra_size and
4347 targ_extra_big_endian. Add entries for sparc-* and
4349 * configure.ac: Handle targ_extra_size and
4350 targ_extra_big_endian.
4351 * Makefile.in: Rebuild.
4352 * configure: Likewise.
4353 * po/POTFILES.in: Likewise.
4354 * po/gold.pot: Likewise.
4356 2008-04-14 Ian Lance Taylor <iant@google.com>
4358 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
4359 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
4360 in the name/type/flags to section mapping. Don't call
4361 allocate_output_section.
4362 (Layout::choose_output_section): Change parameter from adjust_name
4363 to is_input_section. Don't permit input sections after sections
4364 are attached to segments. Don't call allocate_output_section.
4365 (Layout::layout_eh_frame): Call update_flags_for_input_section,
4366 not write_enable_output_section.
4367 (Layout::make_output_section): Don't push to
4368 unattached_section_list_ nor call attach_to_segment. Call
4369 attach_section_to_segment if sections are attached.
4370 (Layout::attach_sections_to_segments): New function.
4371 (Layout::attach_section_to_segment): New function.
4372 (Layout::attach_allocated_section_to_segment): Rename from
4373 attach_to_segment. Remove flags parameter.
4374 (Layout::allocate_output_section): Remove function.
4375 (Layout::write_enable_output_section): Remove function.
4376 * layout.h (class Layout): Update for above changes. Add new
4377 field sections_are_attached_.
4378 * output.h (Output_section::update_flags_for_input_section): New
4380 * output.cc (Output_section::add_input_section): Call
4381 update_flags_for_input_section.
4382 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4384 2008-04-11 Cary Coutant <ccoutant@google.com>
4386 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4387 thought unnecessary.
4388 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4390 2008-04-11 Ian Lance Taylor <iant@google.com>
4392 * output.h (class Output_section_data): Remove inline definition
4394 * output.cc (Output_section_data::set_addralign): New function.
4396 2008-04-11 Cary Coutant <ccoutant@google.com>
4398 Add support for TLS descriptors for i386 and x86_64.
4399 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4400 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4401 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4403 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4404 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4405 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4407 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4408 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4409 Fix problem with initial-exec relocations.
4410 (Target_i386::Relocate::relocate_tls): Likewise.
4411 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4413 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4414 support for section-plus-offset dynamic table entries.
4415 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4416 (Output_data_dynamic::Dynamic_entry): Add support for
4417 section-plus-offset dynamic table entries.
4418 (Output_data_dynamic::Classification): Likewise.
4419 (Output_data_dynamic::classification_): Renamed offset_.
4420 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4421 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4422 (Target_x86_64::make_plt_section): New function.
4423 (Target_x86_64::reserve_tlsdesc_entries): New function.
4424 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4425 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4426 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4427 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4428 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4429 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4430 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4431 add extra PLT entry for TLS descriptors.
4432 (Output_data_plt_x86_64::got_): New field.
4433 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4434 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4436 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4438 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4439 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4440 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4441 R_386_TLS_DESC_CALL relocations.
4442 (Target_x86_64::Scan::global): Likewise.
4443 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4444 for TLS descriptors.
4445 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4446 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4447 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4448 GD-to-IE relaxation.
4449 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4450 and TLS_DESCRIPTORS.
4451 * Makefile.in: Rebuild.
4452 * configure: Rebuild.
4453 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4454 (tls_test_shared2.so): New target.
4455 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4456 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4457 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4458 (tls_shared_gd_to_ie_test_LDADD): New variable.
4459 (tls_shared_gnu2_gd_to_ie_test): New target.
4460 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4462 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4463 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4464 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4465 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4466 (tls_shared_gnu2_test): New target.
4467 (tls_test_gnu2_shared.so): New target.
4468 (tls_shared_gnu2_test_SOURCES): New variable.
4469 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4470 (tls_shared_gnu2_test_LDFLAGS): New variable.
4471 (tls_shared_gnu2_test_LDADD): New variable.
4472 * testsuite/Makefile.in: Rebuild.
4473 * testsuite/Makefile.
4475 2008-04-11 Ian Lance Taylor <iant@google.com>
4477 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4479 * testsuite/Makefile.in: Rebuild.
4481 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4483 * testsuite/script_test_2.cc (main): Adjust test.
4485 2008-04-11 David S. Miller <davem@davemloft.net>
4486 Ian Lance Taylor <iant@google.com>
4488 * options.h (General_options): Add entries for '-Y' and
4490 * options.cc (General_options:finalize): If -Y was used, add those
4491 entries to the library path instead of the default "/lib" and
4494 2008-04-11 David S. Miller <davem@davemloft.net>
4496 * testsuite/justsyms.t: Start at 0x100.
4497 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
4498 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4500 * testsuite/script_test_2.cc: Adjust string and section length
4503 2008-04-09 Ian Lance Taylor <iant@google.com>
4506 * script-sections.cc (Sections_element::allocate_to_segment): Add
4508 (Output_section_definition::allocate_to_segment): Likewise.
4509 (Orphan_output_section::allocate_to_segment): Likewise.
4510 (Script_sections::attach_sections_using_phdrs_clause): Don't
4511 propagate non-PT_LOAD segments to orphan sections.
4512 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4513 readelf rather than objdump.
4514 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4515 .interp section and PT_INTERP segment are the same size.
4516 * testsuite/Makefile.in: Rebuild.
4518 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4519 aliases for symbols defined in the same object.
4520 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
4521 (weak_alias_test_SOURCES): New variable.
4522 (weak_alias_test_DEPENDENCIES): New variable.
4523 (weak_alias_test_LDFLAGS): New variable.
4524 (weak_alias_test_LDADD): New variable.
4525 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
4526 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
4527 (weak_alias_test_3.o): New target.
4528 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
4529 * testsuite/weak_alias_test_main.cc: New file.
4530 * testsuite/weak_alias_test_1.cc: New file.
4531 * testsuite/weak_alias_test_2.cc: New file.
4532 * testsuite/weak_alias_test_3.cc: New file.
4534 2008-04-08 Ian Lance Taylor <iant@google.com>
4536 * options.h (class General_options): Add --noinhibit-exec option.
4537 * main.cc (main): Check --noinhibit-exec.
4539 * options.h (class General_options): Define --wrap as a special
4540 option. Add wrap_symbols_ field.
4541 (General_options::any_wrap_symbols): New function.
4542 (General_options::is_wrap_symbol): New function.
4543 * options.cc (General_options::parse_wrap): New function.
4544 (General_options::General_options): Initialize wrap_symbols_.
4545 * symtab.cc (Symbol_table::wrap_symbol): New function.
4546 (Symbol_table::add_from_object): Handle --wrap.
4547 * symtab.h (class Symbol_table): Declare wrap_symbol.
4548 * target.h (Target::wrap_char): New function.
4549 (Target::Target_info): Add wrap_char field.
4550 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
4551 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4552 * testsuite/testfile.cc (Target_test::test_target_info):
4555 * errors.cc (Errors::undefined_symbol): Mention symbol version if
4558 * layout.h (class Layout): Add added_eh_frame_data_ field.
4559 * layout.cc (Layout::Layout): Initialize new field.
4560 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
4561 output section until we find a section we merged successfully.
4562 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
4563 that the size be non-zero.
4565 * merge.cc (Object_merge_map::get_output_offset): Remove inline
4568 2008-04-08 Craig Silverstein <csilvers@google.com>
4570 * configure.ac: Export new conditional variable HAVE_ZLIB.
4571 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
4573 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
4574 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4576 2008-04-07 Ian Lance Taylor <iant@google.com>
4578 * version.cc (version_string): Set to "1.5".
4580 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
4581 Add issued_non_pic_error_ field. Declare check_non_pic.
4582 (Target_x86_64::Scan::check_non_pic): New function.
4583 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
4584 (Target_x86_64::Scan::global): Likewise.
4586 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
4587 addend parameter. Change caller. Handle merge sections.
4588 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
4589 Address to Addend. Don't add in the result of
4590 local_section_offset, pass down the addend and use the returned
4592 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
4593 Update declarations of local_section_offset and symbol_value.
4594 * testsuite/two_file_test_1.cc (t18): New function.
4595 * testsuite/two_file_test_2.cc (f18): New function.
4596 * testsuite/two_file_test_main.cc (main): Call t18.
4597 * testsuite/two_file_test.h (t18, f18): Declare.
4599 * configure.ac: Don't test for objdump, c++filt, or readelf.
4600 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
4602 (TEST_READELF): New variable.
4603 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
4604 (check_PROGRAMS): Add two_file_strip_test.
4605 (two_file_strip_test): New target.
4606 (check_PROGRAMS): Add two_file_same_shared_strip_test.
4607 (two_file_same_shared_strip_test_SOURCES): New variable.
4608 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
4609 (two_file_same_shared_strip_test_LDFLAGS): New variable.
4610 (two_file_same_shared_strip_test_LDADD): New variable.
4611 (two_file_shared_strip.so): New target.
4612 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
4613 (ver_test_5.syms, ver_test_7.syms): Likewise.
4614 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
4615 (strip_test_3.stdout): Use TEST_OBJDUMP.
4616 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4618 2008-04-04 Cary Coutant <ccoutant@google.com>
4620 * symtab.h (Symbol::is_weak_undefined): New function.
4621 (Symbol::is_strong_undefined): New function.
4622 (Symbol::is_absolute): New function.
4623 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
4624 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
4626 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
4627 (weak_undef_test): New target.
4628 * testsuite/Makefile.in: Rebuild.
4629 * testsuite/weak_undef_file1.cc: New file.
4630 * testsuite/weak_undef_file2.cc: New file.
4631 * testsuite/weak_undef_test.cc: New file.
4633 2008-04-03 Craig Silverstein <csilvers@google.com>
4635 * compressed_output.h (class Output_compressed_section): Use
4637 * compressed_output.cc (zlib_compress): Use unsigned buffers,
4639 (zlib_compressed_suffix): Removed.
4640 (Output_compressed_section::set_final_data_size): Use unsigned
4642 * testsuite/Makefile.am (flagstest_compress_debug_sections):
4643 Fix linker invocation.
4644 (flagstest_o_specialfile_and_compress_debug_sections):
4646 * testsuite/Makefile.in: Regenerated.
4648 2008-04-02 David S. Miller <davem@davemloft.net>
4650 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
4651 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
4653 2008-04-02 Craig Silverstein <csilvers@google.com>
4657 2008-04-02 Ian Lance Taylor <iant@google.com>
4659 * fileread.cc (File_read::find_view): Add byteshift and vshifted
4660 parameters. Update for new key type to views_. Change all
4662 (File_read::read): Adjust for byteshift in returned view.
4663 (File_read::add_view): New function, broken out of
4665 (File_read::make_view): New function, broken out of
4667 (File_read::find_or_make_view): Add offset and aligned
4668 parameters. Rewrite accordingly. Change all callers.
4669 (File_read::get_view): Add offset and aligned parameters. Adjust
4670 for byteshift in return value.
4671 (File_read::get_lasting_view): Likewise.
4672 * fileread.h (class File_read): Update declarations.
4673 (class File_read::View): Add byteshift_ field. Add byteshift to
4674 constructor. Add byteshift method.
4675 * archive.h (Archive::clear_uncached_views): New function.
4676 (Archive::get_view): Add aligned parameter. Change all callers.
4677 * object.h (Object::get_view): Add aligned parameter. Change all
4679 (Object::get_lasting_view): Likewise.
4681 * fileread.cc (File_read::release): Don't call clear_views if
4682 there are multiple objects.
4683 * fileread.h (File_read::clear_uncached_views): New function.
4684 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
4687 2008-03-31 Cary Coutant <ccoutant@google.com>
4689 Add thin archive support.
4690 * archive.cc (Archive::armagt): New const.
4691 (Archive::setup): Remove task parameter and calls to unlock.
4692 (Archive::unlock_nested_archives): New function.
4693 (Archive::read_header): Add nested_off parameter. Change
4695 (Archive::interpret_header): Likewise.
4696 (Archive::include_all_members): Change to handle thin
4698 (Archive::include_member): Likewise.
4699 * archive.h (Archive::Archive): Add new parameters and
4701 (Archive::armagt): New const.
4702 (Archive::setup): Remove task parameter.
4703 (Archive::unlock_nested_archives): New function.
4704 (Archive::read_header): Add nested_off parameter.
4705 (Archive::interpret_header): Likewise.
4706 (Archive::Nested_archive_table): New typedef.
4707 (Archive::is_thin_archive_): New field.
4708 (Archive::nested_archives_): New field.
4709 (Archive::options_): New field.
4710 (Archive::dirpath_): New field.
4711 (Archive::task_): New field.
4712 * readsyms.cc (Read_symbols::do_read_symbols): Add check
4713 for thin archives. Pass additional parameters to
4714 Archive::Archive. Unlock the archive file after calling
4717 2008-03-29 Ian Lance Taylor <iant@google.com>
4719 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
4720 version symbol to be local.
4721 * testsuite/ver_test_4.sh: New file.
4722 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
4723 (check_DATA): Add ver_test_4.syms.
4724 (ver_test_4.syms): New target.
4725 * testsuite/Makefile.in: Rebuild.
4728 (Output_section::Input_section_sort_entry::has_priority): New
4730 (Output_section::Input_section_sort_entry::match_file_name): New
4732 (Output_section::Input_section_sort_entry::match_section_name):
4734 (Output_section::Input_section_sort_entry::match_section_name_prefix):
4736 (Output_section::Input_section_sort_entry::match_section_file):
4738 (Output_section::Input_section_sort_compare::operator()): Rewrite
4739 using new Input_section_sort_entry functions. Sort crtbegin and
4740 crtend first. Sort sections with no priority before sections with
4742 * testsuite/initpri1.c (d3): Check j != 4.
4743 (cd5): New constructor/destructor function.
4744 (main): Check j != 2.
4746 * symtab.cc (Symbol_table::add_from_object): If we don't use the
4747 new symbol when resolving, don't call set_is_default.
4748 * testsuite/ver_test_7.cc: New file.
4749 * testsuite/ver_test_7.sh: New file.
4750 * testsuite/Makefile.am (ver_test_7.so): New target.
4751 (ver_test_7.o): New target.
4752 (check_SCRIPTS): Add ver_test_7.sh.
4753 (check_DATA): Add ver_test_7.syms.
4754 (ver_test_7.syms): New target.
4756 2008-03-28 Ian Lance Taylor <iant@google.com>
4758 * layout.cc (Layout::layout): If we see an input section with a
4759 name that needs sorting, set the must_sort flag for the output
4761 (Layout::make_output_section): If the name of the output section
4762 indicates that it might require sorting, set the may_sort flag.
4763 * output.h (Output_section::may_sort_attached_input_sections): New
4765 (Output_section::set_may_sort_attached_input_sections): New
4767 (Output_section::must_sort_attached_input_sections): New
4769 (Output_section::set_must_sort_attached_input_sections): New
4771 (class Output_section): Declare Input_section_sort_entry. Define
4772 Input_section_sort_compare. Declare
4773 sort_attached_input_sections. Add new fields:
4774 may_sort_attached_input_sections_,
4775 must_sort_attached_input_sections_,
4776 attached_input_sections_are_sorted_.
4777 * output.cc (Output_section::Output_section): Initialize new
4779 (Output_section::add_input_section): Add an entry to
4780 input_sections_ if may_sort or must_sort are true.
4781 (Output_section::set_final_data_size): Call
4782 sort_attached_input_sections if necessary.
4783 (Output_section::Input_section_sort_entry): Define new class.
4784 (Output_section::Input_section_sort_compare::operator()): New
4786 (Output_section::sort_attached_input_sections): New function.
4787 * configure.ac: Check whether the compiler supports constructor
4788 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
4789 * testsuite/initpri1.c: New file.
4790 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
4791 CONSTRUCTOR_PRIORITY.
4792 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
4793 (initpri1_LDFLAGS): New variable.
4794 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4796 2008-03-27 Ian Lance Taylor <iant@google.com>
4798 * common.cc (Sort_commons::operator): Correct sorting algorithm.
4799 * testsuite/common_test_1.c: New file.
4800 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
4801 (common_test_1_SOURCES): New variable.
4802 (common_test_1_DEPENDENCIES): New variable.
4803 (common_test_1_LDFLAGS): New variable.
4805 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
4806 and commons_ correctly when NAME/VERSION does not override
4808 * testsuite/ver_test_6.c: New file.
4809 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
4810 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
4811 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
4813 2008-03-26 Ian Lance Taylor <iant@google.com>
4815 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
4816 of an undefined symbol from a version script.
4817 * testsuite/Makefile.am (ver_test_5.so): New target.
4818 (ver_test_5.o): New target.
4819 (check_SCRIPTS): Add ver_test_5.sh.
4820 (check_DATA): Add ver_test_5.syms.
4821 (ver_test_5.syms): New target.
4822 * testsuite/ver_test_5.cc: New file.
4823 * testsuite/ver_test_5.script: New file.
4824 * testsuite/ver_test_5.sh: New file.
4825 * Makefile.in, testsuite/Makefile.in: Rebuild.
4828 Fix problems building gold with gcc 4.3.0.
4829 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
4830 (gold_error_at_location, gold_warning_at_location): Use it.
4831 * configure.ac: Check whether we can compile and use a template
4832 function with a printf attribute.
4833 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
4834 when jumping over bytes.
4835 * object.cc: Instantiate Object::read_section_data.
4836 * debug.h: Include <cstring>
4837 * dwarf_reader.cc: Include <algorithm>
4838 * main.cc: Include <cstring>.
4839 * options.cc: Include <cstring>.
4840 * output.cc: Include <cstring>.
4841 * script.cc: Include <cstring>.
4842 * script.h: Include <string>.
4843 * symtab.cc: Include <cstring> and <algorithm>.
4844 * target-select.cc: Include <cstring>.
4845 * version.cc: Include <string>.
4846 * testsuite/testmain.cc: Include <cstdlib>.
4847 * configure, config.in: Rebuild.
4849 2008-03-25 Ian Lance Taylor <iant@google.com>
4851 * options.cc: Include "../bfd/bfdver.h".
4852 (options::help): Print bug reporting address.
4854 * version.cc (print_version): Adjust output for current value of
4859 * options.cc (options::help): Print list of supported targets.
4860 * target-select.h: Include <vector>.
4861 (class Target_selector): Make machine_, size_, and is_big_endian_
4862 fields const. Add bfd_name_ and instantiated_target_ fields.
4863 (Target_selector::Target_selector): Add bfd_name parameter.
4864 (Target_selector::recognize): Make non-virtual, call
4866 (Target_selector::recognize_by_name): Make non-virtual, call
4867 do_recognize_by_name.
4868 (Target_selector::supported_names): New function.
4869 (Target_selector::bfd_name): New function.
4870 (Target_selector::do_instantiate_target): New pure virtual
4872 (Target_selector::do_recognize): New virtual function.
4873 (Target_selector::do_recognize_by_name): New virtual function.
4874 (Target_selector::instantiate_target): New private function.
4875 (supported_target_names): Declare.
4876 * target-select.cc (Target_selector::Target_selector): Update for
4877 new parameter and fields.
4878 (select_target_by_name): Check that the name matches before
4879 calling recognize_by_name.
4880 (supported_target_names): New function.
4881 * i386.cc (class Target_selector_i386): Update Target_selector
4882 constructor call. Remove recognize and recognize_by_name. Add
4883 do_instantiate_target.
4884 * x86_64.cc (class Target_selector_x86_64): Likewise.
4885 * testsuite/testfile.cc (class Target_selector_test): Update for
4886 changes to Target_selector.
4888 * README: Rewrite, with some notes on unsupported features.
4890 2008-03-24 Cary Coutant <ccoutant@google.com>
4892 * i386.cc (Target_i386::Got_type): New enum declaration.
4893 (Target_i386::Scan::local): Updated callers of Output_data_got
4895 (Target_i386::Scan::global): Likewise.
4896 (Target_i386::Relocate::relocate): Likewise.
4897 (Target_i386::Relocate::relocate_tls): Likewise.
4898 * object.h (Got_offset_list): New class.
4899 (Sized_relobj::local_has_got_offset): Added got_type parameter.
4900 (Sized_relobj::local_got_offset): Likewise.
4901 (Sized_relobj::set_local_got_offset): Likewise.
4902 (Sized_relobj::local_has_tls_got_offset): Removed.
4903 (Sized_relobj::local_tls_got_offset): Removed.
4904 (Sized_relobj::set_local_tls_got_offset): Removed.
4905 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
4906 * output.cc (Output_data_got::add_global): Added got_type parameter.
4907 (Output_data_got::add_global_with_rel): Likewise.
4908 (Output_data_got::add_global_with_rela): Likewise.
4909 (Output_data_got::add_global_pair_with_rel): New function.
4910 (Output_data_got::add_global_pair_with_rela): New function.
4911 (Output_data_got::add_local): Added got_type parameter.
4912 (Output_data_got::add_local_with_rel): Likewise.
4913 (Output_data_got::add_local_with_rela): Likewise.
4914 (Output_data_got::add_local_pair_with_rel): New function.
4915 (Output_data_got::add_local_pair_with_rela): New function.
4916 (Output_data_got::add_global_tls): Removed.
4917 (Output_data_got::add_global_tls_with_rel): Removed.
4918 (Output_data_got::add_global_tls_with_rela): Removed.
4919 (Output_data_got::add_local_tls): Removed.
4920 (Output_data_got::add_local_tls_with_rel): Removed.
4921 (Output_data_got::add_local_tls_with_rela): Removed.
4922 * output.h (Output_data_got::add_global): Added got_type parameter.
4923 (Output_data_got::add_global_with_rel): Likewise.
4924 (Output_data_got::add_global_with_rela): Likewise.
4925 (Output_data_got::add_global_pair_with_rel): New function.
4926 (Output_data_got::add_global_pair_with_rela): New function.
4927 (Output_data_got::add_local): Added got_type parameter.
4928 (Output_data_got::add_local_with_rel): Likewise.
4929 (Output_data_got::add_local_with_rela): Likewise.
4930 (Output_data_got::add_local_pair_with_rel): New function.
4931 (Output_data_got::add_local_pair_with_rela): New function.
4932 (Output_data_got::add_global_tls): Removed.
4933 (Output_data_got::add_global_tls_with_rel): Removed.
4934 (Output_data_got::add_global_tls_with_rela): Removed.
4935 (Output_data_got::add_local_tls): Removed.
4936 (Output_data_got::add_local_tls_with_rel): Removed.
4937 (Output_data_got::add_local_tls_with_rela): Removed.
4938 * resolve.cc (Symbol::override_base_with_special): Removed
4939 reference to has_got_offset_ field.
4940 * symtab.cc (Symbol::init_fields): Replaced initialization
4941 of got_offset_ with got_offsets_. Removed initialization
4943 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
4944 (Symbol::got_offset): Likewise.
4945 (Symbol::set_got_offset): Likewise.
4946 (Symbol::has_tls_got_offset): Removed.
4947 (Symbol::tls_got_offset): Removed.
4948 (Symbol::set_tls_got_offset): Removed.
4949 (Symbol::got_offset_): Removed.
4950 (Symbol::tls_mod_got_offset_): Removed.
4951 (Symbol::tls_pair_got_offset_): Removed.
4952 (Symbol::got_offsets_): New field.
4953 (Symbol::has_got_offset): Removed.
4954 (Symbol::has_tls_mod_got_offset): Removed.
4955 (Symbol::has_tls_pair_got_offset): Removed.
4956 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
4957 (Target_x86_64::Scan::local): Updated callers of Output_data_got
4959 (Target_x86_64::Scan::global): Likewise.
4960 (Target_x86_64::Relocate::relocate): Likewise.
4961 (Target_x86_64::Relocate::relocate_tls): Likewise.
4963 2008-03-25 Ben Elliston <bje@au.ibm.com>
4965 * yyscript.y: Fix spelling error in comment.
4967 2008-03-24 Ian Lance Taylor <iant@google.com>
4969 * options.h (class General_options): Define build_id option.
4970 * layout.h (class Layout): Declare write_build_id, create_note,
4971 create_build_id. Add build_id_note_ member.
4972 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
4973 "libiberty.h", "md5.h", "sha1.h".
4974 (Layout::Layout): Initialize eh_frame_data_,
4975 eh_frame_hdr_section_, and build_id_note_.
4976 (Layout::finalize): Call create_build_id.
4977 (Layout::create_note): New function, broken out of
4978 Layout::create_gold_note.
4979 (Layout::create_gold_note): Call create_note.
4980 (Layout::create_build_id): New function.
4981 (Layout::write_build_id): New function.
4982 (Close_task_runner::run): Call write_build_id.
4984 * x86_64.cc: Correct license to GPLv3.
4986 2008-03-23 Ian Lance Taylor <iant@google.com>
4988 * options.cc: Include "demangle.h".
4989 (parse_optional_string): New function.
4990 (parse_long_option): Handle takes_optional_argument.
4991 (parse_short_option): Update dash_z initializer. Handle
4992 takes_optional_argument.
4993 (General_options::General_options): Initialize do_demangle_.
4994 (General_options::finalize): Set do_demangle_. Handle demangling
4996 * options.h (parse_optional_string): Declare.
4997 (struct One_option): Add optional_arg field. Update constructor.
4998 Update call constructor calls. Add takes_optional_argument
5000 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
5001 (DEFINE_optional_string): Define.
5002 (General_options::demangle): Change from DEFINE_bool to
5003 DEFINE_optional_string.
5004 (General_options::no_demangle): New function.
5005 (General_options::do_demangle): New function.
5006 (General_options::set_do_demangle): New function.
5007 (General_options::execstack_status_): Move definition to end of
5009 (General_options::static_): Likewise.
5010 (General_options::do_demangle_): New field.
5011 * object.cc (big_endian>::get_symbol_location_info): Call
5012 Options::do_demangle, not Options::demangle.
5013 * symtab.cc (demangle): Likewise.
5015 2008-03-22 Ian Lance Taylor <iant@google.com>
5017 * gold.h: Include <cstddef> and <sys/types.h>
5018 * options.h: Include <cstring>.
5020 2008-03-21 Ian Lance Taylor <iant@google.com>
5022 * Added source code to GNU binutils.