1 2009-12-10 Doug Kwan <dougkwan@google.com>
3 * arm.cc (attributes.h): New include.
4 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5 (Arm_relobj::~Arm_relobj): Delete object pointed by
6 attributes_section_data_.
7 (Arm_relobj::attributes_section_data): New method definition.
8 (Arm_relobj::attributes_section_data_): New data member declaration.
9 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11 attributes_section_data_.
12 (Arm_dynobj::attributes_section_data): New method definition.
13 (Arm_dynobj::attributes_section_data_): New data member declaration.
14 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
15 initialization value of may_use_blx_ to false.
16 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
17 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
18 object attributes to compute results instead of hard-coding.
19 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
20 Target_arm::get_secondary_compatible_arch,
21 Target_arm::set_secondary_compatible_arch
22 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
23 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
24 New method declarations.
25 (Target_arm::get_aeabi_object_attribute): New method definition.
26 (Target_arm::attributes_section_data_): New data member declaration.
27 (read_arm_attributes_section): New template definition.
28 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
29 (Arm_dynobj::do_read_symbols): Ditto.
30 (Target_arm::do_finalize_sections): Merge attributes sections from
31 input. Check for BLX use after attributes section merging.
32 Fix __exidx_start and __exidx_end visibility. Create an
33 .ARM.attributes section if necessary.
34 (Target_arm::get_secondary_compatible_arch,
35 Target_arm::set_secondary_compatible_arch,
36 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
37 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
38 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
39 New method definitions.
41 2009-12-09 Ian Lance Taylor <iant@google.com>
43 * plugin.cc (Plugin::load): Don't cast from void* to a function
46 2009-12-09 Ian Lance Taylor <iant@google.com>
48 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
51 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
53 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
54 Replace two_file_shared_1.so with two_file_shared_2.so.
55 * testsuite/Makefile.in: Regenerated.
57 2009-12-08 Doug Kwan <dougkwan@google.com>
59 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
60 (HFILES): Add attributes.h and int_encoding.h.
61 * Makefile.in: Regenerate.
62 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
63 function definitions to int_encoding.cc
64 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
65 prototypes to int_encoding.h
66 * reduced_debug_output.cc (int_encoding.h): New include.
67 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
68 function definitions to int_encoding.cc
69 (insert_into_vector, read_from_pointer): Move template definitions to
71 * attributes.cc: New file.
72 * attributes.h: New file.
73 * int_encoding.cc: New file.
74 * int_encoding.h: New file.
76 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
79 * incremental-dump.cc (dump_incremental_inputs): New.
80 (main): Use dump_incremental_inputs.
82 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
85 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
86 checking elfcpp::STT_FUNC.
87 (Target_i386::Relocate::relocate): Likewise.
88 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
90 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
91 symbols from shared libraries into normal FUNC symbols.
93 * symtab.h (Symbol): Add is_func and use it.
95 2009-12-05 Doug Kwan <dougkwan@google.com>
97 * arm.cc (Target_arm::arm_info): Initialize new fields
98 attributes_section and attributes_vendor.
99 * i386.cc (Target_i386::i386_info): Same.
100 * object.cc (Sized_relobj::do_layout): Skip attribute section.
101 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
102 fields attributes_section and attributes_vendor.
103 * sparc.cc (Target_sparc::sparc_info): Same.
104 * target.h (Target::attributes_section, Target::attributes_vendor,
105 Target::is_attributes_section, Target::attribute_arg_type,
106 Target::attributes_order): New method definitions.
107 (Target::Target_info::attributes_section,
108 Target::Target_info::attributes_vendor): New fields.
109 (Target::do_attribute_arg_type, Target::do_attributes_order): New
110 virtual method definitions.
111 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
112 attributes_section and attributes_vendor.
113 * testsuite/testfile.cc (Target_test::test_target_info): Same.
115 2009-12-05 Doug Kwan <dougkwan@google.com>
117 * arm.cc: Update comments about interworking and stub generation.
118 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
119 considered as non-PIC.
120 (Arm_relocate_functions::base_abs): Fix formatting.
121 (Arm_relocate_functions::got_prel): Fix comment. Change interface
122 of function to use GOT entry address instead of offset.
123 (Target_arm::Scan::global): Issue an error if a symbol would need a
124 PLT does not get one because it is untyped. Remove code to create
125 dynamic symbols for relative branches.
126 (Target_arm::Relocate::relocate: Use 0 instead of false since function
127 takes unsigned integer instead of boolean.
129 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
131 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
132 (two_file_test_LDADD): Likewise.
133 (common_test_1_LDADD): Likewise.
134 (exception_test_LDADD) Likewise.
135 (weak_test_LDADD): Likewise.
136 (many_sections_test_LDADD): Likewise.
137 (initpri1_LDADD): Likewise.
138 (script_test_1_LDADD): Likewise.
139 (script_test_2_LDADD): Likewise.
140 (justsyms_LDADD): Likewise.
141 (binary_test_LDADD): Likewise.
142 (large_LDADD): Likewise.
143 * testsuite/Makefile.in: Regenerated.
145 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
147 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
148 (Symbol_table::override_with_special): Likewise.
149 (Symbol_table::add_from_object): Likewise.
151 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
153 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
154 Don't set the data_offset twice.
156 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
158 * testsuite/Makefile.in: Regenerate.
160 2009-12-03 Doug Kwan <dougkwan@google.com>
162 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
163 (Target_arm::do_finalize_sections): Add parameter for symbol table
164 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
165 * i386.cc (Target_i386::do_finalize_sections): Add an additional
166 parameter for symbol table pointer.
167 * layout.cc (Layout::finalize): Call Target::finalize_sections with
168 an additional parameter for a pointer to symbol table.
169 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
170 parameter for a symbol table pointer.
171 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
172 * target.h (Target::finalize_sections, Target::do_finalize_sections):
174 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
175 parameter for a symbol table pointer.
177 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
179 * incremental.cc (Incremental_inputs_header)
180 (Incremental_inputs_header_write, Incremental_inputs_entry)
181 (Incremental_inputs_entry_write): Move ...
182 * incremental.h (Incremental_inputs_header)
183 (Incremental_inputs_header_write, Incremental_inputs_entry)
184 (Incremental_inputs_entry_write): here.
186 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
188 * incremental.cc (make_sized_incremental_binary): Set the target.
189 Error if it is incompatible.
190 * output.h (Output_file): Add filename method.
192 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
194 * incremental.cc (Incremental_inputs_entry): Remove unused argument
195 from the get_* methods.
197 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
199 * incremental-dump.cc (main): Check that the offeset of a script is 0.
200 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
201 Write 0 for the data_offset of scripts.
203 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
205 * testsuite/Makefile.am: Add the incremental_test.sh test.
206 * testsuite/incremental_test.sh: New.
207 * testsuite/incremental_test_1.c: New.
208 * testsuite/incremental_test_2.c: New.
210 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
212 * incremental-dump.cc (main): Fix typos.
214 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
217 * incremental-dump.cc (main): Use llu to print 64 bit values.
219 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
220 H.J. Lu <hongjiu.lu@intel.com>
222 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
224 (incremental_dump_LDADD): Likewise.
225 * Makefile.in: Regenerated.
227 2009-11-25 Doug Kwan <dougkwan@google.com>
231 2009-11-25 Doug Kwan <dougkwan@google.com>
233 * arm.cc (Target_arm::Target_arm): Move method definition
234 outside of class definition. Add code to handle
235 --target1-rel, --target1-abs and --target2= options.
236 (Target_arm::get_reloc_reloc_type): Change method to be
237 non-static and const.
238 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
239 New data member declaration.
240 (Target_arm::Scan::local, Target_arm::Scan::global,
241 Target_arm::Relocate::relocate,
242 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
243 Adjust call to Target_arm::get_real_reloc_type.
244 (Target_arm::get_real_reloc_type): Use command line options
245 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
246 * options.h (--target1-rel, --target1-abs, --target2): New
249 2009-11-25 Doug Kwan <dougkwan@google.com>
251 * arm.cc (Target_arm::Target_arm): Move method definition outside of
252 class definition. Add code to handle --target1-rel, --target1-abs
253 and --target2= options.
254 (Target_arm::get_reloc_reloc_type): Change method to be non-static
256 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
258 (Target_arm::Scan::local, Target_arm::Scan::global,
259 Target_arm::Relocate::relocate,
260 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
261 call to Target_arm::get_real_reloc_type.
262 (Target_arm::get_real_reloc_type): Use command line options to
263 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
264 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
267 2009-11-25 Doug Kwan <dougkwan@google.com>
269 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
270 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
271 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
273 (Arm_relocate_functions::thm_call): Replace body with a call to
274 Arm_relocate_functions::thumb_branch_common.
275 (Arm_relocate_functions::thm_jump24,
276 Arm_relocate_functions::thm_xpc22): New method definitions.
277 (Arm_relocate_functions::thumb_branch_common): New method definition.
278 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
280 (Target_arm::Relocate::relocate): Adjust call to thm_call.
281 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
283 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
285 * Makefile.am: Build incremental-dump
286 * Makefile.in: Regenerate.
287 * incremental-dump.cc: New.
288 * incremental.cc (Incremental_inputs_header_data,
289 Incremental_inputs_entry_data): Move to incremental.h
290 * incremental.h: (Incremental_inputs_header_data,
291 Incremental_inputs_entry_data): Move from incremental.cc
293 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
295 * incremental.cc (Incremental_inputs_header,
296 Incremental_inputs_header_write, Incremental_inputs_entry,
297 Incremental_inputs_entry_write): Add a typedef with the data type.
299 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
301 * incremental.cc (Incremental_inputs_header,
302 Incremental_inputs_header_write, Incremental_inputs_entry,
303 Incremental_inputs_entry_write): Update comment about which
304 type has the filed descriptions.
306 2009-11-15 Doug Kwan <dougkwan@google.com>
308 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
309 (Arm_relocate_functions::arm_branch_common): Change method defintion
310 in class definition to a method declaration and update list of formal
312 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
313 Arm_relocation_functions::jump24): Adjust call to
314 Arm_relocate_functions::arm_branch_common. Update list of formal
316 (Arm_relocate_functions::xpc25): New method definition.
317 (Arm_relocate_functions::arm_branch_common): Move method defintion
318 out from class definition. Use stubs for mode-switching and extending
320 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
321 specially. Change code to enable use of stubs in ARM branches.
323 2009-11-10 Doug Kwan <dougkwan@google.com>
325 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
326 in method declaration.
327 (Target_arm::relocate_stub): New method declaration.
328 (Target_arm::default_target): Change to return a pointer instead of
330 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
331 Target_arm::default_target.
332 (Arm_Relobj::do_relocate_sections): Remove options paramater in
334 (Target_arm::relocate_section): Adjust view.
335 (Target_arm::relocate_stub): New method definition.
337 2009-11-10 Doug Kwan <dougkwan@google.com>
339 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
341 * incremental.cc (open_incremental_binary): Initialized local
342 variables to avoid warnings.
343 * object.cc (make_elf_object): Ditto.
344 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
347 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
350 * testsuite/plugin_test.c: Include "config.h".
352 2009-11-09 Doug Kwan <dougkwan@google.com>
354 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
355 (arm_symbol_value): Remove.
356 (Arm_relocate_functions::arm_branch_common,
357 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
358 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
359 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
360 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
361 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
362 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
363 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
364 Arm_relocate_functions::thm_mobw_abs_nc,
365 Arm_relocate_functions::thm_mov_abs,
366 Arm_relocate_functions::movw_prel_nc,
367 Arm_relocate_functions::thm_movt_abs,
368 Arm_relocate_functions::movt_prel,
369 Arm_relocate_functions::thm_movw_prel_nc,
370 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
371 (Target_arm::Relocate::relocate): Only decompose address into two
372 parts if relocation type uses the thumb-bit and pass the actual
373 bit instead of a flag indicating that the thumb-bit is used. Adjust
374 calls to methods in Arm_relocate_functions for this change.
376 2009-11-08 Ian Lance Taylor <iant@google.com>
379 * reloc.cc: Instantiate
380 Sized_relobj::initialize_input_to_output_maps and
381 Sized_relobj:free_input_to_output_maps.
383 2009-11-06 Ian Lance Taylor <iant@google.com>
386 * defstd.cc (in_segment): Set only_if_ref true for "end".
388 2009-11-06 Doug Kwan <dougkwan@google.com>
390 * arm.cc (class Reloc_stub): Correct a comment.
391 (Target_arm::Target_arm): Initialize arm_input_section_map_.
392 (Target_arm::scan_section_for_stubs): New method declaration.
393 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
394 Change methods from private to protected.
395 (Target_arm::do_may_relax): New method definition.
396 (Target_arm::do_relax, Target_arm::group_sections,
397 Target_arm::scan_reloc_for_stub,
398 Target_arm::scan_reloc_section_for_stubs): New method declarations.
399 (Target_arm::arm_input_section_map_): New data member declaration.
400 (Target_arm::scan_reloc_for_stub,
401 Target_arm::scan_reloc_section_for_stubs,
402 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
403 Target_arm::do_relax): New method definitions.
405 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
407 * configure.ac: Check for (struct stat)::st_mtim
408 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
409 * config.in: Regenerate.
410 * configure: Regenerate.
412 2009-11-05 Ian Lance Taylor <iant@google.com>
415 * output.cc (Output_segment::add_output_section): Add missing
418 2009-11-04 Ian Lance Taylor <iant@google.com>
421 * object.h (class Object): Add is_needed and set_is_needed
422 methods. Add is_needed_ field. Make bool fields into bitfields.
423 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
424 defined in a dynamic object and referenced by a regular object,
425 set is_needed for the dynamic object.
426 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
427 if the file is marked with as_needed and it is not needed.
429 2009-11-04 Ian Lance Taylor <iant@google.com>
432 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
433 tags if data is discarded by linker script.
434 * i386.cc (Target_i386::do_finalize_sections): Likewise.
435 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
436 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
437 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
439 2009-11-04 Ian Lance Taylor <iant@google.com>
441 * layout.cc (Layout::get_output_section): Add is_interp and
442 is_dynamic_linker_section parameters. Change all callers.
443 (Layout::choose_output_section): Likewise.
444 (Layout::make_output_section): Likewise.
445 (Layout::add_output_section_data): Add is_dynamic_linker_section
446 parameter. Change all callers.
447 * layout.h (class Layout): Update declarations.
448 * output.h (class Output_section): Add is_interp, set_is_interp,
449 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
450 Add is_interp_, is_dynamic_linker_section_ fields. Change
451 generate_code_fills_at_write_ to a bitfield.
452 * output.cc (Output_section::Output_sections): Initialize new
454 (Output_segment::add_output_section): Add do_sort parameter.
457 2009-11-03 Ian Lance Taylor <iant@google.com>
460 * options.h (class General_options): Add --warn-common.
461 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
462 merging two common symbols.
463 (Symbol_table::should_override): Handle --warn-common when merging
464 a common symbol with a defined symbol. Use report_resolve_problem
465 for multiple definitions.
466 (Symbol_table::report_resolve_problem): New function.
467 * symtab.h (class Symbol_table): Declare report_resolve_problem.
469 2009-11-03 Doug Kwan <dougkwan@google.com>
471 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
473 (Target_arm::stub_factory): New method definition.
474 (Target_arm::new_arm_input_section,
475 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
476 Target_arm::reloc_uses_thumb_bit): New method declarations.
477 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
478 New type definitions.
479 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
481 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
482 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
483 New method definitions.
485 2009-11-03 Ian Lance Taylor <iant@google.com>
487 * options.h (class General_options): Add --warn_constructors.
489 2009-11-03 Ian Lance Taylor <iant@google.com>
492 * defstd.cc (in_section): Add entries for __rel_iplt_start,
493 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
495 2009-11-03 Ian Lance Taylor <iant@google.com>
498 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
499 --msgid-bugs-address.
500 (install-pdf): New target.
501 (install-data_yes): Look up one directory to find mkinstalldirs.
503 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
505 * po/Make-in (.po.gmo): Don't generate .gmo files in source
508 2009-10-30 Doug Kwan <dougkwan@google.com>
510 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
512 2009-10-30 Doug Kwan <dougkwan@google.com>
514 * arm.cc (Stub_addend_reader): New struct template definition
515 and partial specializations.
516 (Stub_addend_reader::operator()): New method definition for a
517 partially specialized template.
519 2009-10-30 Doug Kwan <dougkwan@google.com>
521 * arm.cc (Arm_relobj::processor_specific_flags): New method
523 (Arm_relobj::do_read_symbols): New method declaration.
524 (Arm_relobj::processor_specific_flags_): New data member declaration.
525 (Arm_dynobj): New class definition.
526 (Target_arm::do_finalize_sections): Add input_objects parameter.
527 (Target_arm::do_adjust_elf_header): New method declaration.
528 (Target_arm::are_eabi_versions_compatible,
529 (Target_arm::merge_processor_specific_flags): New method declaration.
530 (Target_arm::do_make_elf_object): New overloaded method definitions
532 (Arm_relobj::do_read_symbols): New method definition.
533 (Arm_dynobj::do_read_symbols): Ditto.
534 (Target_arm::do_finalize_sections): Add input_objects parameters.
535 Merge processor-specific flags from all input objects.
536 (Target_arm::are_eabi_versions_compatible,
537 Target_arm::merge_processor_specific_flags,
538 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
539 New method definitions.
540 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
541 Input_objects pointer type parameter.
542 * layout.cc (Layout::finalize): Pass input objects to target's.
543 finalize_sections function.
544 * output.cc (Output_file_header::do_sized_write): Set ELF file
545 header's processor-specific flags.
546 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
547 Input_objects pointer type parameter.
548 * sparc.cc (Target_sparc::do_finalize_sections): Same.
549 * target.h (Input_objects): New forward class declaration.
550 (Target::processor_specific_flags,
551 Target::are_processor_specific_flags_sect): New method definitions.
552 (Target::finalize_sections): Add input_objects parameter.
553 (Target::Target): Initialize processor_specific_flags_ and
554 are_processor_specific_flags_set_.
555 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
557 (Target::set_processor_specific_flags): New method definition.
558 (Target::processor_specific_flags_,
559 Target::are_processor_specific_flags_set_): New data member
561 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
562 Input_objects pointer type parameter.
564 2009-10-30 Doug Kwan <dougkwan@google.com>
566 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
568 2009-10-28 Ian Lance Taylor <iant@google.com>
570 * object.h (class Relobj): Drop options parameter from
571 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
572 do_scan_relocs, do_relocate. Change all callers.
573 (class Sized_relobj): Drop options parameters from
574 do_gc_process_relocs, do_scan_relocs, do_relocate,
575 do_relocate_sections, relocate_sections, emit_relocs_scan,
576 emit_relocs_scan_reltype. Change all callers.
577 (struct Relocate_info): Remove options field and all references to
579 * reloc.h (class Read_relocs): Remove options constructor
580 parameter and options_ field. Change all callers.
581 (class Gc_process_relocs, class Scan_relocs): Likewise.
582 (class Relocate_task): Likewise.
583 * target-reloc.h (scan_relocs): Remove options parameter. Change
585 (scan_relocatable_relocs): Likewise.
586 * target.h (class Sized_target): Remove options parameter from
587 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
589 * gc.h (gc_process_relocs): Remove options parameter. Change all
591 * arm.cc: Update functions to remove options parameters.
593 * powerpc.cc: Likewise.
594 * sparc.cc: Likewise.
595 * x86_64.cc: Likewise.
596 * testsuite/testfile.cc: Likewise.
598 2009-10-28 Doug Kwan <dougkwan@google.com>
600 * arm.cc (Arm_relobj): New class definition.
601 (Arm_relobj::scan_sections_for_stubs,
602 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
603 New method definitions.
605 2009-10-28 Cary Coutant <ccoutant@google.com>
607 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
608 (Plugin::cleanup_done_): New member.
609 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
610 (Plugin_manager::cleanup_done_): Remove.
611 (Plugin_manager::add_input_file): Edit error message.
612 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
613 (Plugin_manager::cleanup): Remove use of cleanup_done_.
615 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
617 * fileread.cc: (File_read::View::~View): Use the new
618 data_ownership_ filed.
619 (File_read::~File_read): Dispose the new whole_file_view_.
620 (File_read::open): Mmap the whole file if needed.
621 (File_read::open): Use whole_file_view_ instead of contents_.
622 (File_read::find_view): Use whole_file_view_ if applicable.
623 (File_read::do_read): Use whole_file_view_ instead of contents_.
624 (File_read::make_view): Use whole_file_view_ instead of contents_,
625 update File_read::View::View call.
626 (File_read::find_or_make_view): Update File_read::View::View
628 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
630 (File_read::View::Data_ownership): New enum.
631 (File_read::View::View): Replace bool mapped_ with Data_ownership
633 (File_read::View::mapped_): Remove (replaced by data_ownership_).
634 (File_read::View::data_ownership_): New field.
635 (File_read::contents_): Remove (replaced by whole_file_view_).
636 (File_read::whole_file_view_): New field.
637 * options.h (class General_options): Add --keep-files-mapped.
639 2009-10-27 Cary Coutant <ccoutant@google.com>
641 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
642 * testsuite/Makefile.am (plugin_test_5): New test case.
643 * testsuite/Makefile.in: Regenerate.
645 2009-10-25 Doug Kwan <dougkwan@google.com>
647 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
648 from private to protected to allow access by child class.
649 (Sized_relobj::do_relocate_sections): New method declaration.
650 (Sized_relobj::relocate_sections): Virtualize.
651 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
652 Sized_relobj::relocate_sections. Instantiate template explicitly
653 for different target sizes and endianity.
655 2009-10-24 Doug Kwan <dougkwan@google.com>
657 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
658 (Arm_input_section::as_arm_input_section): New method.
659 (Arm_output_section): New class definition.
660 (Arm_output_section::create_stub_group,
661 Arm_output_section::group_sections): New method definitions.
663 2009-10-22 Doug Kwan <dougkwan@google.com>
665 * arm.cc (Arm_input_section): New class definition.
666 (Arm_input_section::init, Arm_input_section:do_write,
667 Arm_input_section::set_final_data_size,
668 Arm_input_section::do_reset_address_and_file_offset): New method
671 2009-10-21 Doug Kwan <dougkwan@google.com>
673 * arm.cc (Stub_table, Arm_input_section): New forward class
675 (Stub_table): New class defintion.
676 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
677 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
678 New method definition.
680 2009-10-21 Doug Kwan <dougkwan@google.com>
682 * arm.cc: Update copyright comments.
683 (Target_arm): New forward class template declaration.
684 (Arm_address): New type.
685 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
686 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
687 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
689 (Insn_template): Same.
690 (DEF_STUBS): New macro.
691 (Stub_type): New enum type.
692 (Stub_template): New class definition.
695 (Stub_factory): Same.
696 (Target_arm::Target_arm): Initialize may_use_blx_ and
697 should_force_pic_veneer_.
698 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
699 Target_arm::should_force_pic_veneer,
700 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
701 Target_arm::using_thumb_only, Target_arm:;default_target): New
703 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
704 New data member declarations.
705 (Insn_template::size, Insn_template::alignment): New method defintions.
706 (Stub_template::Stub_template): New method definition.
707 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
708 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
709 (Stub_factory::Stub_factory): New method definition.
710 * gold.h (string_hash): New template.
711 * output.h (Input_section_specifier::hash_value): Use
713 (Input_section_specifier::string_hash): Remove.
714 * stringpool.cc (Stringpool_template::string_hash): Use
717 2009-10-20 Doug Kwan <dougkwan@google.com>
719 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
720 symbols of relaxed input sections.
721 * output.h (Output_section::find_relaxed_input_section): Make
724 2009-10-16 Doug Kwan <dougkwan@google.com>
726 * dynobj.cc (Versions::Versions): Initialize version_script_.
727 Only insert base version symbol definition for a shared object
728 if version script defines any version versions.
729 (Versions::define_base_version): New method definition.
730 (Versions::add_def): Check that base version is not needed.
731 (Versions::add_need): Define base version lazily.
732 * dynobj.h (Versions::define_base_version): New method declaration.
733 (Versions::needs_base_version_): New data member declaration.
734 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
735 (check_DATA): Add no_version_test.stdout.
736 (libno_version_test.so, no_version_test.o no_version_test.stdout):
738 * testsuite/Makefile.in: Regenerate.
739 * testsuite/no_version_test.c: New file.
740 * testsuite/no_version_test.sh: Ditto.
742 2009-10-16 Doug Kwan <dougkwan@google.com>
744 * expression.cc (class Segment_start_expression): New class definition.
745 (Segment_start_expression::value): New method definition.
746 (script_exp_function_segment_start): Return a new
747 Segment_start_expression.
748 * gold/script-c.h (script_saw_segment_start_expression): New function
750 * script-sections.cc (Script_sections::Script_sections): Initialize
751 SAW_SEGMENT_START_EXPRESSION_ to false.
752 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
753 and -Tbbs options to specify section addresses if given in
754 command line and no SEGMENT_START expression is seen in a script.
755 * script-sections.h (Script_sections::saw_segment_start_expression,
756 Script_sections::set_saw_segment_start_expression): New method
758 (Script_sections::saw_segment_start_expression_): New data member
760 * script.cc (script_saw_segment_start_expression): New function.
761 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
762 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
763 script_test_7.sh and script_test_8.sh.
764 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
765 script_test_8.stdout.
766 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
767 (script_test_6, script_test_6.stdout, script_test_7,
768 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
769 * Makefile.in: Regenerate.
770 * testsuite/script_test_6.sh: New file.
771 * testsuite/script_test_6.t: Same.
772 * testsuite/script_test_7.sh: Same.
773 * testsuite/script_test_7.t: Same.
774 * testsuite/script_test_8.sh: Same.
776 2009-10-16 Doug Kwan <dougkwan@google.com>
778 * output.cc (Output_segment::set_section_list_address): Cast
779 expressions to unsigned long long type to avoid format warnings.
781 2009-10-15 Ian Lance Taylor <iant@google.com>
783 * script.cc (Script_options::add_symbol_assignment): Always add a
784 dot assignment to script_sections_.
785 * script-sections.cc (Script_sections::add_dot_assignment):
786 Initialize if necessary.
788 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
789 program headers with no load segment if there is a linker script.
791 * layout.cc (Layout::set_segment_offsets): Align the file offset
792 to the segment aligment for -N or -n with no load segment.
793 * output.cc (Output_segment::add_output_section): Don't crash if
794 the first section is a TLS section.
795 (Output_segment::set_section_list_addresses): Print an error
796 message if the address moves backward in a linker script.
798 (Output_section_element_input::set_section_addresses): Don't
799 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
800 (Orphan_output_section::set_section_addresses): Likewise.
802 2009-10-15 Doug Kwan <dougkwan@google.com>
804 * layout.cc (Layout::finish_dynamic_section): Generate tags
805 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
806 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
807 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
809 2009-10-14 Ian Lance Taylor <iant@google.com>
811 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
813 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
814 data_shdr fields of relinfo.
815 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
816 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
817 R_386_TLS_LDO_32, adjust based on section flags.
818 (Target_i386::Relocate::fix_up_ldo): Remove.
820 2009-10-13 Ian Lance Taylor <iant@google.com>
822 Add support for -pie.
823 * options.h (class General_options): Add -pie and
825 (General_options::output_is_position_independent): Test -pie.
826 (General_options::output_is_executable): Return true if not shared
828 (General_options::output_is_pie): Remove.
829 * options.cc (General_options::finalize): Reject incompatible uses
831 * gold.cc (queue_middle_tasks): A -pie link is not static.
832 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
833 * symtab.cc (Symbol::final_value_is_known): Return false if
834 output_is_position_independent.
835 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
836 output_is_position_independent.
837 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
838 output_is_position_independent.
839 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
840 output_is_position_independent.
841 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
843 (basic_pie_test.o, basic_pie_test): New targets.
844 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
845 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
846 (two_file_pie_test): New target.
847 * testsuite/Makefile.in: Rebuild.
848 * README: Remove note saying that -pie is not supported.
850 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
852 * options.h (class General_options): Add -init and -fini.
853 * layout.cc (Layout::finish_dynamic_section): Emit
854 given init and fini functions.
856 2009-10-13 Sriraman Tallam <tmsriram@google.com>
858 * gc.h (gc_process_relocs): Check if icf is enabled using new
860 * gold.cc (queue_initial_tasks): Likewise.
861 (queue_middle_tasks): Likewise.
862 * object.cc (do_layout): Likewise.
863 * symtab.cc (is_section_folded): Likewise.
864 * main.cc (main): Likewise.
865 * reloc.cc (Read_relocs::run): Likewise.
866 (Sized_relobj::do_scan_relocs): Likewise.
867 * icf.cc (is_function_ctor_or_dtor): New function.
868 (Icf::find_identical_sections): Check if function is ctor or dtor when
870 * options.h (General_options::icf): Change option to be an enum.
871 (Icf_status): New enum.
872 (icf_enabled): New method.
873 (icf_safe_folding): New method.
874 (set_icf_status): New method.
875 (icf_status_): New variable.
876 * (options.cc) (General_options::finalize): Set icf_status_.
877 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
878 icf_test and icf_keep_unique_test to use the --icf enum flag.
879 * testsuite/icf_safe_test.sh: New file.
880 * testsuite/icf_safe_test.cc: New file.
882 2009-10-12 Sriraman Tallam <tmsriram@google.com>
884 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
885 includes to gc.h and icf.h.
886 * arm.cc: Include gc.h.
889 * powerpc.cc: Likewise.
890 * sparc.cc: Likewise.
891 * x86_64.cc: Likewise.
892 * gc.h: Include icf.h.
894 2009-10-11 Ian Lance Taylor <iant@google.com>
896 * plugin.cc: Include "gold.h" before other header files.
898 2009-10-10 Chris Demetriou <cgd@google.com>
900 * options.h (Input_file_argument::Input_file_type): New enum.
901 (Input_file_argument::is_lib_): Replace with...
902 (Input_file_argument::type_): New member.
903 (Input_file_argument::Input_file_argument): Take Input_file_type
904 'type' rather than boolean 'is_lib' as second argument.
905 (Input_file_argument::is_lib): Use type_.
906 (Input_file_argument::is_searched_file): New function.
907 (Input_file_argument::may_need_search): Handle is_searched_file.
908 * options.cc (General_options::parse_library): Support -l:filename.
909 (General_options::parse_just_symbols): Update for Input_file_argument
911 (Command_line::process): Likewise.
912 * archive.cc (Archive::get_file_and_offset): Likewise.
913 * plugin.cc (Plugin_manager::release_input_file): Likewise.
914 * script.cc (read_script_file, script_add_file): Likewise.
915 * fileread.cc (Input_file::Input_file): Likewise.
916 (Input_file::will_search_for): Handle is_searched_file.
917 (Input_file::open): Likewise.
918 * readsyms.cc (Read_symbols::get_name): Likewise.
919 * testsuite/Makefile.am (searched_file_test): New test.
920 * testsuite/Makefile.in: Regenerate.
921 * testsuite/searched_file_test.cc: New file.
922 * testsuite/searched_file_test_lib.cc: New file.
924 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
925 Ian Lance Taylor <iant@google.com>
927 * descriptor.cc: Include <cstdio> and "binary-io.h".
928 (Descriptors::open): Open the files in binary mode always.
929 * script.cc (Lex::get_token): Treat \r as whitespace.
931 2009-10-09 Ian Lance Taylor <iant@google.com>
933 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
935 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
936 Ian Lance Taylor <iant@google.com>
938 * configure.ac: Check for readv function also.
939 * fileread.cc (readv): Define if not HAVE_READV.
940 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
942 * config.in: Regenerate.
943 * configure: Regenerate.
945 2009-10-09 Doug Kwan <dougkwan@google.com>
947 * layout.cc (Layout::make_output_section): Call target hook to make
948 ordinary output section.
949 (Layout::finalize): Adjust parameter list of call the
951 * layout.h (class Layout::section_list): New method.
952 * merge.h (Output_merge_base::entsize): Change visibility to public.
953 (Output_merge_base::is_string, Output_merge_base::do_is_string):
955 (Output_merge_string::do_is_string): New method.
956 * object.cc (Sized_relobj::do_setup): renamed from
957 Sized_relobj::set_up.
958 * object.h (Sized_relobj::adjust_shndx,
959 Sized_relobj::initializ_input_to_output_maps,
960 Sized_relobj::free_input_to_output_maps): Change visibilities to
962 (Sized_relobj::setup): Virtualize.
963 (Sized_relobj::do_setup): New method declaration.
964 (Sized_relobj::invalidate_section_offset,
965 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
966 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
967 * options.cc (parse_int): New function.
968 * options.h (parse_int): New declaration.
969 (DEFINE_int): New macro.
970 (stub_group_size): New option.
971 * output.cc (Output_section::Output_section): Initialize memebers
972 merge_section_map_, merge_section_by_properties_map_,
973 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
974 (Output_section::add_input_section): Handled deferred code-fill
975 generation and remove an old comment.
976 (Output_section::add_relaxed_input_section): New method definition.
977 (Output_section::add_merge_input_section): Use merge section by
978 properties map to speed to search. Update merge section maps
980 (Output_section::build_relaxation_map): New method definition.
981 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
983 (Output_section::relax_input_section): Renamed to
984 Output_section::convert_input_sections_to_relaxed_sections and change
985 interface to take a vector of pointers to relaxed sections.
986 (Output_section::find_merge_section,
987 Output_section::find_relaxed_input_section): New method definitions.
988 (Output_section::is_input_address_mapped,
989 Output_section::output_offset, Output_section::output_address):
990 Use output section data maps to speed up searching.
991 (Output_section::find_starting_output_address): Add comments.
992 (Output_section::do_write,
993 Output_section::write_to_postprocessing_buffer): Do code-fill
994 generation as appropriate.
995 (Output_section::get_input_sections): Invalidate relaxed input section
997 (Output_section::restore_states): Adjust type of checkpoint .
998 Invalidate relaxed input section map.
999 * output.h (Output_merge_base): New class declaration.
1000 (Input_section_specifier): New class defintion.
1001 (class Output_relaxed_input_section) Change base class to
1002 Output_section_data_build.
1003 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1004 base class initializer.
1005 (Output_section::add_relaxed_input_section): New method declaration.
1006 (Output_section::Input_section): Change visibility to protected.
1007 (Output_section::Input_section::relobj,
1008 Output_section::Input_section::shndx): Handle relaxed input sections.
1009 Output_section::input_sections) Change visibility to protected. Also
1010 define overload to return a non-const pointer.
1011 (Output_section::Merge_section_properties): New class defintion.
1012 (Output_section::Merge_section_by_properties_map,
1013 Output_section::Output_section_data_by_input_section_map,
1014 Output_section::Relaxation_map): New types.
1015 (Output_section::relax_input_section): Rename method to
1016 Output_section::convert_input_sections_to_relaxed_sections and change
1017 interface to take a vector of relaxed section pointers.
1018 (Output_section::find_merge_section,
1019 Output_section::find_relaxed_input_section,
1020 Output_section::build_relaxation_map,
1021 Output_section::convert_input_sections_in_list_to_relaxed_sections):
1022 New method declarations.
1023 (Output_section::merge_section_map_
1024 Output_section::merge_section_by_properties_map_,
1025 Output_section::relaxed_input_section_map_,
1026 Output_section::is_relaxed_input_section_map_valid_,
1027 Output_section::generate_code_fills_at_write_): New data members.
1028 * script-sections.cc
1029 (Output_section_element_input::set_section_addresses): Call
1030 current_data_size and addralign methods of relaxed input sections.
1031 (Orphan_output_section::set_section_addresses): Call current_data_size
1032 and addralign methods of relaxed input sections.
1033 * symtab.cc (Symbol_table::compute_final_value): Extract template
1034 from the body of Symbol_table::sized_finalize_symbol.
1035 (Symbol_table::sized_finalized_symbol): Call
1036 Symbol_table::compute_final_value.
1037 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1038 (Symbol_table::compute_final_value): New templated method declaration.
1039 * target.cc (Target::do_make_output_section): New method defintion.
1040 * target.h (Target::make_output_section): New method declaration.
1041 (Target::relax): Add more parameters for input objects, symbol table
1042 and layout. Adjust call to do_relax.
1043 (Target::do_make_output_section): New method declaration.
1044 (Target::do_relax): Add parameters for input objects, symbol table
1047 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1049 * pread.c: Include stdio.h.
1051 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1053 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1056 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1058 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1059 Change read_shndx type to unsigned int.
1060 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1062 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1063 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1064 Change read_shndx type to unsigned int.
1065 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1067 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1068 * layout.cc (Layout::create_symtab_sections): Cast the result of
1069 local_symcount * symsize to off_t in the gold_assert.
1071 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1073 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1074 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1076 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1077 (Arm_relocate_functions::thm_abs5): New function.
1078 (Arm_relocate_functions::abs12): New function.
1079 (Arm_relocate_functions::abs16): New function.
1080 (Arm_relocate_functions::base_abs): New function.
1081 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1082 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1083 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1085 (Scan::global): Likewise.
1086 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1087 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1088 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1089 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1092 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1094 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1095 (Arm_relocate_functions::movt_prel): New function.
1096 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1097 (Arm_relocate_functions::thm_movt_prel): New function.
1098 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1099 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1100 (Scan::global, Relocate::relocate): Likewise.
1101 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1103 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1105 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1106 Incremental_checker.
1107 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1109 (class Incremental_inputs_header): New class.
1110 (Incremental_inputs_header_writer): Edit comment.
1111 (Incremental_inputs_entry): New class.
1112 (Incremental_inputs_entry_writer): Edit comment.
1113 (Sized_incremental_binary::do_find_incremental_inputs_section):
1114 Add *strtab_shndx parameter, fill it.
1115 (Sized_incremental_binary::do_check_inputs): New method.
1116 (Incremental_checker::can_incrementally_link_output_file): Use
1117 Sized_incremental_binary::check_inputs.
1118 (Incremental_inputs::report_command_line): Save command line in
1121 (Incremental_binary::find_incremental_inputs_section): New
1123 (Incremental_binary::do_find_incremental_inputs_section): Add
1124 strtab_shndx parameter.
1125 (Incremental_binary::do_check_inputs): New pure virtual method.
1126 (Sized_incremental_binary::do_check_inputs): Declare.
1127 (Incremental_checker::Incremental_checker): Add incremental_inputs
1128 parameter, use it to initialize incremental_inputs_.
1129 (Incremental_checker::incremental_inputs_): New field.
1130 (Incremental_checker::command_line): New method.
1131 (Incremental_checker::inputs): New method.
1132 (Incremental_checker::command_line_): New field.
1134 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1136 * incremental.cc: Include <cstdarg> and "target-select.h".
1137 (vexplain_no_incremental): New function.
1138 (explain_no_incremental): New function.
1139 (Incremental_binary::error): New method.
1140 (Sized_incremental_binary::do_find_incremental_inputs_section): New
1142 (make_sized_incremental_binary): New function.
1143 (open_incremental_binary): New function.
1144 (can_incrementally_link_file): Add checks if output is ELF and has
1146 * incremental.h: Include "elfcpp_file.h" and "output.h".
1147 (Incremental_binary): New class.
1148 (Sized_incremental_binary): New class.
1149 (open_incremental_binary): Declare.
1150 * object.cc (is_elf_object): Use
1151 elfcpp::Elf_recognizer::is_elf_file.
1152 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
1153 * output.h (Output_file::filesize): New method.
1155 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1157 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
1159 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
1160 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
1162 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
1164 (Arm_relocate_functions::movw_abs_nc): New function.
1165 (Arm_relocate_functions::movt_abs): New function.
1166 (Arm_relocate_functions::thm_movw_abs_nc): New function.
1167 (Arm_relocate_functions::thm_movt_abs): New function.
1168 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
1169 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
1170 (Scan::global): Likewise.
1171 (Relocate::relocate): Likewise.
1172 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1174 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1176 * arm.cc (Arm_relocate_functions::got_prel) New function.
1177 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
1178 (Relocate::relocate): Likewise.
1179 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1181 2009-10-06 Ian Lance Taylor <iant@google.com>
1183 * options.h (class General_options): Define
1184 split_stack_adjust_size parameter.
1185 * object.h (class Object): Add uses_split_stack_ and
1186 has_no_split_stack_ fields. Add uses_split_stack and
1187 has_no_split_stack accessor functions. Declare
1188 handle_split_stack_section.
1189 (class Reloc_symbol_changes): Define.
1190 (class Sized_relobj): Define Function_offsets. Declare
1191 split_stack_adjust, split_stack_adjust_reltype, and
1193 * object.cc (Object::handle_split_stack_section): New function.
1194 (Sized_relobj::do_layout): Call handle_split_stack_section.
1195 * dynobj.cc (Sized_dynobj::do_layout): Call
1196 handle_split_stack_section.
1197 * reloc.cc (Sized_relobj::relocate_sections): Call
1198 split_stack_adjust for executable sections in split_stack
1199 objects. Pass reloc_map to relocate_section.
1200 (Sized_relobj::split_stack_adjust): New function.
1201 (Sized_relobj::split_stack_adjust_reltype): New function.
1202 (Sized_relobj::find_functions): New function.
1203 * target-reloc.h: Include "object.h".
1204 (relocate_section): Add reloc_symbol_changes parameter. Change
1206 * target.h (class Target): Add calls_non_split method. Declare
1207 do_calls_non_split virtual method. Declare match_view and
1209 * target.cc: Include "elfcpp.h".
1210 (Target::do_calls_non_split): New function.
1211 (Target::match_view): New function.
1212 (Target::set_view_to_nop): New function.
1213 * gold.cc (queue_middle_tasks): Give an error if mixing
1214 split-stack and non-split-stack objects with -r.
1215 * i386.cc (Target_i386::relocate_section): Add
1216 reloc_symbol_changes parameter.
1217 (Target_i386::do_calls_non_split): New function.
1218 * x86_64.cc (Target_x86_64::relocate_section): Add
1219 reloc_symbol_changes parameter.
1220 (Target_x86_64::do_calls_non_split): New function.
1221 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
1223 * powerpc.cc (Target_powerpc::relocate_section): Add
1224 reloc_symbol_changes parameter.
1225 * sparc.cc (Target_sparc::relocate_section): Add
1226 reloc_symbol_changes parameter.
1227 * configure.ac: Call AM_CONDITIONAL for the default target.
1228 * configure: Rebuild.
1229 * testsuite/Makefile.am (TEST_AS): New variable.
1230 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
1231 (check_DATA): Add split_i386 and split_x86_64 files.
1232 (SPLIT_DEFSYMS): Define.
1233 (split_i386_[1234n].o): New targets.
1234 (split_i386_[124]): New targets.
1235 (split_i386_[1234r].stdout): New targets.
1236 (split_x86_64_[1234n].o): New targets.
1237 (split_x86_64_[124]): New targets.
1238 (split_x86_64_[1234r].stdout): New targets.
1239 (MOSTLYCLEANFILES): Add new executables.
1240 * testsuite/split_i386.sh: New file.
1241 * testsuite/split_x86_64.sh: New file.
1242 * testsuite/split_i386_1.s: New file.
1243 * testsuite/split_i386_2.s: New file.
1244 * testsuite/split_i386_3.s: New file.
1245 * testsuite/split_i386_4.s: New file.
1246 * testsuite/split_i386_n.s: New file.
1247 * testsuite/split_x86_64_1.s: New file.
1248 * testsuite/split_x86_64_2.s: New file.
1249 * testsuite/split_x86_64_3.s: New file.
1250 * testsuite/split_x86_64_4.s: New file.
1251 * testsuite/split_x86_64_n.s: New file.
1252 * testsuite/testfile.cc (Target_test): Update relocation_section
1254 * testsuite/Makefile.in: Rebuild.
1256 2009-10-06 Ian Lance Taylor <iant@google.com>
1258 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
1259 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
1260 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
1261 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
1262 the address on ldo_addrs_.
1263 (Target_i386::Relocate::fix_up_ldo): New function.
1265 2009-10-06 Rafael Espindola <espindola@google.com>
1267 * plugin.cc (add_input_library): New.
1268 (Plugin::load): Add add_input_library to tv.
1269 (Plugin_manager::add_input_file): Add the is_lib argument.
1270 (add_input_file): Update call to Plugin_manager::add_input_file.
1271 (add_input_library): New.
1272 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
1274 2009-09-30 Doug Kwan <dougkwan@google.com>
1276 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
1277 symbol and call Symbol::may_need_copy_reloc to determine if
1278 a copy reloc is needed.
1279 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
1280 nocopyreloc is given in command line.
1281 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
1282 given in command line.
1283 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
1284 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
1285 of the removed Target_i386::may_need_copy_reloc.
1286 * options.h (copyreloc): New option with default value false.
1287 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1288 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
1289 instead of the removed Target_powerpc::may_need_copy_reloc.
1290 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1291 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
1292 instead of the removed Target_sparc::may_need_copy_reloc.
1293 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
1294 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
1295 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
1296 instead of the removed Target_x86_64::may_need_copy_reloc.
1298 2009-09-30 Ian Lance Taylor <iant@google.com>
1300 * object.h (class Object): Remove target_ field, and target,
1301 sized_target, and set_target methods.
1302 (Object::sized_target): Remove.
1303 (class Sized_relobj): Update declarations. Remove sized_target.
1304 * object.cc (Sized_relobj::setup): Remove target parameter.
1306 (Input_objects::add_object): Don't do anything with the target.
1307 (make_elf_sized_object): Add punconfigured parameter. Change all
1308 callers. Set or test parameter target.
1309 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
1311 * parameters.cc (Parameters::set_target): Change parameter type to
1313 (Parameters::default_target): Remove.
1314 (set_parameters_target): Change parameter type to be non-const.
1315 (parameters_force_valid_target): New function.
1316 (parameters_clear_target): New function.
1317 * parameters.h (class Parameters): Update declarations. Remove
1318 default_target method. Add sized_target and clear_target
1319 methods. Change target_ to be non-const.
1320 (set_parameters_target): Update declaration.
1321 (parameters_force_valid_target): Declare.
1322 (parameters_clear_target): Declare.
1323 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
1324 as NULL if we aren't searching.
1325 (Add_symbols::run): Don't check for compatible target.
1326 * fileread.cc (Input_file::open_binary): Call
1327 parameters_force_valid_target.
1328 * gold.cc (queue_middle_tasks): Likewise.
1329 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
1330 set_target on object.
1331 * dynobj.h (class Sized_dynobj): Update declarations.
1332 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
1333 make_elf_object returns NULL.
1334 (Archive::include_member): Don't check whether object target is
1336 * output.cc (Output_section::add_input_section): Get target from
1338 (Output_section::relax_input_section): Likewise.
1339 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
1341 (Sized_relobj::do_scan_relocs): Likewise.
1342 (Sized_relobj::relocate_sections): Likewise.
1343 * resolve.cc (Symbol_table::resolve): Likewise.
1344 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
1345 parameter. Change all callers.
1346 (Symbol_table::add_from_object): Get target from parameters.
1347 (Symbol_table::add_from_relobj): Don't check object target.
1348 (Symbol_table::add_from_dynobj): Likewise.
1349 (Symbol_table::define_special_symbol): Get target from
1351 * symtab.h (class Symbol_table): Update declaration.
1352 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
1353 parameter. Change all callers. Clear parameter target.
1354 (Binary_test): Test target here.
1355 * testsuite/object_unittest.cc (gold_testsuite): Remove
1356 target_test_pointer parameter. Change all callers.
1357 (Object_test): Test target here.
1359 2009-09-26 Ian Lance Taylor <iant@google.com>
1361 * testsuite/initpri1.c: Don't try to use constructor priorities if
1362 compiling with gcc before 4.3.
1364 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
1366 * testsuite/retain_symbols_file_test.sh (check_present): Change
1367 output file name to retain_symbols_file_test.stdout.
1368 (check_absent): Likewise.
1370 2009-09-18 Craig Silverstein <csilvers@google.com>
1372 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
1373 * options.cc: Include <cerrno> and <fstream>.
1374 (General_options::finalize): Parse -retain-symbols-file tag.
1375 * options.h: New flag.
1376 (General_options): New method should_retain_symbol, new
1377 variable symbols_to_retain.
1378 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
1379 should_retain_symbol map.
1380 * testsuite/Makefile.am (retain_symbols_file_test): New test.
1381 * testsuite/Makefile.in: Regenerate.
1382 * testsuite/retain_symbols_file_test.sh: New file.
1384 2009-09-18 Nick Clifton <nickc@redhat.com>
1386 * po/es.po: Updated Spanish translation.
1388 2009-09-17 Doug Kwan <dougkwan@google.com>
1390 * debug.h (DEBUG_RELAXATION): New constant.
1391 (DEBUG_ALL): Add DEBUG_RELAXATION.
1392 (debug_string_to_enum): Add relaxation debug option.
1394 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
1395 Layout::Relaxation_debug_check::read_sections,
1396 Layout::Relaxation_debug_check::read_sections): New method definitions.
1397 (Layout::Layout): Initialize data members
1398 record_output_section_data_from_scrips_,
1399 script_output_section_data_list_ and relaxation_debug_check_.
1400 (Layout::save_segments, Layout::restore_segments,
1401 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1402 Layout::relaxation_loop_body): New method definitions.
1403 (Layout::finalize): Support relaxation. Move section layout code to
1404 Layout::relaxation_loop_body.
1405 (Layout::set_asection_address_from_script): Move code for orphan
1406 section placement out.
1407 (Layout::place_orphan_sections_in_script): New method definition.
1408 * layout.h (Output_segment_headers, Output_file_header):
1409 New forward class declarations.
1410 (Layout::~Layout): Define.
1411 (Layout::new_output_section_data_from_script): New method definition.
1412 (Layout::place_orphan_sections_in_script): New method declaration.
1413 (Layout::Segment_states): New type declaration.
1414 (Layout::save_segments, Layout::restore_segments,
1415 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1416 Layout::relaxation_loop_body): New method declarations.
1417 (Layout::Output_section_data_list): New type declaration.
1418 (Layout::Relaxation_debug_check): New class definition.
1419 (Layout::record_output_section_data_from_script_,
1420 Layout::script_output_section_data_list_, Layout::segment_states_,
1421 Layout::relaxation_debug_check_): New data members.
1422 * output.cc: (Output_section_headers::do_size): New method definition.
1423 (Output_section_headers::Output_section_headers): Move size
1424 computation to Output_section_headers::do_size.
1425 (Output_segment_headers::do_size): New method definition.
1426 (Output_file_header::Output_file_header): Move size computation to
1427 Output_file_header::do_size and call it.
1428 (Output_file_header::do_size): New method definition.
1429 (Output_data_group::Output_data_group): Adjust call to
1430 Output_section_data.
1431 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
1432 (Output_symtab_xindex::do_write): Add array bound check.
1433 (Output_section::Input_section::print_to_mapfile): Handle
1434 RELAXED_INPUT_SECTION_CODE.
1435 (Output_section::Output_section): Initialize data member checkpoint_.
1436 (Output_section::~Output_section): Delete checkpoint object pointed
1438 (Output_section::add_input_section): Always add an Input_section if
1440 (Output_section::add_merge_input_section): Add assert.
1441 (Output_section::relax_input_section): New method definition.
1442 (Output_section::set_final_data_size): Set load address to zero for
1443 an unallocated section.
1444 (Output_section::do_address_and_file_offset_have_reset_values):
1445 New method definition.
1446 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
1447 Handle relaxed input section.
1448 (Output_section::sort_attached_input_sections): Checkpoint input
1449 section list lazily.
1450 (Output_section::get_input_sections): Change type of input_sections to
1451 list of Simple_input_section pointers. Checkpoint input section list
1452 lazily. Also handle relaxed input sections.
1453 (Output_section::add_input_section_for_script): Take a reference to
1454 a Simple_input_section object instead of Relobj pointer and section
1455 index as parameter. Handle relaxed input sections.
1456 (Output_section::save_states, Output_section::restore_states): New
1458 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
1459 (Output_data::is_data_size_fixed): New method definition.
1460 (Output_data::reset_addresss_and_file_offset): Do not reset data size
1462 (Output_data::address_and_file_offset_have_reset_values): New method
1464 (Output_data::do_address_and_file_offset_have_reset_values): New method
1466 (Output_data::set_data_size): Check that data size is not fixed.
1467 (Output_data::fix_data_size): New method definition.
1468 (Output_data::is_data_size_fixed_): New data member.
1469 (Output_section_headers::set_final_data_size): New method definition.
1470 (Output_section_headers::do_size): New method declaration.
1471 (Output_segment_headers::set_final_data_size): New method definition.
1472 (Output_segment_headers::do_size): New method declaration.
1473 (Output_file_header::set_final_data_size)::New method definition.
1474 (Output_file_header::do_size)::New method declaration.
1475 (Output_section_data::Output_section_data): Add new parameter
1476 is_data_size_fixed and use it to fix data size.
1477 (Output_data_const::Output_data_const): Adjust call to base class
1478 constructor and fix data size.
1479 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
1480 base class constructor and fix data size.
1481 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
1482 base class constructor and fix data size.
1483 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
1484 class constructor and fix data size.
1485 (Output_data_group::set_final_data_size): New method definition.
1486 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
1487 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
1488 class constructor and fix data size.
1489 (Output_relaxed_input_section): New class definition.
1490 (Output_section::Simple_input_section): New class definition.
1491 (Output_section::get_input_sections): Adjust parameter list.
1492 (Output_section::add_input_section_for_script): Same.
1493 (Output_section::save_states, Output_section::restore_states,
1494 Output_section::do_address_and_file_offset_have_reset_values,
1495 (Output_section::Input_section::Input_section): Handle
1496 RELAXED_INPUT_SECTION_CODE. Add new overload for
1497 Output_relaxed_input_section.
1498 (Output_section::Input_section::is_input_section,
1499 Output_section::Input_section::set_output_section): Handle relaxed
1501 (Output_section::Input_section::is_relaxed_input_section,
1502 Output_section::Input_section::output_section_data,
1503 Output_section::Input_section::relaxed_input_section): New method
1505 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
1507 (Output_section::Input_section::u1_): Update comments.
1508 (Output_section::Input_section::u2_): Add new union member poris.
1509 (Output_section::Checkpoint_output_section): New classs definition.
1510 (Output_section::relax_input_section): New method declaration.
1511 (Output_section::checkpoint_): New data member.
1512 (Output_segment): Update comments.
1513 (Output_segment::Output_segment): Un-privatize copy constructor.
1514 (Output_segment::operator=): Un-privatize.
1515 * script-sections.cc (Output_section_element::Input_section_list):
1516 Change element type to Output_section::Simple_input_section.
1517 (Output_section_element_dot_assignment::set_section_addresses):
1518 Register output section data for relaxation clean up.
1519 (Output_data_exression::Output_data_expression): Adjust call to base
1520 constructor to fix data size.
1521 (Output_section_element_data::set_section_addresses): Register
1522 Output_data_expression object for relaxation clean up.
1523 (struct Input_section_info): Replace Relobj pointer and section index
1524 pair with Output_section::Simple_input_section and Convert struct to a
1526 (Input_section_sorter::operator()): Adjust access to
1527 Input_section_info data member to use accessors.
1528 (Output_section_element_input::set_section_addresses): Use layout
1529 parameter. Adjust code to use Output_section::Simple_input_section
1530 and Input_secction_info classes. Register filler for relaxation
1532 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
1533 and section index pair with Output_section::Simple_input_section
1534 class. Adjust code accordingly.
1535 (Phdrs_element::release_segment): New method definition.
1536 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
1538 (Script_sections::release_segments): New method definition.
1539 * gold/script-sections.h (Script_sections::release_segments): New
1541 * gold/target.h (Target::may_relax, Target::relax,
1542 Target::do_may_relax, Target::do_relax): New method definitions.
1544 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1546 * arm.cc (has_signed_unsigned_overflow): New function.
1547 (Arm_relocate_functions::abs8): New function.
1548 (Target_arm::Scan::local): Handle R_ARM_ABS8.
1549 (Target_arm::Scan::global): Likewise.
1550 (Target_arm::relocate::relocate): Likewise.
1551 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1554 2009-09-16 Cary Coutant <ccoutant@google.com>
1556 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
1557 * testsuite/Makefile.in: Regenerate.
1559 2009-09-11 Nick Clifton <nickc@redhat.com>
1561 * po/gold.pot: Updated by the Translation project.
1563 2009-09-08 Cary Coutant <ccoutant@google.com>
1565 * output.cc (Output_file::open): Add execute permission to empty file.
1566 * testsuite/Makefile.am (permission_test): New test.
1567 * testsuite/Makefile.in: Regenerate.
1569 2009-09-02 Ian Lance Taylor <iant@google.com>
1571 * output.cc (Output_file::resize): Call map_no_anonymous rather
1574 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
1576 * gold.cc: Include "incremental.h".
1577 (queue_initial_tasks): Call Incremental_checker methods.
1578 * incremental.cc: Include "output.h".
1579 (Incremental_checker::can_incrementally_link_output_file): New
1581 * incremental.h (Incremental_checker): New class.
1583 * output.cc (Output_file::open_for_modification): New method.
1584 (Output_file::map_anonymous): Changed return type to bool. Record
1586 (Output_file::map_no_anonymous): New method, broken out of map.
1587 (Output_file::map): Use map_no_anonymous and map_anonymous.
1588 * output.h (class Output_file): Update declarations.
1590 2009-08-24 Cary Coutant <ccoutant@google.com>
1592 * options.h (Command_line::Pre_options): New class.
1593 (Command_line::pre_options): New member.
1594 * options.cc (gold::options::ready_to_register): New variable.
1595 (One_option::register_option): Do nothing if not registering options.
1596 Assert if same short option registered twice.
1597 (General_options::General_options): Turn off option registration when
1599 (Command_line::Pre_options::Pre_options): New constructor.
1601 2009-08-24 Cary Coutant <ccoutant@google.com>
1603 * options.h (General_options::no_keep_memory): Remove incorrect
1606 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1608 * Makefile.am (am__skiplex, am__skipyacc): New.
1609 * Makefile.in: Regenerate.
1611 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1613 * Makefile.am (AM_CPPFLAGS): Renamed from ...
1614 (INCLUDES): ... this.
1615 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
1616 (AM_CPPFLAGS): Renamed from ...
1617 (INCLUDE): ... this.
1618 * Makefile.in, testsuite/Makefile.in: Regenerate.
1620 * Makefile.in: Regenerate.
1621 * aclocal.m4: Likewise.
1622 * config.in: Likewise.
1623 * configure: Likewise.
1624 * testsuite/Makefile.in: Likewise.
1626 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1627 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1628 * Makefile.in: Regenerate.
1629 * testsuite/Makefile.in: Regenerate.
1631 2009-08-19 Cary Coutant <ccoutant@google.com>
1633 * resolve.cc (Symbol_table::resolve): Don't complain about defined
1634 symbols in shared libraries overridden by hidden or internal symbols
1635 in the main program.
1637 2009-08-19 Chris Demetriou <cgd@google.com>
1639 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
1640 checking source file names in error messages.
1642 2009-08-18 Doug Kwan <dougkwan@google.com>
1644 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
1645 an elcpp::Ehdr as parameter. Adjust call to set_target.
1646 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
1647 an elfcpp::Ehdr as parameter.
1648 * object.cc (Object::set_target): Remove the version that looks up
1649 a target and sets it.
1650 (Sized_relobj::setup): Take a Target object instead of
1651 an elfcpp::Ehdr as parameter. Adjust call to set_target.
1652 (make_elf_sized_object): Find target and ask target to
1654 * object.h: (Object::set_target): Remove the version that looks up
1655 a target and sets it.
1656 (Sized_relobj::setup): Take a Target object instead of
1657 an elfcpp:Ehdr as parameter.
1658 * target.cc: Include dynobj.h.
1659 (Target::do_make_elf_object_implementation): New.
1660 (Target::do_make_elf_object): New.
1661 * target.h (Target::make_elf_object): New template declaration.
1662 (Target::do_make_elf_object): New method declarations.
1663 (Target::do_make_elf_object_implementation): New template declaration.
1665 2009-08-14 Ian Lance Taylor <iant@google.com>
1667 * gold.h (FUNCTION_NAME): Define.
1668 (gold_unreachable): Use FUNCTION_NAME.
1670 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1672 * icf.cc (Icf::find_identical_sections): Issue a warning when a
1673 symbol in the --keep-unique list is not found.
1675 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1677 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
1678 been maked as --keep-unique.
1679 (Icf::unfold_section): New function.
1680 * icf.h (Icf::unfold_section): New function.
1681 * options.h (General_options::keep_unique): New option.
1682 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
1683 * testsuite/Makefile.in: Regenerate.
1684 * testsuite/icf_keep_unique_test.sh: New file.
1685 * testsuite/icf_keep_unique_test.cc: New file.
1687 2009-08-12 Cary Coutant <ccoutant@google.com>
1690 * resolve.cc (Symbol_table::resolve): Check for references from
1691 dynamic objects to hidden and internal symbols.
1692 * testsuite/Makefile.am (hidden_test.sh): New test.
1693 * testsuite/Makefile.in: Regenerate.
1694 * testsuite/hidden_test.sh: New script.
1695 * testsuite/hidden_test_1.c: New test source.
1696 * testsuite/hidden_test_main.c: New test source.
1698 2009-08-11 Doug Kwan <dougkwan@google.com>
1700 * arm.cc: Update comments.
1701 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
1702 segment to locate the .ARM.exidx section if present.
1704 2009-08-09 Doug Kwan <dougkwan@google.com>
1706 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
1709 2009-08-07 Sriraman Tallam <tmsriram@google.com>
1710 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
1713 2009-08-06 Sriraman Tallam <tmsriram@google.com>
1715 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
1716 valid tls_segment only for non-debug-section relocations.
1717 * testsuite/Makefile.am: Add gc_tls_test.
1718 * testsuite/Makefile.in: Regenerate.
1719 * testsuite/gc_tls_test.cc: New file.
1720 * testsuite/gc_tls_test.sh: New file.
1722 2009-08-05 Sriraman Tallam <tmsriram@google.com>
1726 * Makefile.am (CCFILES): Add icf.cc.
1728 * Makefile.in: Regenerate.
1729 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
1730 * gc.h (gc_process_relocs): Populate lists used by icf to contain
1731 section, symbol and addend information for the relocs.
1732 * gold.cc (queue_middle_tasks): Call identical code folding.
1733 * gold.h: Add defines for multimap.
1734 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
1735 to the call of finalize_local_symbols.
1736 * main.cc (main): Create object of class Icf.
1737 * object.cc (Sized_relobj::do_layout): Allow this function to be
1738 called twice during icf.
1739 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
1740 to sections marked as identical by icf.
1741 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
1743 (Sized_relobj::do_section_entsize): New function.
1744 * object.h (Object::section_entsize): New function.
1745 (Object::do_section_entsize): New pure virtual function.
1746 (Relobj::finalize_local_symbols): Add new parameter.
1747 (Relobj::do_section_entsize): New function.
1748 * options.h (General_options::icf): New option.
1749 (General_options::icf_iterations): New option.
1750 (General_options::print_icf_sections): New option.
1751 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
1752 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
1753 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
1755 * symtab.cc (Symbol_table::is_section_folded): New function.
1756 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
1757 to sections marked as identical by icf.
1758 * symtab.h (Symbol_table::set_icf): New function.
1759 (Symbol_table::icf): New function.
1760 (Symbol_table::is_section_folded): New function.
1761 (Symbol_table::icf_): New data member.
1762 * target-reloc.h (relocate_section): Ignore sections folded by icf.
1763 * testsuite/Makefile.am: Add commands to build icf_test.
1764 * testsuite/Makefile.in: Regenerate.
1765 * testsuite/icf_test.sh: New file.
1766 * testsuite/icf_test.cc: New file.
1768 2009-07-24 Chris Demetriou <cgd@google.com>
1770 * layout.cc (is_compressible_debug_section): Fix incorrect
1771 comment about compressed section names.
1773 2009-07-20 Ian Lance Taylor <ian@airs.com>
1776 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
1778 2009-07-16 Ian Lance Taylor <iant@google.com>
1781 * layout.h: #include <map>.
1782 (class Kept_section): Change from struct to class. Add accessors
1783 and setters. Add section size to Comdat_group mapping. Change
1784 Comdat_group to std::map. Add is_comdat_ field. Add
1785 linkonce_size field in union.
1786 (class Layout): Update declaration of find_or_add_kept_section.
1787 Don't declare find_kept_object.
1788 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1789 parameter. Add object, shndx, is_comdat, and is_group_name
1790 parameters. Change all callers. Adjust for new Kept_section.
1791 (Layout::find_kept_object): Remove.
1792 * object.cc (Sized_relobj::include_section_group): Update use of
1793 Kept_section. Rename secnum to shndx. Only record
1794 Kept_comdat_section if sections are the same size.
1795 (Sized_relobj::include_linkonce_section): Update use of
1796 Kept_section. Only record Kept_comdat_section if sections are the
1797 same size. Set size of linkonce section.
1798 (Sized_relobj::map_to_kept_section): Update call to
1799 get_kept_comdat_section.
1800 * object.h (class Sized_relobj): Rename fields in
1801 Kept_comdat_section to drop trailing underscores; change object
1802 field to Relobj*. Change Kept_comdat_section_table to store
1803 struct rather than pointer.
1804 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1805 Add kept_object and kept_shndx parameters. Change all callers.
1806 (Sized_relobj::get_kept_comdat_section): Change return type to
1807 bool. Add kept_object and kept_shndx parameters. Change all
1809 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1810 Layout::find_or_add_kept_section.
1812 2009-07-09 Ian Lance Taylor <iant@google.com>
1814 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1815 Reserve space in the hash table.
1817 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1819 * fileread.cc (File_read::get_mtime): New method.
1820 * fileread.h (Timespec): New structure.
1821 (File_read::get_mtime): New method.
1822 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1823 Renamed from timestamp_nsec.
1824 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1826 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1828 (Incremental_inputs::report_archive): Save mtime; style fix.
1829 (Incremental_inputs::report_obejct): Save mtime; style fix.
1830 (Incremental_inputs::report_script): Save mtime; style fix.
1831 (Incremental_inputs::finalize_inputs): Style fix.
1832 (Incremental_inputs::finalize): Style fix.
1833 (Incremental_inputs::create_input_section_data): Store inputs
1835 * incremental.h (Incremental_inputs::report_script): Add mtime
1837 (Incremental_inputs::Input_info::Input_info): Intialize only one
1839 (Incremental_inputs::Input_info::archive): Move to nameless
1841 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1842 (Incremental_inputs::Input_info::script): Move to nameless union.
1843 (Incremental_inputs::mtime): New field.
1844 * script.cc (read_input_script): Pass file mtime to
1846 * script.h (Script_info::inputs): Style fix.
1848 2009-07-01 Ian Lance Taylor <ian@airs.com>
1850 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1853 2009-06-24 Ian Lance Taylor <iant@google.com>
1856 * layout.cc (Layout::choose_output_section): If we find an
1857 existing section, update the flags.
1858 (Layout::create_notes): New function, broken out of
1860 (Layout::finalize): Don't create note sections.
1861 (Layout::create_note): Don't crash if linker script discards
1863 (Layout::create_gold_note): Likewise.
1864 (Layout::create_build_id): Likewise. Don't set
1865 after_input_sections on the section.
1866 (Layout::create_executable_stack_info): Remove target parameter.
1868 * layout.h (class Layout): Declare create_notes. Update
1869 declaration of create_executable_stack_info.
1870 * gold.cc (queue_middle_tasks): Call create_notes.
1871 * output.cc (Output_section::update_flags_for_input_section): Move
1872 here from output.h. If SHF_ALLOC flag is newly set, mark address
1874 * output.h (Output_data::mark_address_invalid): New function.
1875 (class Output_section): Only declare, not define,
1876 update_flags_for_input_section. Remove set_flags.
1878 2009-06-24 Ian Lance Taylor <iant@google.com>
1880 * script-sections.cc (Output_section_definition::
1881 set_section_addresses): Rename shadowing local load_address to
1884 2009-06-24 Ian Lance Taylor <iant@google.com>
1887 * reloc.cc (relocate_sections): Skip empty relocation sections.
1889 2009-06-23 Ian Lance Taylor <iant@google.com>
1892 * layout.cc (Layout::create_note): Use choose_output_section
1893 rather than make_output_section.
1895 2009-06-23 Ian Lance Taylor <iant@google.com>
1898 * options.cc (General_options::parse_V): Set printed_version_.
1899 (General_options::General_options): Initialize printed_version_.
1900 * options.h (class General_options): Add printed_version_ field.
1901 * gold.cc (queue_initial_tasks): If there are no input files,
1902 don't give a fatal error if we printed the version information.
1903 (queue_middle_tasks): If using -r with a shared object, give a
1904 fatal error rather than an ordinary error.
1906 2009-06-23 Ian Lance Taylor <iant@google.com>
1909 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1910 (Layout::make_output_section): Set have_stabstr_section_ if we see
1911 a .stab*str section.
1912 (Layout::finalize): Call link_stabs_sections.
1913 (Layout::link_stabs_sections): New file.
1914 * layout.h (class Layout): Add have_stabstr_section_ field.
1915 Declare link_stabs_sections.
1917 2009-06-23 Doug Kwan <dougkwan@google.com>
1919 * Makefile.am (libgold_a_LIBADD): New.
1920 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1921 * Makefile.in: Regenerate.
1922 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1923 * configure: Regenerate.
1924 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1925 * fileread.cc: Include sys/state.h
1926 * gold.h: Declare memmem and strndup if found missing.
1927 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1929 2009-06-23 Ian Lance Taylor <iant@google.com>
1931 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
1932 * configure: Rebuild.
1934 2009-06-23 Ian Lance Taylor <iant@google.com>
1937 * object.cc (Object::section_contents): Don't try to get a view if
1938 the section has length zero.
1939 (Object::handle_gnu_warning_section): If the section is empty, use
1940 the name of the section as the warning.
1942 2009-06-23 Ian Lance Taylor <iant@google.com>
1945 * stringpool.h (class Stringpool_template): Add optimize_ field.
1946 (Stringpool_template::set_optimize): New function.
1947 * stringpool.cc (Stringpool_template::Stringpool_template):
1948 Initialize optimize_ field.
1949 (Stringpool_template::set_string_offsets): Test local optimize
1950 fild rather than parameter.
1951 * layout.cc (Layout::Layout): Call set_optimize on the section
1954 2009-06-22 Ian Lance Taylor <iant@google.com>
1957 * yyscript.y: Parse TARGET.
1958 * script.cc (script_set_target): New function.
1959 * script-c.h (script_set_target): Declare.
1960 * options.cc (General_options::string_to_object_format): Rename
1961 from string_to_object_format in anonymous namespace. Change
1963 * options.h (class General_options): Declare
1964 string_to_object_format.
1966 2009-06-22 Ian Lance Taylor <iant@google.com>
1968 * script-sections.cc (Script_sections::create_segments): Don't put
1969 program headers in a PT_LOAD segment if -n or -N.
1971 2009-06-22 Ian Lance Taylor <iant@google.com>
1974 * options.h (class General_options): Add -z lazy and -z now. Sort
1975 -z options into alphabetical order.
1976 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
1978 2009-06-21 Ian Lance Taylor <iant@google.com>
1980 * layout.cc (Layout::make_output_section): Call
1981 Target::new_output_section.
1982 (Layout::attach_allocated_section_to_segment): Put large section
1983 sections in a separate load segment with the large segment flag
1985 (Layout::segment_precedes): Sort large data segments after other
1987 (align_file_offset): New static function.
1988 (Layout::set_segment_offsets): Use align_file_offset.
1989 * output.h (class Output_section): Add is_small_section_ and
1990 is_large_section_ fields.
1991 (Output_section::is_small_section): New function.
1992 (Output_section::set_is_small_section): New function.
1993 (Output_section::is_large_section): New function.
1994 (Output_section::set_is_large_section): New function.
1995 (Output_section::is_large_data_section): New function.
1996 (class Output_segment): Add is_large_data_segment_ field.
1997 (Output_segment::is_large_data_segment): New function.
1998 (Output_segment::set_is_large_data_segment): New function.
1999 * output.cc (Output_section::Output_section): Initialize new
2001 (Output_segment::Output_segment): Likewise.
2002 (Output_segment::add_output_section): Add assertion that large
2003 data sections always go in large data segments. Force small data
2004 sections to the end of the list of data sections. Force small BSS
2005 sections to the start of the list of BSS sections. For large BSS
2006 sections to the end of the list of BSS sections.
2007 * symtab.h (class Symbol): Declare is_common_shndx.
2008 (Symbol::is_defined): Check Symbol::is_common_shndx.
2009 (Symbol::is_common): Likewise.
2010 (class Symbol_table): Define enum Commons_section_type. Update
2011 declarations. Add small_commons_ and large_commons_ fields.
2012 * symtab.cc (Symbol::is_common_shndx): New function.
2013 (Symbol_table::Symbol_table): Initialize new fields.
2014 (Symbol_table::add_from_object): Put small and large common
2015 symbols in the right list.
2016 (Symbol_table::sized_finalized_symbol): Check
2017 Symbol::is_common_shndx.
2018 (Symbol_table::sized_write_globals): Likewise.
2019 * common.cc (Symbol_table::do_allocate_commons): Allocate new
2020 common symbol lists. Don't call do_allocate_commons_list if the
2022 (Symbol_table::do_allocate_commons_list): Remove is_tls
2023 parameter. Add comons_section_type parameter. Change all
2024 callers. Handle small and large common symbols.
2025 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2026 Symbol::is_common_shndx.
2027 * resolve.cc (symbol_to_bits): Likewise.
2028 * target.h (Target::small_common_shndx): New function.
2029 (Target::small_common_section_flags): New function.
2030 (Target::large_common_shndx): New function.
2031 (Target::large_common_section_flags): New function.
2032 (Target::new_output_section): New function.
2033 (Target::Target_info): Add small_common_shndx, large_common_shndx,
2034 small_common_section_flags, and large_common_section_flags
2036 (Target::do_new_output_section): New virtual function.
2037 * arm.cc (Target_arm::arm_info): Initialize new fields.
2038 * i386.cc (Target_i386::i386_info): Likewise.
2039 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2041 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2042 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2043 (Target_x86_64::do_new_output_section): New function.
2044 * configure.ac: Define conditional MCMODEL_MEDIUM.
2045 * testsuite/Makefile.am (check_PROGRAMS): Add large.
2046 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2047 (large_LDFLAGS): Define.
2048 * testsuite/large.c: New file.
2049 * testsuite/testfile.cc (Target_test::test_target_info):
2050 Initialize new fields.
2051 * configure, testsuite/Makefile.in: Rebuild.
2053 2009-06-05 Doug Kwan <dougkwan@google.com>
2055 * Makefile.am (CCFILES): Add target.cc.
2056 * Makefile.in: Regenerate.
2057 * i386.cc (class Target_i386): Define new virtual method to
2058 override do_is_local_label_name in parent.
2059 * object.cc (Sized_relobj::do_count_local_symbols): Discard
2060 local symbols if --discard-locals or -X is given.
2061 * options.h (class General_options): Declare new options
2062 '--discard-locals' and '-X' for discarding locals.
2063 * target.h (class Target): Define new methods is_local_label_name.
2064 Declare new virtual method do_is_local_label_name.
2065 * target.cc: New file.
2066 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2067 (check_SCRIPTS): Add discard_locals_test.sh.
2068 (check_DATA): Add discard_local_tests.syms.
2069 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2070 (discard_local_tests.syms, discard_locals_test.o): New make rules.
2071 * testsuite/Makefile.in: Regenerate.
2072 * testsuite/discard_locals_test.c: New file.
2073 * testsuite/discard_locals_test.sh: Same.
2075 2009-06-05 Doug Kwan <dougkwan@google.com>
2077 * object.cc (Sized_relobj::Sized_relobj): Initialize
2078 discarded_eh_frame_shndx_ to -1U.
2079 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2081 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2082 a discarded .eh_frame section.
2083 (Sized_relobj::do_finalize_local_symbols): Ditto.
2084 * object.h (class Sized_relobj): Declare new member
2085 discarded_eh_frame_shndx_.
2086 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2087 (local_labels_test.o, local_labels_test): New rules.
2088 * testsuite/Makefile.in: Regenerate.
2090 2009-06-04 Doug Kwan <dougkwan@google.com>
2092 * layout.cc (Layout::section_name_mapping): Add mapping for
2093 special ARM sections.
2095 2009-06-03 Doug Kwan <dougkwan@google.com>
2097 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2098 (utils::has_overflow): Same.
2100 2009-06-03 Ian Lance Taylor <iant@google.com>
2102 * layout.cc (Layout::section_name_mapping): New array, replacing
2103 Layout::linkonce_mapping.
2104 (Layout::section_name_mapping_count): New variable, replacing
2105 Layout::linkonce_mapping_count.
2106 (Layout::linkonce_output_name): Remove.
2107 (Layout::output_section_name): Rewrite.
2108 * layout.h (class Layout): Rename Linkonce_mapping to
2109 Section_name_mapping, linkonce_mapping to section_name_mapping,
2110 linkonce_mapping_count to section_name_mapping_count. Don't
2111 declare linkonce_output_name.
2113 2009-06-03 Doug Kwan <dougkwan@google.com>
2115 * gold/arm.cc (namespace utils): New.
2116 (Target_arm::reloc_is_non_pic): Define new method.
2117 (class Arm_relocate_functions): New.
2118 (Target_arm::Relocate::relocate): Handle relocation types used by
2121 2009-06-03 Ian Lance Taylor <iant@google.com>
2123 * arm.cc (Target_arm::scan::global): Use || instead of |.
2125 2009-06-02 Doug Kwan <dougkwan@google.com>
2127 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
2128 issued_non_pic_error_.
2129 (class Target_arm::Scan): Declare new method check_non_pic.
2130 Define new method symbol_needs_plt_entry.
2131 Declare new data member issued_non_pic_error_.
2132 (class Target_arm::Relocate): Declare new method
2133 should_apply_static_reloc.
2134 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
2135 (Target_arm::Scan::check_non_pic): Define new method.
2136 (Target_arm::Scan::local): Handle a small subset of reloc types used
2138 (Target_arm::Scan::local): Same.
2139 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2141 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
2143 * incremental.cc (Incremental_inputs::report_command_line): Filter
2144 out --incremental-* options.
2146 2009-05-29 Doug Kwan <dougkwan@google.com>
2148 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
2150 (class Target_arm): Update comment.
2151 (Target_arm::Target_arm): Initialize new data members GOT_,
2152 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
2153 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
2154 and Target_arm::rel_dyn_section.
2155 Declare new_enum Target_arm::Got_type.
2156 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
2158 Update commments for member do_dynsym_value.
2159 (Target_arm::got_size, Target_arm::plt_section,
2160 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
2161 new methods inside class defintion.
2162 (Target_arm::got_section): Define new method.
2163 (Target_arm::rel_dyn_section): Same.
2164 (Output_data_plt_arm): New template class.
2165 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
2166 (Output_data_plt_arm:do_adjust_output_section): Define new method.
2167 (Output_data_plt_arm::add_entry): Same.
2168 (Output_data_plt_arm::first_plt_entry): Define new
2169 static data member for PLT instruction template.
2170 (Output_data_plt_arm::plt_entry): Same.
2171 (Output_data_plt_arm::do_write): Define new method.
2172 (Target_arm::make_plt_entry): Same.
2173 (Target_arm::do_finalize_sections): Same.
2174 (Target_arm::do_dynsym_value): Same.
2176 2009-05-28 Doug Kwan <dougkwan@google.com>
2178 * Makefile.am (TARGETSOURCES): Add arm.cc.
2179 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
2180 * Makefile.in: Regenerate.
2182 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2184 2009-05-26 Doug Kwan <dougkwan@google.com>
2186 * options.cc (General_options::parse_exclude_libs). Fix a comment.
2187 (General_options::check_excluded_libs): Strip off directories in
2188 archive name before matching like GNU ld does.
2189 * testsuite/Makefile.am (MOSTLYCLEANFILES,
2190 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
2191 (exclude_libs_test_LDFLAGS): Add linker option
2192 -Wl,--exclude-libs,libexclude_libs_test_3
2193 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
2194 an explicit archive without using -l.
2195 (alt/libexclude_libs_test_3.a): New make rule.
2196 * testsuite/Makefile.in: Regenerate.
2197 * testsuite/exclude_libs_test.c : Declare lib3_default().
2199 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
2200 * exclude_libs_test_3.c: New file.
2202 2009-05-26 Nick Clifton <nickc@redhat.com>
2204 * po/id.po: New Indonesian translation.
2205 * po/gold.pot: Updated template file.
2207 2009-05-22 Sriraman Tallam <tmsriram@google.com>
2209 * testsuite/Makefile.am: Add -ffunction-sections to compile
2210 gc_comdat_test files. Add -Wl,--gc-sections to build
2212 * testsuite/Makefile.in: Regenerate.
2213 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
2215 2009-05-21 Sriraman Tallam <tmsriram@google.com>
2217 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
2218 kept comdat section was garbage collected.
2219 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
2220 * testsuite/Makefile.in: Regenerate.
2221 * testsuite/gc_comdat_test.sh: New file.
2222 * testsuite/gc_comdat_test_1.cc: New file.
2223 * testsuite/gc_comdat_test_2.cc: New file.
2225 2009-05-19 Doug Kwan <dougkwan@google.com>
2227 * archive.cc (Archive::Archive): Move constructor from archive.h
2228 to here. Initialize no_export_.
2229 (Archive::get_elf_object_for_member): Set no_export flag of object.
2230 * archive.h (Archive::Archive): Move constructor body to
2232 (Archive::no_export): New method.
2233 (Archive::no_export_): New field.
2234 * object.h (Object::Object): Initialize no_export_ to false.
2235 (Object::no_export, Object::set_no_export): New methods.
2236 (Object::no_export_): New field.
2237 * options.cc (General_options::parse_exclude_libs): New method.
2238 (General_options::check_excluded_libs) Same.
2239 * options.h (exclude_libs): New option.
2240 (General_options::check_excluded_libs): New method declaration.
2241 (General_options::excluded_libs_): New field.
2242 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
2243 default or protected visibility if an object has no-export flag set.
2244 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
2245 (check_SCRIPTS): Add exclude_libs_test.sh.
2246 (check_DATA): Add exclude_libs_test.syms.
2247 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
2248 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
2249 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
2250 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
2251 (exclude_libs_test.syms, libexclude_libs_test_1.a,
2252 libexclude_libs_test_2.a): New rules.
2253 * testsuite/Makefile.in: Regenerate.
2254 * testsuite/exclude_libs_test.c: New file.
2255 * testsuite/exclude_libs_test.sh: Ditto.
2256 * testsuite/exclude_libs_test_1.c: Ditto.
2257 * testsuite/exclude_libs_test_2.c: Ditto.
2259 2009-05-15 Ian Lance Taylor <iant@google.com>
2261 * configure.ac: Check for declarations for cases where libiberty.h
2262 checks HAVE_DECL_xxx.
2263 * configure, config.in: Rebuild.
2265 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
2267 * gold.h (Incremental_argument_list): Remove (invalid) forward
2269 * incremental.cc (Incremental_inputs::report_achive): New method.
2270 (Incremental_inputs::report_object): New method.
2271 (Incremental_inputs::report_script): New method.
2272 (Incremental_inputs::finalize_inputs): New method.
2273 (Incremental_inputs::finalize): Call finalize_inputs().
2274 (Incremental_inputs::sized_create_incremental_inputs_section_data):
2275 Create inputs entries.
2276 * incremental.h (Incremental_input_type): New enum.
2277 (Incremental_inputs::Incremental_input): Initialize new fields.
2278 (Incremental_inputs::report_inputs): New method.
2279 (Incremental_inputs::report_achive): New method.
2280 (Incremental_inputs::report_object): New method.
2281 (Incremental_inputs::report_script): New method.
2282 (Incremental_inputs::finalize_inputs): New method.
2283 (Incremental_inputs::Input_info): New struct.
2284 (Incremental_inputs::Input_info_map): New typedef.
2285 (Incremental_inputs::lock_): New field.
2286 (Incremental_inputs::Inputs_): New field.
2287 (Incremental_inputs::Inputs_map): New field.
2288 * main.cc (main): Call Incremental_input::report_inputs.
2289 * options.h (Input_argument_list): Typedef moved from
2291 (Input_file_group::Files): Remove, use ::Input_argument_list.
2292 (Input_file_group::Input_argument_list): Remove, use
2293 ::Input_argument_list.
2294 * plugin.cc (Plugin_manager::add_input_file): Add error in
2296 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
2298 * script.cc (read_input_script): Call
2299 Incremental_input::report_script.
2300 * script.h (Script_info): New class.
2302 2009-04-27 Ian Lance Taylor <iant@google.com>
2304 * x86_64.cc (do_adjust_output_section): Set entsize to
2307 2009-04-23 Elliott Hughes <enh@google.com>
2309 * output.cc (Output_file::close): After short writes, continue
2310 writing from the correct offset in the buffer being written.
2312 2009-04-23 Chris Demetriou <cgd@google.com>
2314 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
2315 * configure: Regenerate.
2316 * config.in: Regenerate.
2317 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
2318 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2320 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
2322 * incremental.cc (Incremental_inputs_header_data): Renamed from
2323 Incremental_input_header_data.
2324 (Incremental_inputs_header_data::data_size): New field.
2325 (Incremental_inputs_header_data::put_input_file_count): Renamed
2326 from input_file_count.
2327 (Incremental_inputs_header_data::put_command_line_offset): Renamed
2328 from command_line_offset.
2329 (Incremental_inputs_header_data::put_reserved): Renamed from
2331 (Incremental_inputs_entry_data): Renamed from
2332 Incremental_input_entry_data.
2333 (Incremental_inputs_entry_data::data_size): New field.
2334 (Incremental_inputs::report_command_line): New method.
2335 (Incremental_inputs::finalize): New method.
2336 (Incremental_inputs::create_incremental_inputs_data): New method.
2337 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
2338 * incremental.h: New file.
2339 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
2340 (Layout::finalize): Create incremental inputs section in
2342 (Layout::create_incremental_info_sections): New method.
2343 * layout.h (Layout::incremental_inputs): New method.
2344 (Layout::create_incremental_info_sections): New method.
2345 (Layout::incremental_inputs_): New field.
2346 * main.cc (main): Notify Incremental_input of the command line.
2348 2009-04-01 Ian Lance Taylor <iant@google.com>
2349 Mikolaj Zalewski <mikolajz@google.com>
2351 * gold.h (reserve_unordered_map): Define, three versions, one for
2352 each version of Unordered_map.
2353 * layout.cc (Layout::Layout): Remove options parameter. Add
2354 number_of_input_files parameter. Don't initialize options_.
2355 Initialize number_of_input_files_ and resized_signatures_. Move
2356 sections_are_attached_.
2357 (Layout::layout_group): Reserve space for group_signatures_.
2358 (Layout::find_or_add_kept_section): Change name parameter to be a
2359 reference. Resize signatures_ map when it gets large enough.
2360 (Layout::layout_eh_frame): Use parameters->options() instead of
2362 (Layout::make_output_section): Likewise.
2363 (Layout::attach_allocated_section_to_segment): Likewise.
2364 (Layout::finalize, Layout::create_executable_stack): Likewise.
2365 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
2366 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
2367 * layout.h (class Layout): Update declarations. Remove options_
2368 field. Add number_of_input_files_ and resized_signatures_
2369 fields. Move sections_are_attached_ field.
2370 * main.cc (main): Pass number of input files to Layout
2371 constructor. Don't pass options.
2373 2009-03-30 Ian Lance Taylor <iant@google.com>
2375 * ffsll.c (ffsll): Correct implementation.
2377 2009-03-27 Ian Lance Taylor <iant@google.com>
2379 * ffsll.c: New file.
2380 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
2381 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
2382 * ftruncate.c (ftruncate): Declare before definition.
2383 * mremap.c (mremap): Likewise.
2384 * pread.c (pread): Likewise.
2385 * configure, Makefile.in, config.in: Rebuild.
2387 * mremap.c: New file.
2388 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
2389 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
2390 (mremap): Declare if HAVE_MREMAP is not defined.
2391 * configure, Makefile.in, config.in: Rebuild.
2393 2009-03-27 Cary Coutant <ccoutant@google.com>
2395 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
2396 position independent.
2397 * sparc.cc (Target_sparc::check_non_pic): Likewise.
2398 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
2400 2009-03-24 Cary Coutant <ccoutant@google.com>
2402 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
2404 (needs_dynamic_reloc): Likewise.
2406 2009-03-24 Ian Lance Taylor <iant@google.com>
2408 * yyscript.y (file_cmd): Recognize EXTERN.
2409 (extern_name_list, extern_name_list_body): New nonterminals.
2410 * script.cc (script_add_extern): Define.
2411 * script-c.h (script_add_extern): Declare.
2413 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
2415 * object.cc (is_elf_object): Define.
2416 * object.h (is_elf_object): Declare.
2417 * archive.cc (Archive::get_elf_object_for_member): Call
2419 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
2421 2009-03-24 Elliott Hughes <enh@google.com>
2423 * output.cc (Output_file::map_anonymous): Define.
2424 (Output_file::map): Use map_anonymous. If the regular mmap fails,
2425 try an anonymous one. Report the size if the mmap fails.
2426 * output.h (class Output_file): Declare map_anonymous.
2428 2009-03-24 Ian Lance Taylor <iant@google.com>
2430 * target-select.cc (instantiate_target): Don't acquire the lock if
2431 the instantiated_target_ field has already been set.
2433 2009-03-23 Ian Lance Taylor <iant@google.com>
2435 * gold-threads.h (class Initialize_lock): Define.
2436 * gold-threads.cc (class Initialize_lock_once): Define.
2437 (initialize_lock_control): New static variable.
2438 (initialize_lock_pointer): New static variable.
2439 (initialize_lock_once): New static function.
2440 (Initialize_lock::Initialize_lock): Define.
2441 (Initialize_lock::initialize): Define.
2442 * target-select.h: Include "gold-threads.h".
2443 (class Target_selector): Add lock_ and initialize_lock_ fields.
2444 Don't define instantiate_target, just declare it.
2445 * target-select.cc (Target_selector::Target_selector): Initialize
2447 (Target_selector::instantiate_target): Define.
2448 * descriptors.h: Include "gold-threads.h".
2449 (class Descriptors): Add initialize_lock_ field.
2450 * descriptors.cc (Descriptors::Descriptors): Initialize new
2452 (Descriptors::open): Use initialize_lock_ field
2453 * errors.h (class Errors): Add initialize_lock_ field.
2454 * errors.cc (Errors::Errors): Initialize new field.
2455 (Errors::initialize_lock): Use initialize_lock_ field.
2456 * powerpc.cc (class Target_selector_powerpc): Remove
2457 instantiated_target_ field. In do_recognize call
2458 instantiate_target rather than do_instantiate_target. In
2459 do_instantiate_target just allocate a new target.
2460 * sparc.cc (class Target_selector_sparc): Likewise.
2462 * freebsd.h: New file.
2463 * i386.cc: Include "freebsd.h".
2464 (Target_i386): Derive from Target_freebsd rather than
2466 (Target_selector_i386): Derive from Target_selector_freebsd rather
2467 than Target_selector.
2468 * x86_64.cc: Include "freebsd.h".
2469 (Target_x86_64): Derive from Target_freebsd rather than
2471 (Target_selector_x86_64): Derive from Target_selector_freebsd
2472 rather than Target_selector.
2473 * target.h (class Target): Add adjust_elf_header and
2474 do_adjust_elf_header.
2475 * output.cc (Output_file_header:: do_sized_write): Call target
2476 adjust_elf_header routine.
2477 * configure.tgt: Set targ_osabi.
2478 * configure.ac: Define GOLD_DEFAULT_OSABI.
2479 * parameters.cc (Parameters::default_target): Pass
2480 GOLD_DEFAULT_OSABI to select_target.
2481 * target-select.h (class Target_selector): Make instantiate_target
2482 protected rather than private.
2483 * Makefile.am (HFILES): Add freebsd.h.
2484 * configure, Makefile.in, config.in: Rebuild.
2486 * merge.cc (do_add_input_section): Correct pend value. Change
2487 message about last entry not being null terminated from error to
2490 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
2492 * incremental.cc: New file.
2493 * Makefile.am (CCFILES): Add incremental.cc.
2494 * Makefile.in: Rebuild.
2496 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
2498 * layout.cc (Layout::output_section_name): Preserve names
2499 of '.note.' sections.
2501 2009-03-19 Ian Lance Taylor <iant@google.com>
2503 * descriptors.cc (Descriptors::open): Check that the options are
2504 valid before using them.
2506 2009-03-18 Ian Lance Taylor <iant@google.com>
2508 * script-sections.h: Include <list>.
2509 (class Script_sections): Change Sections_elements from std::vector
2510 to std::list. Typedef public Elements_iterator. Add
2511 orphan_section_placement_, data_segment_align_start_, and
2512 saw_data_segment_align_ fields. Remove data_segment_align_index_
2514 * script-sections.cc (class Orphan_section_placement): New class.
2515 (class Sections_element): Add virtual functions is_relro and
2516 orphan_section_init. Remove virtual function place_orphan_here.
2517 (class Output_section_definition): Add is_relro and
2518 orphan_section_init. Remove place_orphan_here.
2519 (class Orphan_output_section): Likewise.
2520 (Script_sections::Script_sections): Update for field changes.
2521 (Script_sections::data_segment_align): Set saw_data_segment_align_
2522 and data_segment_align_start_, not data_segment_align_index.
2523 (Script_sections::data_segment_relro_end): Check
2524 saw_data_segment_align_. Use data_segment_align_start_ rather
2525 than data_segment_align_index_.
2526 (Script_sections::place_orphan): Rewrite to use
2527 Orphan_section_placement.
2529 2009-03-17 Ian Lance Taylor <iant@google.com>
2531 * archive.cc (Archive::add_symbols): Check for a version attached
2532 to the symbol name in the archive map.
2533 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
2534 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
2535 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
2536 (ver_test_11.a): New target.
2537 * testsuite/Makefile.in: Rebuild.
2539 * configure.ac: Check for chsize and posix_fallocate. Replace
2541 * ftruncate.c: New file, from gnulib.
2542 * output.cc (posix_fallocate): Define dummy version if not
2543 HAVE_POSIX_FALLOCATE.
2544 (Output_file::map): Call posix_fallocate rather than lseek and
2546 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
2547 * configure, Makefile.in, config.in: Rebuild.
2549 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
2551 * layout.h (Layout::create_note): Add section_name parameter.
2552 * layout.cc (Layout::create_note): Likewise.
2553 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
2555 2009-03-17 Ian Lance Taylor <iant@google.com>
2557 * descriptors.cc: Include "options.h".
2558 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
2559 (Descriptors::open): Always use O_CLOEXEC when opening a new
2560 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
2561 then set FD_CLOEXEC.
2563 * sparc.cc (class Target_sparc): Add has_got_section.
2564 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
2565 make sure we have a GOT section.
2567 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
2568 (Target_sparc::Scan::local): Likewise.
2569 (Target_sparc::Scan::global): Likewise.
2570 (Target_sparc::Relocate::relocate): Likewise.
2571 (Target_sparc::Relocate::relocate_tls): Likewise.
2573 * symtab.cc (Symbol_table::define_default_version): New function,
2574 broken out of add_from_object.
2575 (Symbol_table::add_from_object): Call define_default_version.
2576 (Symbol_table::define_special_symbol): Add resolve_oldsym
2577 parameter. Change all callers. If the version for a symbol comes
2578 from a version script, resolve it with the symbol with the same
2579 name with no version. Also add the symbol without a version if
2581 (do_define_in_output_data): If resolving with oldsym, don't delete
2583 (do_define_in_output_segment): Likewise.
2584 (do_define_as_constant): Likewise.
2585 * symtab.h (class Symbol_table): Update declarations.
2587 2009-03-13 Ian Lance Taylor <iant@google.com>
2589 * readsyms.cc (Read_symbols::incompatible_warning): New function.
2590 (Read_symbols::requeue): New function.
2591 (Read_symbols::do_read_symbols): If make_elf_object fails because
2592 the target type is not configured, and the file was searched for,
2593 issue a warning and retry with the next directory.
2594 (Add_symbols::run): If the file has an incompatible format, and
2595 it was searched for, requeue the Read_symbols task. On error,
2597 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
2598 dirindex parameter to constructor. Change all callers. Declare
2599 incompatible_warning and requeue.
2600 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
2601 input_argument_ and input_group_ fields. Add them to
2602 constructor. Change all callers.
2603 (class Read_script): Add dirindex_ field. Add it to constructor.
2605 * archive.cc (Archive::setup): Remove input_objects parameter.
2607 (Archive::get_file_and_offset): Likewise.
2608 (Archive::read_all_symbols): Likewise.
2609 (Archive::read_symbols): Likewise.
2610 (Archive::get_elf_object_for_member): Remove input_objects
2611 parameter. Add punconfigured parameter. Change all callers.
2612 (Archive::add_symbols): Change return type to bool. Check return
2613 value of include_member.
2614 (Archive::include_all_members): Likewise.
2615 (Archive::include_member): Change return type to bool. Return
2616 false if first included object has incompatible target. Set
2617 included_member_ field.
2618 (Add_archive_symbols::run): If add_symbols returns false, requeue
2620 * archive.h (class Archive): Add included_member_ field.
2621 Initialize it in constructor. Add input_file and searched_for
2622 methods. Update declarations.
2623 (class Add_archive_symbols): Add dirpath_, dirindex_, and
2624 input_argument_ fields. Add them to constructor. Change all
2626 * script.cc: Include "target-select.h".
2627 (class Parser_closure): Add skip_on_incompatible_target_ and
2628 found_incompatible_target_ fields. Add
2629 skip_on_incompatible_target parameter to constructor. Change all
2630 callers. Add methods skip_on_incompatible_target,
2631 clear_skip_on_incompatible_target, found_incompatible_target, and
2632 set_found_incompatible_target.
2633 (read_input_script): Add dirindex parameter. Change all callers.
2634 If parser finds an incompatible target, requeue Read_symbols
2636 (script_set_symbol): Clear skip_on_incompatible_target in
2638 (script_add_assertion, script_parse_option): Likewise.
2639 (script_start_sections, script_add_phdr): Likewise.
2640 (script_check_output_format): New function.
2641 * script.h (read_input_script): Update declaration.
2642 * script-c.h (script_check_output_format): Declare.
2643 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
2644 (ignore_cmd): Remove OUTPUT_FORMAT.
2645 * fileread.cc (Input_file::Input_file): Add explicit this.
2646 (Input_file::will_search_for): New function.
2647 (Input_file::open): Add pindex parameter. Change all callers.
2648 * fileread.h (class Input_file): Add input_file_argument method.
2649 Declare will_search_for. Update declarations.
2650 * object.cc (make_elf_object): Add punconfigured parameter.
2652 * object.h (class Object): Make input_file public. Add
2653 searched_for method.
2654 (make_elf_object): Update declaration.
2655 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
2657 * dirsearch.h (class Dirsearch): Update declaration.
2658 * options.h (class General_options): Add --warn-search-mismatch.
2659 * parameters.cc (Parameters::is_compatible_target): New function.
2660 * parameters.h (class Parameters): Declare is_compatible_target.
2661 * workqueue.cc (Workqueue::add_blocker): New function.
2662 * workqueue.h (class Workqueue): Declare add_blocker.
2664 * fileread.cc (Input_file::open): Remove options parameter.
2666 (Input_file::open_binary): Likewise.
2667 * script.cc (read_input_script): Likewise.
2668 * readsyms.h (class Read_symbols): Remove options_ field. Remove
2669 options parameter from constructor. Change all callers.
2670 (class Read_script): Likewise.
2671 * fileread.h (class Input_file): Update declarations.
2672 * script.h (read_input_script): Update declaration.
2674 2009-03-10 Nick Clifton <nickc@redhat.com>
2676 * po/es.po: New Spanish translation.
2678 2009-03-06 Cary Coutant <ccoutant@google.com>
2680 * options.cc (parse_short_option): Keep dash_z from registering itself.
2682 2009-03-03 Ian Lance Taylor <iant@google.com>
2685 * target-reloc.h (relocate_section): Pass output_section to
2687 * i386.cc (Target_i386::should_apply_static_reloc): Add
2688 output_section parameter. Change all callers.
2689 (Target_i386::Relocate::relocate): Add output_section parameter.
2690 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2691 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2692 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2693 * testsuite/two_file_shared.sh: New script.
2694 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
2695 (check_DATA): Add two_file_shared.dbg.
2696 (two_file_shared.dbg): New target.
2697 * testsuite/Makefile.in: Rebuild.
2699 2009-03-01 Ian Lance Taylor <iant@google.com>
2701 * configure.ac: Check for byteswap.h.
2702 * configure: Rebuild.
2703 * config.in: Rebuild.
2705 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
2707 * layout.cc (Layout::find_or_add_kept_section): New function.
2708 (Layout::add_comdat): Removed.
2709 * layout.h (struct Kept_section): Move out of class Layout.
2710 Remove trailing underscores from field names. Add group_sections
2711 field. Rename group_ field to is_group. Change all uses.
2712 (class Layout): Declare find_or_add_kept_section, not add_comdat.
2713 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
2714 comdat_groups_ field.
2715 (Sized_relobj::include_section_group): Use
2716 find_or_add_kept_section and Kept_section::group_sections.
2717 (Sized_relobj::include_linkonce_section): Likewise.
2718 * object.cc (class Sized_relobj): Don't define Comdat_group or
2719 Comdat_group_table. Remove find_comdat_group and
2720 add_comdat_group. Remove comdat_groups_ field.
2721 * plugin.cc (include_comdat_group): Use
2722 Layout::find_or_add_kept_section.
2724 2009-02-28 Ian Lance Taylor <iant@google.com>
2726 * README: --gc-sections and map files are now supported. Document
2727 some build requirements.
2730 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
2731 relocatable link set the value of the section symbol to zero.
2732 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
2733 relocatable link don't include the section address in the local
2736 2009-02-27 Ian Lance Taylor <iant@google.com>
2739 * options.h (class Search_directory): Add is_system_directory.
2740 (class General_options): Declare is_in_system_directory.
2741 * options.cc (get_relative_sysroot): Make static.
2742 (get_default_sysroot): Make static.
2743 (General_optoins::is_in_system_directory): New function.
2744 * fileread.cc (Input_file::is_in_system_directory): New function.
2745 * fileread.h (class Input_file): Declare is_in_system_directory.
2746 * object.h (class Object): Add is_in_system_directory.
2747 (class Input_objects): Remove system_library_directory_ field.
2748 * object.cc (Input_objects::add_object): Don't set
2749 system_library_directory_.
2750 (input_objects::found_in_system_library_directory): Remove.
2751 * symtab.cc (Symbol_table::write_globals): Remove input_objects
2752 parameter. Change all callers.
2753 (Symbol_table::sized_write_globals): Likewise.
2754 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
2755 Call Object::is_in_system_directory.
2756 * symtab.h (class Symbol_table): Update declarations.
2759 * descriptors.h (Open_descriptor): Add is_on_stack field.
2760 * descriptors.cc (Descriptors::open): If the descriptor is on the
2761 top of the stack, remove it. Initialize is_on_stack field.
2762 (Descriptors::release): Only add pod to stack if it is not on the
2764 (Descriptors::close_some_descriptor): Clear stack_next and
2768 * output.cc (Output_section::find_starting_output_address): Rename
2769 from starting_output_address; add PADDR parameter; change return
2771 * output.h (class Output_section): Declare
2772 find_starting_output_address instead of starting_output_address.
2773 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
2774 section symbol for which we can't find a merge section.
2777 * symtab.cc (Symbol_table::add_from_object): If the visibility is
2778 hidden or internal, force the symbol to be local.
2779 * resolve.cc (Symbol::override_visibility): Define.
2780 (Symbol::override_base): Use override_visibility.
2781 (Symbol_table::resolve): Likewise.
2782 (Symbol::override_base_with_special): Likewise.
2783 (Symbol_table::override_with_special): If the visibility is hidden
2784 or internal, force the symbol to be local.
2785 * symtab.h (class Symbol): Add set_visibility and
2786 override_visibility.
2787 * testsuite/ver_test_1.sh: New file.
2788 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2789 (check_DATA): Add ver_test_1.syms.
2790 (ver_test_1.syms): New target.
2791 * testsuite/Makefile.in: Rebuild.
2793 2009-02-25 Cary Coutant <ccoutant@google.com>
2795 * layout.cc (Layout::choose_output_section): Don't rename sections
2796 when using a linker script that has a SECTIONS clause.
2797 * Makefile.in: Regenerate.
2799 * testsuite/Makefile.am (script_test_5.sh): New test case.
2800 * testsuite/Makefile.in: Regenerate.
2801 * testsuite/script_test_5.cc: New file.
2802 * testsuite/script_test_5.sh: New file.
2803 * testsuite/script_test_5.t: New file.
2805 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
2807 * archive.cc (Archive::include_member): Update calls to add_symbols.
2808 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2809 the Layout argument.
2810 * dynobj.h (do_add_symbols): Add the Layout argument.
2811 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2813 * object.h (Object::add_symbols): Add the Layout argument.
2814 (Object::do_add_symbols): Add the Layout argument.
2815 (Sized_relobj::do_add_symbols): Add the Layout argument.
2816 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2817 Unify the two versions.
2818 (Add_plugin_symbols): Remove.
2819 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2820 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2821 (Add_plugin_symbols): Remove.
2822 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2823 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2824 (Add_symbols::run): Make it work with Pulginobj.
2826 2009-02-06 Ian Lance Taylor <iant@google.com>
2828 * object.cc (Sized_relobj::do_layout): Make info message start
2829 with lower case letter.
2831 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2833 * binary.cc: Fix file comment.
2835 * options.h (enum Incremental_disposition): Define.
2836 (class General_options): Add new options: --incremental,
2837 --incremental_changed, --incremental_unchanged,
2838 --incremental_unknown. Add incremental_disposition_ and
2839 implicit_incremental_ fields.
2840 (General_options::incremental_disposition): New function.
2841 (class Position_dependent_options): Add incremental_disposition
2843 (Position_dependent_options::copy_from_options): Set incremental
2845 * options.cc (General_options::parse_incremental_changed): New
2847 (General_options::parse_incremental_unchanged): New function.
2848 (General_options::parse_incremental_unknown): New function.
2849 (General_options::General_options): Initialize new fields
2850 incremental_disposition_ and implicit_incremental_.
2851 (General_options::finalize): Check for uasge of --incremental-*
2852 without --incremental.
2854 2009-02-06 Chris Demetriou <cgd@google.com>
2856 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2857 pointer and to report location as the file name associated with
2859 (gold_undefined_symbol_at_location): New function to replace the
2860 old gold_undefined_symbol functionality.
2861 * target-reloc.h (relocate_section): Update to use
2862 gold_undefined_symbol_at_location.
2863 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2864 Call gold_undefined_symbol function rather than gold_error.
2865 * errors.h (Errors::undefined_symbol): Take location as a
2866 string, rather than calculating it from a relocation.
2867 * errors.cc (Errors::fatal): Print "fatal error:" before the
2869 (Errors::error, Errors::error_at_location): Print "error: "
2870 before the formatted message.
2871 (Errors::undefined_symbol): Take location as a string, rather
2872 than calculating it from a relocation.
2873 (gold_undefined_symbol_at_location): New function akin to
2874 old gold_undefined_symbol, calculates location from relocation.
2875 (gold_undefined_symbol): Change to take only a Symbol pointer
2876 and to report location as the file name associated with the symbol.
2877 * testsuite/debug_msg.sh: Update for changed error messages.
2878 * testsuite/undef_symbol.sh: Likewise.
2880 2009-02-04 Duncan Sands <baldrick@free.fr>
2883 * reduced_debug_output.h
2884 (Output_reduced_debug_abbrev_section::failed): Use format for
2886 (Output_reduced_debug_info_section::faild): Likewise.
2888 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2890 * script.cc (Lazy_demangler): New class.
2891 (Version_script_info::get_symbol_version_helper): Demangle a
2894 2009-01-29 Cary Coutant <ccoutant@google.com>
2896 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2898 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2900 2009-01-28 Ian Lance Taylor <iant@google.com>
2902 * version.cc (version_string): Bump to 1.9.
2904 * gold.h: Include <cstring> and <stdint.h>.
2905 * version.cc: Include <cstdio>.
2906 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2908 * reduced_debug_output.cc (insert_into_vector): Rename from
2909 Insert_into_vector; change all callers. Use Swap_unaligned to
2910 avoid aliasing issue; remove union since it is unnecessary.
2912 2009-01-27 Sriraman Tallam <tmsriram@google.com>
2914 * Makefile.am (CCFILES): Add gc.cc.
2916 * Makefile.in: Regenerate.
2917 * gold.cc (Gc_runner): New class.
2918 (queue_initial_tasks): Call garbage collection related tasks
2919 when corresponding options are invoked.
2920 (queue_middle_gc_tasks): New function.
2921 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2922 processed early before laying out sections during garbage collection.
2923 * gold.h (queue_middle_gc_tasks): New function.
2924 (is_prefix_of): Move from "layout.cc".
2925 * i386.cc (Target_i386::gc_process_relocs): New function.
2926 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2927 * main.cc (main): Create object of class "Garbage_collection".
2928 * object.cc (Relobj::copy_symbols_data): New function.
2929 (Relobj::is_section_name_included): New function.
2930 (Sized_relobj::do_layout): Allow this function to be called twice
2931 during garbage collection and defer layout of section during the
2933 * object.h (Relobj::get_symbols_data): New function.
2934 (Relobj::is_section_name_included): New function.
2935 (Relobj::copy_symbols_data): New function.
2936 (Relobj::set_symbols_data): New function.
2937 (Relobj::get_relocs_data): New function.
2938 (Relobj::set_relocs_data): New function.
2939 (Relobj::is_output_section_offset_invalid): New pure virtual function.
2940 (Relobj::gc_process_relocs): New function.
2941 (Relobj::do_gc_process_relocs): New pure virtual function.
2942 (Relobj::sd_): New data member.
2943 (Sized_relobj::is_output_section_offset_invalid): New function.
2944 (Sized_relobj::do_gc_process_relocs): New function.
2945 * options.h (General_options::gc_sections): Modify to not be a no-op.
2946 (General_options::print_gc_sections): New option.
2947 * plugin.cc (Plugin_finish::run): Remove function call to
2948 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
2949 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
2950 * reloc.cc (Read_relocs::run): Add task to process relocs and
2951 determine unreferenced sections when doing garbage collection.
2952 (Gc_process_relocs): New class.
2953 (Sized_relobj::do_gc_process_relocs): New function.
2954 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
2955 sections that are garbage collected.
2956 * reloc.h (Gc_process_relocs): New class.
2957 * sparc.cc (Target_sparc::gc_process_relocs): New function.
2958 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
2959 symbols whose corresponding sections are garbage collected.
2960 (Symbol_table::Symbol_table): Add new parameter for the garbage
2962 (Symbol_table::gc_mark_undef_symbols): New function.
2963 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2964 (Symbol_table::gc_mark_dyn_syms): New function.
2965 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
2967 (Symbol_table::add_from_object): Likewise.
2968 (Symbol_table::add_from_relobj): When building shared objects, do not
2969 treat externally visible symbols as garbage.
2970 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
2971 table information for static and relocatable links.
2972 * symtab.h (Symbol_table::set_gc): New function.
2973 (Symbol_table::gc): New function.
2974 (Symbol_table::gc_mark_undef_symbols): New function.
2975 (Symbol_table::gc_mark_symbol_for_shlib): New function.
2976 (Symbol_table::gc_mark_dyn_syms): New function.
2977 (Symbol_table::gc_): New data member.
2978 * target.h (Sized_target::gc_process_relocs): New pure virtual
2980 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
2981 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2983 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
2985 * options.h (General_options::gc_sections): Define as a no-op for now.
2986 (General_options::no_keep_memory): Ditto.
2987 (General_options::Bshareable): Define.
2988 * options.cc (General_options::finalize): Honor -Bshareable.
2990 2009-01-20 Andreas Schwab <schwab@suse.de>
2992 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
2993 read the value in the contents, since we don't use it. Use the
2994 template endianness when writing.
2995 (Relocate::relocate): Use it for R_PPC_REL16_HA.
2997 2009-01-19 Andreas Schwab <schwab@suse.de>
2999 * configure.tgt (powerpc64-*): Fix targ_obj.
3001 2009-01-15 Ian Lance Taylor <iant@google.com>
3003 * object.cc (Sized_relobj::write_local_symbols): Don't write out
3004 local symbols when stripping all symbols.
3006 2009-01-14 Cary Coutant <ccoutant@google.com>
3008 * output.cc (Output_reloc): Add explicit instantiations.
3010 2009-01-14 Cary Coutant <ccoutant@google.com>
3012 * archive.cc (Archive::get_elf_object_for_member): Remove call
3013 to File_read::claim_for_plugin.
3014 * descriptors.cc (Descriptors::open): Remove reference to
3016 (Descriptors::claim_for_plugin): Remove.
3017 * descriptors.h (Descriptors::claim_for_plugin): Remove.
3018 (Descriptors::is_claimed): Remove.
3019 (claim_descriptor_for_plugin): Remove.
3020 * fileread.cc (File_read::claim_for_plugin): Remove.
3021 * fileread.h (File_read::claim_for_plugin): Remove.
3022 (File_read::descriptor): Reopen descriptor if necessary.
3023 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
3024 (Plugin_manager::all_symbols_read): Add task parameter. Change
3026 (Plugin_manager::get_input_file): New function.
3027 (Plugin_manager::release_input_file): New function.
3028 (Pluginobj::Pluginobj): Add filesize parameter and initialize
3029 corresponding data member.
3030 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3031 and pass to base constructor. Change all callers.
3032 (get_input_file, release_input_file): New functions.
3033 (make_sized_plugin_object): Add filesize parameter. Change all callers.
3034 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3035 (Plugin_manager::all_symbols_read): Add task parameter.
3036 (Plugin_manager::get_input_file): New function.
3037 (Plugin_manager::release_input_file): New function.
3038 (Plugin_manager::task_): New data member.
3039 (Pluginobj::Pluginobj): Add filesize parameter.
3040 (Pluginobj::filename): New function.
3041 (Pluginobj::descriptor): New function.
3042 (Pluginobj::filesize): New function.
3043 (Pluginobj::filesize_): New data member.
3044 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3045 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3046 File_read::claim_for_plugin; use Object::unlock to unlock the file.
3048 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3049 with archive libraries.
3050 * testsuite/Makefile.in: Regenerate.
3051 * testsuite/plugin_test.c (struct sym_info): New type.
3052 (get_input_file, release_input_file): New static variables.
3053 (onload): Capture new transfer vector entries.
3054 (claim_file_hook): Stop reading at end of file according to filesize.
3055 Factor out parsing of readelf output into separate function.
3056 (all_symbols_read_hook): Exercise get_input_file and release_input_file
3057 APIs and get the source file name from the symbol table. Convert
3058 source file name to corresponding object file name. Print info
3059 message when adding new input files.
3060 (parse_readelf_line): New function.
3061 * testsuite/plugin_test_1.sh: Add checks for new info messages.
3062 * testsuite/plugin_test_2.sh: Likewise.
3063 * testsuite/plugin_test_3.sh: Likewise.
3064 * testsuite/plugin_test_4.sh: New test case.
3066 2009-01-07 Ian Lance Taylor <iant@google.com>
3068 * version.cc (version_string): Bump to 1.8.
3070 2008-12-23 Cary Coutant <ccoutant@google.com>
3072 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3073 * plugin.cc (Plugin_manager::finish): Rename as
3074 layout_deferred_objects. Move cleanup to separate function.
3075 (Plugin_manager::cleanup): New function.
3076 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3078 * plugin.h (Plugin_manager::finish): Rename as
3079 layout_deferred_objects.
3080 (Plugin_manager::cleanup): New function.
3081 (Plugin_manager::cleanup_done): New field.
3083 2008-12-23 Cary Coutant <ccoutant@google.com>
3085 * plugin.cc (is_visible_from_outside): New function.
3086 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3087 so we don't return "IR only" status for exported symbols or -r links.
3089 * testsuite/Makefile.am (plugin_test_3): New test case.
3090 * testsuite/Makefile.in: Regenerate.
3091 * testsuite/plugin_test_3.sh: New file.
3093 2008-12-22 Cary Coutant <ccoutant@google.com>
3095 * object.cc (Sized_relobj::layout_section): New function.
3096 (Sized_relobj::do_layout): Defer layout of input sections until after
3097 plugin has provided replacement files.
3098 (Sized_relobj::do_layout_deferred_sections): New function.
3099 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3100 (Relobj::layout_deferred_sections): New function.
3101 (Relobj::do_layout_deferred_sections): New function.
3102 (Sized_relobj::do_layout_deferred_sections): New function.
3103 (Sized_relobj::layout_section): New function.
3104 (Sized_relobj::Deferred_layout): New structure.
3105 (Sized_relobj::deferred_layout_): New field.
3106 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3107 Change all callers. Layout deferred sections.
3108 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
3110 (Plugin_hook::run): Move code from do_plugin_hook inline.
3111 (Plugin_hook::do_plugin_hook): Remove.
3112 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3113 (Plugin_manager::finish): Renamed, was cleanup.
3114 (Plugin_manager::should_defer_layout): New function.
3115 (Plugin_manager::add_deferred_layout_object): New function.
3116 (Plugin_manager::Deferred_layout_list): New type.
3117 (Plugin_manager::deferred_layout_objects_): New field.
3118 (Plugin_hook::do_plugin_hook): Remove.
3120 2008-12-17 Ian Lance Taylor <iant@google.com>
3122 * options.h (class General_options): Add --no case for
3125 2008-12-16 Cary Coutant <ccoutant@google.com>
3127 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3129 (Plugin_manager::claim_file): Create plugin object even if
3130 plugin did not call the add_symbols callback.
3131 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
3132 asking for more symbols than were added.
3133 * testsuite/Makefile.am (plugin_test_1): Add test case with
3135 (empty.syms): New target.
3136 * testsuite/Makefile.in: Regenerate.
3137 * testsuite/plugin_test.c (claim_file_hook): Add new debug
3138 message. Don't call add_symbols if no globals.
3139 (all_symbols_read_hook): Don't provide replacement for empty
3142 2008-12-12 Ian Lance Taylor <iant@google.com>
3144 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
3145 r_type == 0 for a local symbol with r_sym == 0.
3146 (scan_relocatable_relocs): Pass r_sym to
3147 local_non_section_strategy.
3148 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
3151 * configure.ac: Update test for TLS descriptors: they are
3152 supported as of glibc 2.9.
3153 * configure: Rebuild.
3155 2008-12-11 Ian Lance Taylor <iant@google.com>
3158 * target-reloc.h (Default_scan_relocatable_relocs): For each
3159 function, map r_type == 0 to RELOC_DISCARD.
3161 2008-12-10 Cary Coutant <ccoutant@google.com>
3163 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
3164 object to override a kept COMDAT group from a plugin object.
3166 2008-12-09 Ian Lance Taylor <iant@google.com>
3169 * yyscript.y (file_cmd): Handle INPUT.
3171 * testsuite/initpri1.c: Change all declarations to be full
3172 prototypes by adding void, to avoid compiler warnings.
3174 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
3176 * options.cc (General_options::parse_plugin_opt): New.
3177 (General_options::add_plugin): The argument now is just the filename.
3178 (General_options::add_plugin_option): New.
3179 * options.h (plugin_opt): New.
3180 (add_plugin): Change argument name.
3181 (add_plugin_option): New.
3182 * plugin.cc (Plugin::load): Don't parse the plugin option.
3183 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
3184 (Plugin::add_option): New.
3185 (Plugin::args_): Change type.
3186 (Plugin::filename_): New.
3187 (Plugin_manager::add_plugin_option): New.
3188 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
3189 * testsuite/Makefile.in: Regenerate.
3191 2008-12-05 Cary Coutant <ccoutant@google.com>
3193 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
3194 Handle --strip-lto-sections option.
3195 * options.h (strip_lto_sections): New option.
3197 2008-12-01 Cary Coutant <ccoutant@google.com>
3199 * plugin.cc (ld_plugin_message): Change format parameter to const.
3200 Fix mismatch between new[] and delete.
3202 2008-11-14 Cary Coutant <ccoutant@google.com>
3204 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
3207 2008-11-05 Craig Silverstein <csilvers@google.com>
3209 * options.cc (General_options::parse_dynamic_list): New function.
3210 * options.h (General_options): New flags dynamic_list,
3211 dynamic_list_data, dynamic_list_cpp_new, and
3212 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
3213 (General_options::in_dynamic_list): New function.
3214 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
3215 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
3216 (Lex::can_continue_name): Likewise.
3218 (read_script_file): New parameter script_options.
3219 (read_dynamic_list): New function.
3220 (Script_options::define_dynamic_list): New function.
3221 (dynamic_list_keyword_parsecodes): New variable.
3222 (dynamic_list_keywords): New variable.
3223 * script.h (Script_options::define_dynamic_list): New function
3225 (read_dynamic_list): New function prototype.
3226 * symtab.cc (strprefix): New macro.
3227 (Symbol::should_add_dynsym_entry): Support dynamic_list,
3228 dynamic_list_data, dynamic_list_cpp_new, and
3229 dynamic_list_cpp_typeinfo.
3230 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
3231 (dynamic_list_expr): New rule.
3232 (dynamic_list_nodes): Likewise.
3233 (dynamic_list_node): Likewise.
3234 * testsuite/Makefile.am (dynamic_list): New test.
3235 * testsuite/Makefile.in: Regenerated.
3236 * testsuite/dynamic_list.t: New file.
3237 * testsuite/dynamic_list.sh: New file.
3239 2008-11-05 Craig Silverstein <csilvers@google.com>
3241 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
3242 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
3243 (t11_last): Likewise.
3244 * testsuite/ver_test_6.c (main): Likewise.
3246 2008-10-07 Cary Coutant <ccoutant@google.com>
3248 * options.c (General_options::finalize): Add check for -static and
3250 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
3253 2008-10-02 Cary Coutant <ccoutant@google.com>
3255 * plugin.cc (make_sized_plugin_object): Fix conditional
3256 compilation to work when not all targets are enabled.
3258 2008-09-29 Cary Coutant <ccoutant@google.com>
3260 * archive.cc (Archive::get_file_and_offset): Use filename instead
3261 of name to get library path.
3262 (Archive::include_member): Unlock external member of a thin archive.
3264 * testsuite/Makefile.am (TEST_AR): New variable.
3265 (thin_archive_test_1): New test.
3266 (thin_archive_test_2): New test.
3267 * testsuite/Makefile.in: Regenerate.
3268 * testsuite/thin_archive_main.cc: New file.
3269 * testsuite/thin_archive_test_1.cc: New file.
3270 * testsuite/thin_archive_test_2.cc: New file.
3271 * testsuite/thin_archive_test_3.cc: New file.
3272 * testsuite/thin_archive_test_4.cc: New file.
3274 2008-09-29 Cary Coutant <ccoutant@google.com>
3276 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
3277 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
3279 (Sized_relobj::do_finalize_local_symbols): Likewise.
3280 (Sized_relobj::map_to_kept_section): Likewise.
3281 * object.h (Sized_relobj::invalid_address): New constant.
3282 (Sized_relobj::do_output_section_offset): Check for invalid_address
3284 * output.cc (Output_reloc::local_section_offset): Use constant
3285 invalid_address instead of -1U.
3286 (Output_reloc::get_address): Likewise.
3287 (Output_section::output_address): Change -1U to -1ULL.
3288 * output.h (Output_reloc::invalid_address): New constant.
3289 * reloc.cc (Sized_relobj::write_sections): Use constant
3290 invalid_address instead of -1U.
3291 (Sized_relobj::relocate_sections): Likewise.
3292 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
3293 values for merge sections.
3294 * target-reloc.h (relocate_for_relocatable): Use constant
3295 invalid_address instead of -1U.
3297 2008-09-19 Cary Coutant <ccoutant@google.com>
3299 Add plugin functionality for link-time optimization (LTO).
3300 * configure.ac (plugins): Add --enable-plugins option.
3301 * configure: Regenerate.
3302 * config.in: Regenerate.
3303 * Makefile.am (LIBDL): New variable.
3304 (CCFILES): Add plugin.cc.
3305 (HFILES): Add plugin.h.
3306 (ldadd_var): Add LIBDL.
3307 * Makefile.in: Regenerate.
3309 * archive.cc: Include "plugin.h".
3310 (Archive::setup): Don't preread archive symbols when using a plugin.
3311 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
3312 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
3314 (Archive::include_member): Add symbols from plugin objects.
3315 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
3316 * descriptors.cc (Descriptors::open): Check for file descriptors
3317 abandoned by plugins.
3318 (Descriptors::claim_for_plugin): New function.
3319 * descriptors.h (Descriptors::claim_for_plugin): New function.
3320 (Open_descriptor::is_claimed): New field.
3321 (claim_descriptor_for_plugin): New function.
3322 * fileread.cc (File_read::claim_for_plugin): New function.
3323 * fileread.h (File_read::claim_for_plugin): New function.
3324 (File_read::descriptor): New function.
3325 * gold.cc: Include "plugin.h".
3326 (queue_initial_tasks): Add task to call plugin hooks for generating
3328 * main.cc: Include "plugin.h".
3329 (main): Load plugin libraries.
3330 * object.h (Pluginobj): Declare.
3331 (Object::pluginobj): New function.
3332 (Object::do_pluginobj): New function.
3333 (Object::set_target): New function.
3334 * options.cc: Include "plugin.h".
3335 (General_options::parse_plugin): New function.
3336 (General_options::General_options): Initialize plugins_ field.
3337 (General_options::add_plugin): New function.
3338 * options.h (Plugin_manager): Declare.
3339 (General_options): Add --plugin option.
3340 (General_options::has_plugins): New function.
3341 (General_options::plugins): New function.
3342 (General_options::add_plugin): New function.
3343 (General_options::plugins_): New field.
3344 * plugin.cc: New file.
3345 * plugin.h: New file.
3346 * readsyms.cc: Include "plugin.h".
3347 (Read_symbols::do_read_symbols): Check for archive before checking
3348 for ELF file. Call plugin hooks to claim files.
3349 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
3350 from a real object file; force override when processing replacement
3352 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
3353 (Symbol::init_base_object): Likewise.
3354 (Symbol::init_base_output_data): Likewise.
3355 (Symbol::init_base_output_segment): Likewise.
3356 (Symbol::init_base_constant): Likewise.
3357 (Symbol::init_base_undefined): Likewise.
3358 (Symbol::output_section): Assert that object is not a plugin.
3359 (Symbol_table::add_from_pluginobj): New function.
3360 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
3362 (Symbol_table::sized_write_globals): Likewise.
3363 (Symbol_table::add_from_pluginobj): Instantiate template.
3364 * symtab.h (Sized_pluginobj): Declare.
3365 (Symbol::in_real_elf): New function.
3366 (Symbol::set_in_real_elf): New function.
3367 (Symbol::in_real_elf_): New field.
3368 (Symbol_table::add_from_pluginobj): New function.
3370 * testsuite/Makefile.am (AM_CFLAGS): New variable.
3371 (LIBDL): New variable.
3373 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
3374 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
3375 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
3376 (MOSTLYCLEANFILES): Likewise.
3377 * testsuite/Makefile.in: Regenerate.
3378 * testsuite/plugin_test.c: New file.
3379 * testsuite/plugin_test_1.sh: New file.
3380 * testsuite/plugin_test_2.sh: New file.
3382 2008-09-16 Ian Lance Taylor <iant@google.com>
3384 * target-reloc.h (relocate_section): Check whether a symbol is
3385 defined by the ABI before reporting an undefined symbol error.
3386 * target.h (Target::is_defined_by_abi): Make parameter const.
3387 (Target::do_is_defined_by_abi): Likewise.
3388 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
3389 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
3390 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
3391 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
3392 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
3393 * testsuite/Makefile.in: Rebuild.
3395 * fileread.cc (make_view): Add casts to avoid warning.
3397 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
3399 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
3400 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3402 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
3404 * options.h (General_options::output_is_executable): New.
3405 (General_options::output_is_pie): New.
3406 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
3407 for shared libraries.
3408 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3410 2008-09-11 Chris Demetriou <cgd@google.com>
3412 * options.h (origin): New -z option.
3413 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
3414 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
3417 2008-09-05 Cary Coutant <ccoutant@google.com>
3419 * fileread.cc (File_read::make_view): Add check for attempt to map
3422 2008-09-05 Cary Coutant <ccoutant@google.com>
3424 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
3425 explicit instantiations.
3427 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
3430 * options.cc (General_options::finalize): Allow undefined symbols
3431 in shlibs if linking -shared.
3434 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
3435 symbols as not needing a dynsym entry.
3437 2008-08-20 Craig Silverstein <csilvers@google.com>
3439 * fileread.cc (File_read::open): Do not lock the file unless it
3440 was successfully opened.
3442 2008-08-14 Cary Coutant <ccoutant@google.com>
3444 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
3445 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
3446 * testsuite/tls_test.cc (struct int128): 128-bit struct
3447 for testing TLS relocs with non-zero addend.
3448 (v12): New TLS variable.
3450 (t_last): Add check for v12.
3451 * testsuite/tls_test.h (t12): New function.
3452 * testsuite/tls_test_main.cc (thread_routine): Call new test.
3454 2008-08-13 Ian Lance Taylor <iant@google.com>
3456 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
3457 set tls_segment_ or relro_segment_.
3458 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
3460 * output.h (Output_section::clear_is_relro): New function.
3461 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
3462 sections specially even when output_data_ is empty.
3463 (Output_segment::maximum_alignment): When first section is relro,
3464 only force alignment for PT_LOAD segments.
3465 * script.cc (script_data_segment_align): New function.
3466 (script_data_segment_relro_end): New function.
3467 * script-c.h (script_data_segment_align): Declare.
3468 (script_data_segment_relro_end): Declare.
3469 * script-sections.h (class Script_sections): Declare
3470 data_segment_align and data_segment_relro_end. Add fields
3471 segment_align_index_ and saw_relro_end_.
3472 * script-sections.cc (class Sections_element): Add set_is_relro
3473 virtual function. Add new bool* parameter to place_orphan_here.
3474 Add get_output_section virtual function.
3475 (class Output_section_definition): Add set_is_relro. Add new
3476 bool* parameter to place_orphan_here. Add get_output_section.
3477 Add is_relro_ field.
3478 (Output_section_definition::Output_section_definition): Initialize
3479 evaluated_address_, evaluated_load_address, evaluated_addralign_,
3480 and is_relro_ fields.
3481 (Output_section_definition::place_orphan_here): Add is_relro
3483 (Output_section_definition::set_section_addresses): Set relro for
3485 (Output_section_definition::alternate_constraint): Likewise.
3486 (class Orphan_output_section): Add new bool* parameter to
3487 place_orphan_here. Add get_output_section.
3488 (Orphan_output_section::place_orphan_here): Add is_relro
3490 (Script_sections::Script_sections): Initialize
3491 data_segment_align_index_ and saw_relro_end_.
3492 (Script_sections::data_segment_align): New function.
3493 (Script_sections::data_segment_relro_end): New function.
3494 (Script_sections::place_orphan): Set or clear is_relro.
3495 (Script_sections::set_section_addresses): Force alignment of first
3497 * yyscript.y (exp): Call script_data_segment_align and
3498 script_data_segment_relro_end.
3499 * testsuite/relro_script_test.t: New file.
3500 * testsuite/relro_test.cc (using_script): Declare.
3501 (t1, t2): Test using_script.
3502 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
3503 (relro_script_test_SOURCES): Define.
3504 (relro_script_test_DEPENDENCIES): Define.
3505 (relro_script_test_LDFLAGS): Define.
3506 (relro_script_test_LDADD): Define.
3507 (relro_script_test.so): New target.
3508 * testsuite/Makefile.in: Rebuild.
3510 2008-08-06 Cary Coutant <ccoutant@google.com>
3512 * archive.cc (Archive::total_archives, Archive::total_members)
3513 (Archive::total_members_loaded): New variables.
3514 (Archive::setup): Add parameter. Add option to preread
3516 (Archive::read_armap): Add counter.
3517 (Archive::get_file_and_offset): New function.
3518 (Archive::get_elf_object_for_member): New function.
3519 (Archive::read_all_symbols): New function.
3520 (Archive::read_symbols): New function.
3521 (Archive::add_symbols): Add counters.
3522 (Archive::include_all_members): Use armap to find members if it's
3524 (Archive::include_member): Skip reading symbols if already read.
3525 Factored code into Archive::get_file_and_offset and
3526 Archive::get_elf_object_for_member. Changed call to
3527 Mapfile::report_include_archive_member.
3528 (Archive::print_stats): New function.
3529 * archive.h: Declare Object and Read_symbols_data classes.
3530 (Archive::Archive): Add initializers for new members.
3531 (Archive::setup): Add parameter.
3532 (Archive::print_stats): New function.
3533 (Archive::total_archives, Archive::total_members)
3534 (Archive::total_members_loaded): New variables.
3535 (Archive::get_file_and_offset): New function.
3536 (Archive::get_elf_object_for_member): New function.
3537 (Archive::read_all_symbols): New function.
3538 (Archive::read_symbols): New function.
3539 (Archive::Archive_member): New class.
3540 (Archive::members_): New member.
3541 (Archive::num_members_): New member.
3542 * main.cc: Include archive.h.
3543 (main): Call Archive::print_stats.
3544 * mapfile.cc (Mapfile::report_include_archive_member): Delete
3545 archive parameter; member_name is now the fully-decorated name.
3546 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
3547 * options.h: (General_options): Add --preread-archive-symbols option.
3548 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
3551 2008-08-04 Ian Lance Taylor <iant@google.com>
3553 * symtab.h (Symbol::use_plt_offset): New function.
3554 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
3555 * powerpc.cc (Relocate::relocate): Likewise.
3556 * sparc.cc (Relocate::relocate): Likewise.
3557 * x86_64.cc (Relocate::relocate): Likewise.
3558 * testsuite/weak_plt.sh: New test.
3559 * testsuite/weak_plt_main.cc: New test.
3560 * testsuite/weak_plt_shared.cc: New test.
3561 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
3562 (check_PROGRAMS): Add weak_plt.
3563 (check_DATA): Add weak_plt_shared.so.
3564 (weak_plt_main_pic.o, weak_plt): New targets.
3565 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
3566 * testsuite/Makefile.in: Rebuild.
3568 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
3570 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
3571 * testsuite/Makefile.in: Rebuild.
3573 2008-08-04 Alan Modra <amodra@bigpond.net.au>
3575 * Makefile.am (POTFILES.in): Set LC_ALL=C.
3576 * Makefile.in: Regenerate.
3577 * po/POTFILES.in: Regenerate.
3579 2008-07-29 Ian Lance Taylor <iant@google.com>
3581 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
3582 symbols before other symbols.
3583 * testsuite/script_test_2.cc (test_addr): Declare.
3584 (test_addr_alias): Declare.
3585 (main): Check that test_addr and test_addr_alias have the right
3587 * testsuite/script_test_2.t: Define test_addr_alias and
3590 2008-07-24 Ian Lance Taylor <iant@google.com>
3593 * descriptors.cc: New file.
3594 * descriptors.h: New file.
3595 * gold-threads.h (class Hold_optional_lock): New class.
3596 * fileread.cc: Include "descriptors.h".
3597 (File_read::~File_read): Release descriptor rather than closing
3599 (File_read::open) [file]: Call open_descriptor rather than open.
3600 Set is_descriptor_opened_.
3601 (File_read::open) [memory]: Assert that descriptor is not open.
3602 (File_read::reopen_descriptor): New function.
3603 (File_read::release): Release descriptor.
3604 (File_read::do_read): Make non-const. Reopen descriptor.
3605 (File_read::read): Make non-const.
3606 (File_read::make_view): Reopen descriptor.
3607 (File_read::do_readv): Likewise.
3608 * fileread.h (class File_read): Add is_descriptor_opened_ field.
3609 Update declarations.
3610 * layout.cc: Include "descriptors.h".
3611 (Layout::create_build_id): Use open_descriptor rather than open.
3612 * output.cc: Include "descriptors.h".
3613 (Output_file::open): Use open_descriptor rather than open.
3614 * archive.cc (Archive::const_iterator): Change Archive to be
3616 (Archive::begin, Archive::end): Make non-const.
3617 (Archive::count_members): Likewise.
3618 * archive.h (class Archive): Update declarations.
3619 * object.h (Object::read): Make non-const.
3620 * Makefile.am (CCFILES): Add descriptors.cc.
3621 (HFILES): Add descriptors.h.
3622 * Makefile.in: Rebuild.
3625 * gold.h: Always include <clocale>. Add Solaris workarounds
3626 following code in binutils/sysdep.h.
3629 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
3630 this->eh_frame_hdr_ is NULL before using it.
3632 * dynobj.cc (Versions::Versions): Update comment.
3634 * dynobj.cc (Versions::Versions): If there is an soname, use it as
3635 the base version name.
3637 * stringpool.cc (Stringpool_template::add_with_length): Set key to
3638 array size plus one.
3639 (Stringpool_template::set_string_offsets): Subtract one from key
3640 before using it as an array index.
3641 (Stringpool_template::get_offset_with_length): Likewise.
3642 (Stringpool_template::write_to_buffer): Likewise.
3643 * stringpool.h (Stringpool_template::get_offset_from_key):
3646 2008-07-23 Ian Lance Taylor <iant@google.com>
3649 * object.h (Merged_symbol_value::value): Do our best to handle a
3653 * script.cc (Version_script_info::get_versions): Don't add empty
3654 version tag to return value.
3655 (Version_script_info::get_symbol_version_helper): Change return
3656 type to bool. Add pversion parameter. Change all callers.
3657 (script_register_vers_node): Don't require a non-NULL tag.
3658 * script.h (class Version_script_info): Update declarations.
3659 (Version_script_info::get_symbol_version): Change return type to
3660 bool. Add version parameter. Change all callers.
3661 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
3662 handling. Handle an empty version from a version script.
3663 (Symbol_table::define_special_symbol): Likewise.
3664 * testsuite/ver_test_10.script: New file.
3665 * testsuite/ver_test_10.sh: New file.
3666 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
3667 (check_DATA): Add ver_test_10.syms.
3668 (ver_test_10.syms, ver_test_10.so): New target.
3669 * testsuite/Makefile.in: Rebuild.
3671 2008-07-23 Simon Baldwin <simonb@google.com>
3673 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
3674 to zero for undefined symbols from dynamic libraries.
3676 2008-07-23 Ian Lance Taylor <iant@google.com>
3678 * symtab.cc (Symbol_table::resolve): Remove version parameter.
3680 * symtab.h (class Symbol_table): Update declaration.
3681 * testsuite/ver_test_9.cc: New file.
3682 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
3683 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
3684 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
3685 (ver_test_9.so, ver_test_9.o): New targets.
3686 * testsuite/Makefile.in: Rebuild.
3688 2008-07-22 Ian Lance Taylor <iant@google.com>
3690 * options.h (class General_options): Define --check-sections.
3691 * layout.cc (Layout::set_segment_offsets): Handle
3694 * options.h (class General_options): Define -n/--nmagic and
3696 * options.cc (General_options::finalize): For -n/--nmagic or
3697 -N/--omagic, set -static.
3698 * layout.cc (Layout::attach_allocated_section_to_segment): If
3699 -N/--omagic, don't put read-only and read-write sections in
3701 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
3702 finding a read-only segment.
3703 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
3704 don't set the minimum segment alignment to the common page size,
3705 and don't set the file offset to the address modulo the page size.
3706 * script-sections.cc (Script_sections::create_segments): If
3707 -n/--omagic, don't put read-only and read-write sections in
3710 * cref.cc: New file.
3712 * options.h (class General_options): Add --print-symbol-counts.
3713 * main.cc (main): Issue defined symbol report if requested.
3714 * archive.cc (Archive::interpret_header): Make into a const member
3716 (Archive::add_symbols): Call Input_objects::archive_start and
3718 (Archive::const_iterator): Define new class.
3719 (Archive::begin, Archive::end): New functions.
3720 (Archive::include_all_members): Rewrite to use iterator.
3721 (Archive::count_members): New function.
3722 * archive.h (class Archive): Update declarations.
3723 (Archive::filename): New function.
3724 * object.cc: Include "cref.h".
3725 (Sized_relobj::Sized_relobj): Initialize defined_count_.
3726 (Sized_relobj::do_get_global_symbol_counts): New function.
3727 (Input_objects::add_object): Add object to cross-referencer.
3728 (Input_objects::archive_start): New function.
3729 (Input_objects::archive_stop): New function.
3730 (Input_objects::print_symbol_counts): New function.
3731 * object.h: Declare Cref and Archive.
3732 (Object::get_global_symbol_counts): New function.
3733 (Object::do_get_global_symbol_counts): New pure virtual function.
3734 (class Sized_relobj): Add defined_count_ field. Update
3736 (class Input_objects): Add cref_ field. Update constructor.
3737 Update declarations.
3738 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
3740 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
3742 (Sized_dynobj::do_get_global_symbol_counts): New function.
3743 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
3744 defined_count_. Update declarations. Define Symbols typedef.
3745 * symtab.cc (Symbol_table::add_from_relobj): Add defined
3746 parameter. Change all callers.
3747 (Symbol_table::add_from_dynobj): Add sympointers and defined
3748 parameters. Change all callers.
3749 * symtab.h (class Symbol_table): Update declarations.
3750 * Makefile.am (CCFILES): Add cref.cc.
3751 (HFILES): Add cref.h.
3752 * Makefile.in: Rebuild.
3754 2008-07-22 Simon Baldwin <simonb@google.com>
3756 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
3757 to zero when writing undefined symbols.
3759 2008-07-22 Ian Lance Taylor <iant@google.com>
3761 * output.cc (Output_section::add_input_section): Don't try to
3762 merge empty merge sections.
3764 2008-07-21 Craig Silverstein <csilvers@google.com>
3766 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3767 Include symbol version in error message.
3769 2008-07-20 Chris Demetriou <cgd@google.com>
3771 * configure.ac (gold_cv_c_random_seed): New configured variable.
3772 (RANDOM_SEED_CFLAGS): New substituted variable.
3773 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
3774 * configure: Rebuild.
3775 * Makefile.in: Likewise.
3776 * testsuite/Makefile.in: Likewise.
3778 2008-07-18 Ian Lance Taylor <iant@google.com>
3780 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
3781 where we see NAME/NULL and NAME/VERSION as separate symbols.
3782 * testsuite/ver_test_main.cc (main): Call t4.
3783 (t4, t4_2a): Define.
3784 * testsuite/ver_test_2.cc (t4_2): Define.
3785 * testsuite/ver_test_2.script: Put t4_2a in VER2.
3786 * testsuite/ver_test_4.cc (t4_2a): Define.
3787 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3788 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3790 2008-07-17 Ian Lance Taylor <iant@google.com>
3792 * dynobj.cc (Versions::add_def): If we give an error about a
3793 missing version, go ahead and create the version anyhow.
3795 2008-07-10 Ian Lance Taylor <iant@google.com>
3797 Handle output sections with more than 0x7fffffff bytes.
3798 * object.h (class Relobj): Change map_to_output_ to
3799 output_sections_, and just keep a section pointer. Change all
3800 uses. Move comdat group support to Sized_relobj.
3801 (Relobj::is_section_specially_mapped): Remove.
3802 (Relobj::output_section): Remove poff parameter. Change all
3804 (Relobj::output_section_offset): New function.
3805 (Relobj::set_section_offset): Rewrite.
3806 (Relobj::map_to_output): Remove.
3807 (Relobj::output_sections): New function.
3808 (Relobj::do_output_section_offset): New pure virtual function.
3809 (Relobj::do_set_section_offset): Likewise.
3810 (class Sized_relobj): Add section_offsets_ field. Add comdat
3811 group support from Relobj. Update declarations.
3812 (Sized_relobj::get_output_section_offset): New function.
3813 (Sized_relobj::do_output_section_offset): New function.
3814 (Sized_relobj::do_set_section_offset): New function.
3815 * object.cc (Relobj::output_section_address): Remove.
3816 (Sized_relobj::Sized_relobj): Initialize new fields.
3817 (Sized_relobj::include_section_group): Cast find_kept_object to
3819 (Sized_relobj::include_linkonce_section): Likewise.
3820 (Sized_relobj::do_layout): Use separate arrays for output section
3822 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3824 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3825 output_sections and section_offsets.
3826 (Sized_relobj::write_local_symbols): Likewise.
3827 (map_to_kept_section): Compute output address directly.
3828 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3829 output_sections and section_offsets.
3830 (Sized_relobj::write_sections): Likewise.
3831 (Sized_relobj::relocate_sections): Likewise.
3832 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3833 * output.h (class Output_reloc): Update declarations. Change
3834 u2_.relobj to Sized_relobj*.
3835 (class Output_data_reloc): Change add functions to use
3837 * output.cc (Output_reloc::Output_reloc): Change relobj to
3839 (Output_reloc::local_section_offset): Change return type to
3840 Elf_Addr. Use get_output_section_offset.
3841 (Output_reloc::get_address): Likewise.
3842 (Output_section::is_input_address_mapped): Don't call
3843 is_section_specially_mapped.
3844 (Output_section::output_offset): Likewise.
3845 (Output_section::output_address): Likewise.
3846 (Output_section::starting_output_address): Likewise.
3847 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3848 parameter to Sized_relobj*.
3849 (Copy_relocs::need_copy_reloc): Likewise.
3850 (Copy_relocs::save): Likewise.
3851 * copy-relocs.h (class Copy_relocs): Update declarations.
3852 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3853 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3854 * target-reloc.h (relocate_for_relocatable): Change
3855 offset_in_output_section type to Elf_Addr. Change code that uses
3857 * layout.cc (Layout::layout): Always set *off.
3858 * mapfile.cc (Mapfile::print_input_section): Use
3859 output_section_offset.
3860 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3862 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3863 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3864 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3866 2008-07-03 Ian Lance Taylor <iant@google.com>
3868 * layout.cc (Layout::include_section): Do not discard unrecognized
3869 SHT_STRTAB sections.
3871 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3873 * script.cc (Lex::can_continue_name): Make '?' allowable in
3874 version-script names.
3875 * testsuite/version_script.map: Change glob pattern to use '?'
3877 2008-06-30 Manish Singh <yosh@gimp.org>
3880 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3883 2008-06-30 Ian Lance Taylor <iant@google.com>
3887 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3888 versions]: Don't try to read the value in the contents, since we
3889 don't use it. Use the template endianness when writing.
3891 2008-06-25 Cary Coutant <ccoutant@google.com>
3893 * fileread.cc (File_read::make_view): Assert on zero-length view.
3894 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3895 symbol table when there are no symbols to read.
3897 2008-06-23 Craig Silverstein <csilvers@google.com>
3899 * version.cc (version_string): Bump to 1.7
3901 2008-06-18 Craig Silverstein <csilvers@google.com>
3903 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3904 constant 0xFFFF to type Valtype.
3905 (Powerpc_relocate_functions::rel16_ha): Likewise.
3907 2008-06-17 Ian Lance Taylor <iant@google.com>
3909 * output.h (Output_section::Input_section): Initialize p2align_ to
3910 zero for Output_section_data constructors.
3911 (Output_section::Input_section::addralign): If not an input
3912 section, return the alignment of the Output_section_data.
3913 * testsuite/copy_test.cc: New file.
3914 * testsuite/copy_test_1.cc: New file.
3915 * testsuite/copy_test_2.cc: New file.
3916 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3917 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3918 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3919 (copy_test_1_pic.o, copy_test_1.so): New targets.
3920 (copy_test_2_pic.o, copy_test_2.so): New targets.
3921 * testsuite/Makefile.in: Rebuild.
3923 * script-sections.cc (Script_sections::place_orphan): Initialize
3924 local variable exact.
3926 2008-06-13 David Edelsohn <edelsohn@gnu.org>
3928 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3930 2008-06-12 David Edelsohn <edelsohn@gnu.org>
3931 David S. Miller <davem@davemloft.net>
3933 * powerpc.cc: New file.
3934 * Makefile.am (TARGETSOURCES): Add powerpc.cc
3935 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
3936 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
3937 * Makefile.in: Rebuild.
3939 2008-06-09 Ian Lance Taylor <iant@google.com>
3941 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
3943 (throwing, orig_terminate): New static variables.
3944 (terminate_handler): New static function.
3945 (t2): Set terminate handler.
3947 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
3950 * binary.cc (Binary_to_elf::sized_convert): Fix .data
3953 2008-05-30 Cary Coutant <ccoutant@google.com>
3955 * archive.cc (Archive::include_all_members) Correct to step
3956 over symbol table and extended name table in thin archives.
3958 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
3961 * target-reloc.h (relocate_for_relocatable): Fix new_offset
3964 2008-05-28 Caleb Howe <cshowe@google.com>
3966 * reduced_debug_output.cc: New file.
3967 * reduced_debug_output.h: New file.
3968 * options.h (class General_options): Add --strip-debug-non-line.
3969 * options.cc (General_options::finalize): Add strip_debug_non_line
3970 to the strip heirarchy.
3971 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
3973 * layout.cc: Include "reduced_debug_output.h".
3974 (Layout::Layout): Initialize new fields.
3975 (line_only_debug_sections): New static array.
3976 (is_lines_only_debug_sections): New static inline function.
3977 (Layout::include_section): Handle --strip-debug-non-line.
3978 (Layout::make_output_section): If --strip-debug-non-line, build
3979 new output sections for .debug_abbrev and .debug_info.
3980 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
3981 gold. Warn about possible overflow.
3982 (read_signed_LEB_128): Likewise.
3983 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
3984 (read_signed_LEB_128): Declare.
3985 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
3986 (HFILES): Add reduced_debug_output.h.
3987 * Makefile.in: Rebuild.
3989 2008-05-21 Ian Lance Taylor <iant@google.com>
3991 * mapfile.cc: New file.
3992 * mapfile.h: New file.
3993 * options.h (class General_options): Add -M/--print-map and -Map.
3994 * options.cc (General_options::finalize): Make -M equivalent to
3996 * main.cc: Include <cstdio> and "mapfile.h".
3997 (main): Open mapfile if requested.
3998 * gold.cc (class Middle_runner): Add mapfile_ field. Update
3999 constructor. Change caller.
4000 (queue_initial_tasks): Add mapfile parameter. Change caller.
4001 (queue_middle_tasks): Likewise.
4002 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4004 * archive.cc: Include "mapfile.h".
4005 (Archive::add_symbols): Add mapfile parameter. Change all
4006 callers. Pass mapfile, symbol, and reason to include_member.
4007 (Archive::include_all_members): Add mapfile parameter. Change all
4009 (Archive::include_member): Add mapfile, sym, and why parameters.
4010 Change all callers. Report inclusion to map file.
4011 * archive.h: Include "fileread.h".
4012 (class Archive): Update declarations.
4013 (Archive::file): New const method.
4014 (class Add_archive_symbols): Add mapfile_ field. Update
4015 constructor. Change all callers.
4016 * readsyms.h (class Read_symbols): Likewise.
4017 (class Finish_group): Likewise.
4018 (class Read_script): Likewise.
4019 * common.cc: Include "mapfile.h".
4020 (Symbol_table::allocate_commons): Add mapfile parameter. Change
4022 (Symbol_table::do_allocate_commons): Likewise.
4023 (Symbol_table::do_allocate_commons_list): Likewise. Report common
4024 symbol allocation to mapfile.
4025 * common.h (class Allocate_commons_task): Add mapfile_ field.
4026 Update constructor. Change all callers.
4027 * symtab.h (class Symbol_table): Update declarations.
4028 * layout.cc: Include "mapfile.h".
4029 (Layout_task_runner::run): Print information to mapfile.
4030 (Layout::create_gold_note): Change Output_data_fixed_space to
4031 Output_data_zero_fill.
4032 (Layout::create_build_id): Likewise.
4033 (Layout::print_to_mapfile): New function.
4034 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
4035 constructor. Change caller.
4036 (class Layout): Declare print_to_mapfile.
4037 * output.cc (Output_section::Input_section::print_to_mapfile): New
4039 (Output_section::add_input_section): If producing a map, always
4040 add to input_sections_ list.
4041 (Output_section::do_print_to_mapfile): New function.
4042 (Output_segment::print_sections_to_mapfile): New function.
4043 (Output_segment::print_section_list_to_mapfile): New function.
4044 * output.h: Include "mapfile.h".
4045 (Output_data::print_to_mapfile): New function.
4046 (Output_data::do_print_to_mapfile): New virtual function.
4047 (Output_segment_headers::do_print_to_mapfile): New function.
4048 (Output_file_header::do_print_to_mapfile): New function.
4049 (Output_data_const::do_print_to_mapfile): New function.
4050 (class Output_data_const_buffer): Add map_name_ field. Update
4051 constructor. Change all callers. Add do_print_to_mapfile
4053 (class Output_data_fixed_space): Likewise.
4054 (class Output_data_space): Likewise.
4055 (class Output_data_zero_fill): New class.
4056 (Output_data_strtab::do_print_to_mapfile): New function.
4057 (Output_data_reloc_base::do_print_to_mapfile): New function.
4058 (Output_relocatable_relocs::do_print_to_mapfile): New function.
4059 (Output_data_group::do_print_to_mapfile): New function.
4060 (Output_data_got::do_print_to_mapfile): New function.
4061 (Output_data_dynamic::do_print_to_mapfile): New function.
4062 (Output_symtab_xindex::do_print_to_mapfile): New function.
4063 (class Output_section): Declare do_print_to_mapflie. Declare
4064 print_to_mapfile in Input_section.
4065 (class Output_segment): Declare new functions.
4066 * object.h (Sized_relobj::symbol_count): New function.
4067 * script-sections.cc
4068 (Output_section_element_dot_assignment::set_section_addresses):
4069 Change Output_data_fixed_space to Output_data_zero_fill.
4070 (Output_data_expression::do_print_to_mapfile): New function.
4071 * script.cc (read_input_script): Add mapfile parameter. Change
4073 * script.h (read_input_script): Update declaration.
4074 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4075 (Eh_frame::do_print_to_mapfile): New function.
4076 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4077 (Output_merge_string::do_print_to_mapfile): New function.
4078 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4080 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4082 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4084 * Makefile.am (CCFILES): Add mapfile.cc.
4085 (HFILES): Add mapfile.h.
4086 * Makefile.in: Rebuild.
4088 2008-05-19 Ian Lance Taylor <iant@google.com>
4090 * options.h (class General_options): Add -z relro.
4091 * layout.cc (Layout::Layout): Initialize relro_segment_.
4092 (Layout::add_output_section_data): Return the output section.
4093 (Layout::make_output_section): Rcognize relro sections and mark
4095 (Layout::attach_allocated_section_to_segment): Put relro sections
4096 in a PT_GNU_RELRO segment.
4097 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4099 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4101 (Layout::linkonce_mapping): Map d.rel.ro.local to
4103 (Layout::output_section_name): Us .data.rel.ro.local for any
4104 section which begins with that.
4105 * layout.h (class Layout): Update add_output_section_data
4106 declaration. Add relro_segment_ field.
4107 * output.cc (Output_section::Output_section): Initialize is_relro_
4108 and is_relro_local_ fields.
4109 (Output_segment::add_output_section): Group relro sections.
4110 (Output_segment::is_first_section_relro): New function.
4111 (Output_segment::maximum_alignment): If there is a relro section,
4112 align the segment to the common page size.
4113 (Output_segment::set_section_addresses): Track whether we are
4114 looking at relro sections. If the last section is a relro
4115 section, align to the common page size.
4116 (Output_segment::set_section_list_addresses): Add in_relro
4117 parameter. Change all callers. Align to the page size when
4118 moving from relro to non-relro section.
4119 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4121 * output.h (class Output_section): Add is_relro_ and
4122 is_relro_local_ fields.
4123 (Output_section::is_relro): New function.
4124 (Output_section::set_is_relro): New function.
4125 (Output_section::is_relro_local): New function.
4126 (Output_section::set_is_relro_local): New function.
4127 (class Output_segment): Update declarations.
4128 * i386.cc (Target_i386::got_section): Mark .got section as relro.
4129 * sparc.cc (Target_sparc::got_section): Likewise.
4130 * x86_64.cc (Target_x86_64::got_section): Likewise.
4131 * testsuite/relro_test_main.cc: New file.
4132 * testsuite/relro_test.cc: New file.
4133 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
4134 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
4135 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
4136 (relro_test.so, relro_test_pic.o): New targets.
4137 * testsuite/Makefile.in: Rebuild.
4139 2008-05-16 Ian Lance Taylor <iant@google.com>
4141 * output.cc (Output_segment::add_output_section): Remove front
4143 * output.h (class Output_segment): Remove
4144 add_initial_output_section and overloaded add_output_section.
4145 Update declaration of remaining add_output_section.
4146 * layout.cc (Layout::create_interp): Call add_output_section
4147 rather than add_initial_output_section.
4148 (Layout::finish_dynamic_section): Likewise.
4150 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
4151 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
4152 know the dynamic type.
4153 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
4154 field. Initialize it in constructor.
4155 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
4156 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
4157 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
4160 * output.cc (Output_reloc::get_address): Change return type to
4162 * output.h (class Output_reloc): Update get_address declaration.
4163 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
4164 for section addresses.
4166 2008-05-09 Ian Lance Taylor <iant@google.com>
4169 * gold.cc (gold_nomem): Use return value of write.
4171 2008-05-08 Ian Lance Taylor <iant@google.com>
4173 * symtab.c (Symbol::init_base_output_data): Add version
4174 parameter. Change all callers.
4175 (Symbol::init_base_output_segment): Likewise.
4176 (Symbol::init_base_constant): Likewise.
4177 (Symbol::init_base_undefined): Likewise.
4178 (Sized_symbol::init_output_data): Likewise.
4179 (Sized_symbol::init_output_segment): Likewise.
4180 (Sized_symbol::init_constant): Likewise.
4181 (Sized_symbol::init_undefined): Likewise.
4182 (Symbol_table::do_define_in_output_data): If the new symbol has a
4183 version, mark it as the default.
4184 (Symbol_table::do_define_in_output_segment): Likewise.
4185 (Symbol_table::do_define_as_constant): Likewise.
4186 * symtab.h (class Symbol): Update declarations.
4187 (class Sized_symbol): Likewise.
4188 * resolve.cc (Symbol::override_version): New function.
4189 (Symbol::override_base): Call override_version.
4190 (Symbol::override_base_with_special): Likewise.
4191 * testsuite/ver_script_8.script: New file.
4192 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
4193 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
4194 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
4195 (ver_test_8_1.so, ver_test_8_2.so): New targets.
4197 2008-05-06 Ian Lance Taylor <iant@google.com>
4200 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
4202 (class General_options): Remove existing --undefined, and add
4203 --no-undefined instead. Add new --undefined as synonym for -u.
4204 * archive.cc (Archive::add_symbols): Check whether symbol was
4206 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
4207 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
4208 all uses. Add IS_UNDEFINED. Update declarations to split
4209 different versions of init_base. Declare init_base_undefined.
4210 (Symbol::is_defined): Handle IS_UNDEFINED.
4211 (Symbol::is_undefined): Likewise.
4212 (Symbol::is_weak_undefined): Call is_undefined.
4213 (Symbol::is_absolute): Handle IS_CONSTANT.
4214 (class Sized_symbol): Update declarations to split different
4215 versions of init. Declare init_undefined.
4216 (class Symbol_table): Declare new functions.
4217 * symtab.cc (Symbol::init_base_object): Rename from init_base.
4219 (Symbol::init_base_output_data): Likewise.
4220 (Symbol::init_base_output_segment): Likewise.
4221 (Symbol::init_base_constant): Likewise.
4222 (Symbol::init_base_undefined): New function.
4223 (Sized_symbol::init_object): Rename from init. Change all
4225 (Sized_symbol::init_output_data): Likewise.
4226 (Sized_symbol::init_output_segment): Likewise.
4227 (Sized_symbol::init_constant): Likewise.
4228 (Sized_symbol::init_undefined): New function.
4229 (Symbol_table::add_undefined_symbols_from_command_line): New
4231 (Symbol_table::do_add_undefined_symbols_from_command_line): New
4233 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
4234 (Symbol::output_section): Likewise.
4235 (Symbol::set_output_section): Likewise.
4236 (Symbol_table::sized_finalize_symbol): Likewise.
4237 (Symbol_table::sized_write_globals): Likewise.
4238 * resolve.cc (Symbol_table::should_override): Likewise.
4239 (Symbol::override_base_with_special): Likewise.
4241 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
4242 symbol, change it to have default visibility.
4243 * testsuite/protected_1.cc: New file.
4244 * testsuite/protected_2.cc: New file.
4245 * testsuite/protected_3.cc: New file.
4246 * testsuite/protected_main_1.cc: New file.
4247 * testsuite/protected_main_2.cc: New file.
4248 * testsuite/protected_main_3.cc: New file.
4249 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
4250 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
4251 (protected_1_LDFLAGS, protected_1_LDADD): Define.
4252 (protected_1.so): New target.
4253 (protected_1_pic.o, protected_2_pic.o): New targets.
4254 (protected_3_pic.o): New target.
4255 (check_PROGRAMS): Add protected_2.
4256 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
4257 (protected_2_LDFLAGS, protected_2_LDADD): Define.
4258 * testsuite/Makefile.in: Rebuild.
4260 * options.h (DEFINE_var): Add set_user_set_##varname__.
4261 (DEFINE_bool_alias): New macro.
4262 (class General_options): Define -Bstatic using DEFINE_bool_alias
4263 rather than DEFINE_special. Add --undefined as an alias for -z
4265 * options.cc (General_options::parse_Bstatic): Remove.
4267 * options.h (class General_options): Add --fatal-warnings.
4268 * main.cc (main): Implement --fatal-warnings.
4269 * errors.h (Errors::warning_count): New function.
4271 * options.h (class General_options): Add -Bsymbolic-functions.
4272 * symtab.h (Symbol::is_preemptible): Check for
4273 -Bsymbolic-functions.
4275 2008-05-05 Ian Lance Taylor <iant@google.com>
4277 * options.h (DEFINE_bool): For DASH_Z, create the negative option
4278 as noVARNAME rather than no-VARNAME.
4279 (class General_options): Add option -z combreloc.
4280 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
4282 (Output_reloc::sort_before) [SHT_REL]: New function.
4283 (Output_reloc::sort_before) [SHT_RELA]: New function.
4284 (class Output_data_reloc_base): Add sort_relocs_ field. Define
4285 Sort_relocs_comparison.
4286 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
4287 parameter. Change all callers.
4288 (Output_data_reloc::Output_data_reloc) [both versions]: Add
4289 sort_relocs parameter. Change all callers.
4290 * output.cc (Output_reloc::get_address): New function, broken out
4292 (Output_reloc::write_rel): Call it.
4293 (Output_reloc::compare): New function.
4294 (Output_data_reloc_base::do_write): Optionally sort relocs.
4296 * configure.ac: If targ_extra_obj is set, link it in.
4297 * configure.tgt: Initialize all variables.
4298 (x86_64*): Set targ_extra_obj and targ_extra_size.
4299 * configure: Rebuild.
4301 * object.cc (Sized_relobj::include_section_group): Adjust section
4302 indexes read from group data. Build vector to pass to
4304 * layout.cc (Layout::layout_group): Add flags and shndxes
4305 parameters. Remove contents parameter. Change caller. Update
4306 explicit instantiations.
4307 * layout.h (class Layout): Update layout_group declaration.
4308 * output.cc (Output_data_group::Output_data_group): Add flags and
4309 input_shndxes parameters. Remove contents parameter. Change
4311 (Output_data_group::do_write): Change input_sections_ to
4313 * output.h (class Output_data_group): Update constructor
4314 declaration. Rename input_sections_ to input_shndxes_.
4315 * testsuite/many_sections_test.cc: Add template.
4317 2008-04-30 Cary Coutant <ccoutant@google.com>
4319 * target-reloc.h (relocate_section): Fix dead-pointer bug.
4321 * layout.cc (Layout::include_section): Refactored check for debug
4323 (Layout::add_comdat): Add new parameters. Change type
4324 of signature parameter. Add object and shndx to signatures table.
4325 (Layout::find_kept_object): New function.
4326 * layout.h: Include <cstring>.
4327 (Layout::is_debug_info_section): New function.
4328 (Layout::add_comdat): Add new parameters.
4329 (Layout::find_kept_object): New function.
4330 (Layout::Kept_section): New struct.
4331 (Layout::Signatures): Change type of map range.
4332 * object.cc (Relobj::output_section_address): New function.
4333 (Sized_relobj::include_section_group): Add new parameters. Change
4334 calls to Layout::add_comdat. Change to build table of kept comdat
4335 groups and table mapping discarded sections to kept sections.
4336 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
4337 (Sized_relobj::do_layout): Change calls to include_section_group and
4338 include_linkonce_section.
4339 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
4340 value to zero when section is discarded.
4341 (Sized_relobj::map_to_kept_section): New function.
4342 * object.h (Relobj::output_section_address): New function.
4343 (Relobj::Comdat_group): New type.
4344 (Relobj::find_comdat_group): New function.
4345 (Relobj::Comdat_group_table): New type.
4346 (Relobj::Kept_comdat_section): New type.
4347 (Relobj::Kept_comdat_section_table): New type.
4348 (Relobj::add_comdat_group): New function.
4349 (Relobj::set_kept_comdat_section): New function.
4350 (Relobj::get_kept_comdat_section): New function.
4351 (Relobj::comdat_groups_): New field.
4352 (Relobj::kept_comdat_sections_): New field.
4353 (Symbol_value::input_value): Update comment.
4354 (Sized_relobj::map_to_kept_section) New function.
4355 (Sized_relobj::include_linkonce_section): Add new parameter.
4356 * target-reloc.h (Comdat_behavior): New type.
4357 (get_comdat_behavior): New function.
4358 (relocate_section): Add code to map a discarded section to the
4359 corresponding kept section when applying a relocation.
4361 2008-04-30 Craig Silverstein <csilvers@google.com>
4363 * dwarf_reader.cc (next_generation_count): New static var.
4364 (Addr2line_cache_entry): New struct.
4365 (addr2line_cache): New static var.
4366 (Dwarf_line_info::one_addr2line): Added caching.
4367 (Dwarf_line_info::clear_addr2line_cache): New function.
4368 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
4369 cache-size parameter.
4370 (Dwarf_line_info::one_addr2line_cache): New function.
4371 * symtab.cc (Symbol_table::detect_odr_violations): Pass
4372 new cache-size argument to one_addr2line(), and clear cache.
4374 2008-04-28 Cary Coutant <ccoutant@google.com>
4376 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
4377 R_386_PC8 relocations.
4379 2008-04-23 Ian Lance Taylor <iant@google.com>
4381 * object.cc (Sized_relobj::include_section_group): Check for
4382 invalid section group.
4384 * object.cc (make_elf_object): Correct test for 64-bit ELF file
4387 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
4388 than read for file header.
4389 * archive.cc (Archive::include_member): Likewise.
4391 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
4393 * aclocal.m4: Regenerate.
4394 * configure: Regenerate.
4396 2008-04-19 Ian Lance Taylor <iant@google.com>
4398 * version.cc (version_string): Bump to 1.6.
4400 * testsuite/Makefile.am (many_sections_r_test): New target.
4401 (many_sections_r_test_SOURCES): Remove.
4402 (many_sections_r_test_DEPENDENCIES): Remove.
4403 (many_sections_r_test_LDFLAGS): Remove.
4404 (many_sections_r_test_LDADD): Remove.
4406 * object.cc (Sized_relobj::do_add_symbols): Always pass
4407 local_symbol_count_ to add_from_relobj.
4409 * testsuite/Makefile.am (many_sections_check.h): Only check one in
4410 every thousand variables.
4411 * testsuite/Makefile.in: Rebuild.
4413 * object.cc (Xindex::initialize_symtab_xindex): New function.
4414 (Xindex::read_symtab_xindex): New function.
4415 (Xindex::sym_xindex_to_shndx): New function.
4416 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
4418 (Sized_relobj::do_initialize_xindex): New function.
4419 (Sized_relobj::do_read_symbols): Adjust section links.
4420 (Sized_relobj::symbol_section_and_value): Add is_ordinary
4421 parameter. Change all callers.
4422 (Sized_relobj::include_section_group): Adjust section links and
4423 symbol section indexes.
4424 (Sized_relobj::do_layout): Adjust section links.
4425 (Sized_relobj::do_count_local_symbols): Adjust section links and
4426 symbol section indexes.
4427 (Sized_relobj::do_finalize_local_symbols): Distinguish between
4428 ordinary and special symbols.
4429 (Sized_relobj::write_local_symbols): Add symtab_xindex and
4430 dynsym_xindex parameters. Change all callers. Adjust section
4431 links. Use SHN_XINDEX when needed.
4432 (Sized_relobj::get_symbol_location_info): Adjust section links.
4433 Don't get fooled by special symbols.
4434 * object.h (class Xindex): Define.
4435 (class Object): Add xindex_ parameter. Declare virtual functoin
4436 do_initialize_xindex.
4437 (Object::adjust_sym_shndx): New function.
4438 (Object::set_xindex): New protected function.
4439 (class Symbol_value): Add is_ordinary_shndx_ field.
4440 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
4441 (Symbol_value::value): Assert ordinary section.
4442 (Symbol_value::initialize_input_to_output_map): Likewise.
4443 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
4445 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
4447 (class Sized_relobj): Update declarations.
4448 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
4449 parameter. Change all callers.
4450 (Sized_relobj::adjust_shndx): New function.
4451 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
4453 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
4454 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
4455 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
4456 (Sized_dynobj::read_dynsym_section): Adjust section links.
4457 (Sized_dynobj::read_dynamic): Likewise.
4458 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
4460 (Sized_dynobj::do_initialize_xindex): New function.
4461 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
4462 do_initialize_xindex.
4463 (Sized_dynobj::adjust_shndx): New function.
4464 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
4465 dynsym_xindex_ fields.
4466 (Layout::finalize): Add a call to set_section_indexes before
4467 creating the symtab sections.
4468 (Layout::set_section_indexes): Don't do anything if the section
4469 already has a section index.
4470 (Layout::create_symtab_sections): Add shnum parameter. Change
4471 caller. Create .symtab_shndx section if needed.
4472 (Layout::create_shdrs): Add shstrtab_section parameter. Change
4474 (Layout::allocated_output_section_count): New function.
4475 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
4477 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
4478 fields. Update declarations.
4479 (Layout::symtab_xindex): New function.
4480 (Layout::dynsym_xindex): New function.
4481 (class Write_symbols_task): Add layout_ field.
4482 (Write_symbols_task::Write_symbols_task): Add layout parameter.
4484 * output.cc (Output_section_headers::Output_section_headers): Add
4485 shstrtab_section parameter. Change all callers.
4486 (Output_section_headers::do_sized_write): Store overflow values
4487 for section count and section string table section index in
4488 section header zero.
4489 (Output_file_header::do_sized_write): Check for overflow of
4490 section count and section string table section index.
4491 (Output_symtab_xindex::do_write): New function.
4492 (Output_symtab_xindex::endian_do_write): New function.
4493 * output.h (class Output_section_headers): Add shstrtab_section_.
4494 Update declarations.
4495 (class Output_symtab_xindex): Define.
4496 (Output_section::has_out_shndx): New function.
4497 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
4499 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
4501 (Sized_symbol::init): Likewise.
4502 (Symbol::output_section): Check for ordinary symbol.
4503 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
4504 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
4506 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
4507 Change all callers. Simplify handling of symbols from sections
4508 not included in the link.
4509 (Symbol_table::add_from_dynobj): Handle ordinary symbol
4511 (Weak_alias_sorter::operator()): Assert that symbols are
4513 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
4515 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
4516 parameters. Change all callers.
4517 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
4518 symbol distinction. Use SHN_XINDEX when needed.
4519 (Symbol_table::write_section_symbol): Add symtab_xindex
4520 parameter. Change all callers.
4521 (Symbol_table::sized_write_section_symbol): Likewise. Use
4522 SHN_XINDEX when needed.
4523 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
4525 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
4526 (Symbol::is_defined): Check is_ordinary.
4527 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
4528 (Symbol::is_absolute, Symbol::is_common): Likewise.
4529 (class Sized_symbol): Update declarations.
4530 (class Symbol_table): Update declarations.
4531 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
4532 parameters. Change all callers.
4533 (Sized_symbol::override): Likewise.
4534 (Symbol_table::override): Likewise.
4535 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
4536 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
4537 is_ordinary, and orig_st_shndx parameters. Change all callers.
4538 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
4539 to be in an ordinary section.
4540 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
4541 object and is_ordinary parameters. Change all callers.
4542 (Sized_dwarf_line_info::read_relocs): Add object parameter.
4543 Change all callers. Don't add undefined or non-ordinary symbols
4545 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
4547 * dwarf_reader.h (class Sized_dwarf_line_info): Update
4549 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
4550 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
4551 (Sized_relobj::relocate_sections): Likewise.
4552 * target-reloc.h (scan_relocs): Adjust section symbol index.
4553 (scan_relocatable_relocs): Likewise.
4554 * i386.cc (Scan::local): Check for ordinary symbols.
4555 * sparc.cc (Scan::local): Likewise.
4556 * x86_64.cc (Scan::local): Likewise.
4557 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
4558 to symbol_section_and_value.
4559 * testsuite/many_sections_test.cc: New file.
4560 * testsuite/Makefile.am (BUILT_SOURCES): Define.
4561 (check_PROGRAMS): Add many_sections_test.
4562 (many_sections_test_SOURCES): Define.
4563 (many_sections_test_DEPENDENCIES): Define.
4564 (many_sections_test_LDFLAGS): Define.
4565 (BUILT_SOURCES): Add many_sections_define.h.
4566 (many_sections_define.h): New target.
4567 (BUILT_SOURCES): Add many_sections_check.h.
4568 (many_sections_check.h): New target.
4569 (check_PROGRAMS): Add many_sections_r_test.
4570 (many_sections_r_test_SOURCES): Define.
4571 (many_sections_r_test_DEPENDENCIES): Define.
4572 (many_sections_r_test_LDFLAGS): Define.
4573 (many_sections_r_test_LDADD): Define.
4574 (many_sections_r_test.o): New target.
4575 * testsuite/Makefile.in: Rebuild.
4577 2008-04-17 Cary Coutant <ccoutant@google.com>
4579 * errors.cc (Errors::info): New function.
4580 (gold_info): New function.
4581 * errors.h (Errors::info): New function.
4582 * gold.h (gold_info): New function.
4583 * object.cc (Input_objects::add_object): Print trace output.
4584 * options.cc (options::parse_set): New function.
4585 (General_options::parse_wrap): Deleted.
4586 (General_options::General_options): Deleted initializer.
4587 * options.h (options::String_set): New typedef.
4588 (options::parse_set): New function.
4589 (DEFINE_set): New macro.
4590 (General_options::wrap): Changed to use DEFINE_set. Changed
4591 callers of any_wrap_symbols and is_wrap_symbol.
4592 (General_options::trace, General_options::trace_symbol):
4594 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
4595 (General_options::wrap_symbols_): Deleted.
4596 * symtab.cc (Symbol_table::add_from_object): Print trace output.
4598 2008-04-17 David S. Miller <davem@davemloft.net>
4600 * options.cc (General_options::parse_V): New function.
4601 * options.h: Add entries for -V and -Qy.
4603 2008-04-17 Ian Lance Taylor <iant@google.com>
4605 * common.cc (Symbol_table::allocate_commons): Remove options
4606 parameter. Change caller.
4607 (Symbol_table::do_allocate_commons): Remove options parameter.
4608 Change caller. Just call do_allocate_commons_list twice.
4609 (Symbol_table::do_allocate_commons_list): New function, broken out
4610 of do_allocate_commons.
4611 * common.h (class Allocate_commons_task): Remove options_ field.
4613 * symtab.cc (Symbol_table::Symbol_table): Initialize
4615 (Symbol_table::add_from_object): Put TLS common symbols on
4617 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
4618 which are IN_OUTPUT_DATA.
4619 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
4620 allocate_commons and do_allocate_commons declarations. Declare
4621 do_allocate_commons_list.
4622 * gold.cc (queue_middle_tasks): Update creation of
4623 Allocate_commons_task to not pass options.
4624 * testsuite/Makefile.am (INCLUDES): Add -I.. .
4625 (TLS_TEST_C_FLAGS): New variable.
4626 (tls_test_c_pic.o): New target.
4627 (tls_test_shared.so): Link in tls_test_c_pic.o.
4628 (tls_test_c_pic_ie.o): New target.
4629 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
4630 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
4631 (tls_test_c.o): New target.
4632 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
4633 (tls_pic_test_LDADD): Likewise.
4634 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
4635 (tls_shared_gd_to_ie_test_LDADD): Likewise.
4636 (tls_test_c_gnu2.o): New target.
4637 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
4639 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
4640 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
4641 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
4642 * testsuite/tls_test.cc: Include "config.h".
4643 (t_last): Call t11_last.
4644 * testsuite/tls_test.h (t11, t11_last): Declare.
4645 * testsuite/tls_test_c.c: New file.
4646 * testsuite/tls_test_main.cc (thread_routine): Call t11.
4647 * configure.ac: Check for OpenMP support.
4648 * configure, config.in, Makefile.in: Rebuild.
4649 * testsuite/Makefile.in: Rebuild.
4651 2008-04-16 Cary Coutant <ccoutant@google.com>
4653 * i386.cc (Target_i386::define_tls_base_symbol): New function.
4654 (Target_i386::tls_base_symbol_defined_): New field.
4655 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4656 (Target_i386::Scan::global): Likewise.
4657 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
4658 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
4659 (Target_x86_64::tls_base_symbol_defined_): New field.
4660 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4661 (Target_x86_64::Scan::global): Likewise.
4663 2008-04-16 Cary Coutant <ccoutant@google.com>
4665 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
4666 (Symbol::needs_plt_entry): Allow weak undefined symbols.
4667 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
4668 building shared libraries.
4669 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
4670 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
4671 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
4672 * testsuite/Makefile.in: Rebuild.
4673 * testsuite/weak_undef.h: New file.
4674 * testsuite/weak_undef_file1.cc: Add extra test cases.
4675 * testsuite/weak_undef_file2.cc: Likewise.
4676 * testsuite/weak_undef_test.cc: Likewise.
4678 2008-04-16 David S. Miller <davem@davemloft.net>
4680 * sparc.cc (Target_sparc::Scan): Change from struct to class.
4681 Add issued_non_pic_error_ field. Declare check_non_pic.
4682 (Target_sparc::Scan::check_non_pic): New function.
4683 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
4684 (Target_sparc::Scan::global): Likewise.
4686 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
4687 * configure: Rebuild.
4689 * options.h (DEFINE_enable): New macro.
4690 (new_dtags): New enable option.
4691 (initfirst, interpose, loadfltr, nodefaultlib,
4692 nodelete, nodlopen, nodump): New -z options.
4693 * layout.cc (Layout:finish_dynamic_section): If new
4694 dtags enabled, emit DT_RUNPATH. Also, emit a
4695 DT_FLAGS_1 containing any specified -z flags.
4697 2008-04-16 Ian Lance Taylor <iant@google.com>
4699 * copy-relocs.cc: New file.
4700 * copy-relocs.h: New file.
4701 * reloc.cc: Remove Copy_relocs code.
4702 * reloc.h: Likewise.
4703 * reloc-types.h (struct Reloc_types) [both versions]: Add
4704 get_reloc_addend_noerror.
4705 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
4706 variants of add_global which take an addend which must be zero.
4707 * i386.cc: Include "copy-relocs.h".
4708 (class Target_i386): Change type of copy_relocs_ to variable,
4710 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
4712 (Target_i386::do_finalize_sections): Change handling of
4714 * sparc.cc: Include "copy-relocs.h".
4715 (class Target_sparc): Change type of copy_relocs_ to variable,
4717 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
4719 (Target_sparc::do_finalize_sections): Change handling of
4721 * x86_64.cc: Include "copy-relocs.h".
4722 (class Target_x86_64): Change type of copy_relocs_ to variable,
4724 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
4725 class. Change all callers.
4726 (Target_x86_64::do_finalize_sections): Change handling of
4728 * Makefile.am (CCFILES): Add copy-relocs.cc.
4729 (HFILES): Add copy-relocs.h.
4731 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
4733 * testsuite/script_test_4.sh: Permit leading zeroes.
4735 2008-04-15 Ian Lance Taylor <iant@google.com>
4737 * script-sections.cc (Script_sections::create_segments): Use
4738 header_size_adjustment even when there is enough room for the
4740 * testsuite/script_test_4.sh: New file.
4741 * testsuite/script_test_4.t: New file.
4742 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
4743 (check_DATA): Add script_test_4.stdout.
4744 (MOSTLYCLEANFILES): Likewise.
4745 (script_test_4): New target.
4746 (script_test_4.stdout): New target.
4747 * testsuite/Makefile.in: Rebuild.
4749 * sparc.cc: Add definitions for Output_data_plt_sparc class
4752 2008-04-14 David S. Miller <davem@davemloft.net>
4754 * sparc.cc: New file.
4755 * Makefile.am (TARGETSOURCES): Add sparc.cc
4756 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
4757 * configure.tgt: Document targ_extra_size and
4758 targ_extra_big_endian. Add entries for sparc-* and
4760 * configure.ac: Handle targ_extra_size and
4761 targ_extra_big_endian.
4762 * Makefile.in: Rebuild.
4763 * configure: Likewise.
4764 * po/POTFILES.in: Likewise.
4765 * po/gold.pot: Likewise.
4767 2008-04-14 Ian Lance Taylor <iant@google.com>
4769 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
4770 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
4771 in the name/type/flags to section mapping. Don't call
4772 allocate_output_section.
4773 (Layout::choose_output_section): Change parameter from adjust_name
4774 to is_input_section. Don't permit input sections after sections
4775 are attached to segments. Don't call allocate_output_section.
4776 (Layout::layout_eh_frame): Call update_flags_for_input_section,
4777 not write_enable_output_section.
4778 (Layout::make_output_section): Don't push to
4779 unattached_section_list_ nor call attach_to_segment. Call
4780 attach_section_to_segment if sections are attached.
4781 (Layout::attach_sections_to_segments): New function.
4782 (Layout::attach_section_to_segment): New function.
4783 (Layout::attach_allocated_section_to_segment): Rename from
4784 attach_to_segment. Remove flags parameter.
4785 (Layout::allocate_output_section): Remove function.
4786 (Layout::write_enable_output_section): Remove function.
4787 * layout.h (class Layout): Update for above changes. Add new
4788 field sections_are_attached_.
4789 * output.h (Output_section::update_flags_for_input_section): New
4791 * output.cc (Output_section::add_input_section): Call
4792 update_flags_for_input_section.
4793 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4795 2008-04-11 Cary Coutant <ccoutant@google.com>
4797 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4798 thought unnecessary.
4799 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4801 2008-04-11 Ian Lance Taylor <iant@google.com>
4803 * output.h (class Output_section_data): Remove inline definition
4805 * output.cc (Output_section_data::set_addralign): New function.
4807 2008-04-11 Cary Coutant <ccoutant@google.com>
4809 Add support for TLS descriptors for i386 and x86_64.
4810 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4811 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4812 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4814 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4815 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4816 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4818 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4819 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4820 Fix problem with initial-exec relocations.
4821 (Target_i386::Relocate::relocate_tls): Likewise.
4822 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4824 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4825 support for section-plus-offset dynamic table entries.
4826 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4827 (Output_data_dynamic::Dynamic_entry): Add support for
4828 section-plus-offset dynamic table entries.
4829 (Output_data_dynamic::Classification): Likewise.
4830 (Output_data_dynamic::classification_): Renamed offset_.
4831 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4832 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4833 (Target_x86_64::make_plt_section): New function.
4834 (Target_x86_64::reserve_tlsdesc_entries): New function.
4835 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4836 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4837 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4838 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4839 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4840 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4841 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4842 add extra PLT entry for TLS descriptors.
4843 (Output_data_plt_x86_64::got_): New field.
4844 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4845 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4847 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4849 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4850 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4851 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4852 R_386_TLS_DESC_CALL relocations.
4853 (Target_x86_64::Scan::global): Likewise.
4854 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4855 for TLS descriptors.
4856 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4857 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4858 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4859 GD-to-IE relaxation.
4860 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4861 and TLS_DESCRIPTORS.
4862 * Makefile.in: Rebuild.
4863 * configure: Rebuild.
4864 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4865 (tls_test_shared2.so): New target.
4866 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4867 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4868 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4869 (tls_shared_gd_to_ie_test_LDADD): New variable.
4870 (tls_shared_gnu2_gd_to_ie_test): New target.
4871 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4873 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4874 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4875 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4876 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4877 (tls_shared_gnu2_test): New target.
4878 (tls_test_gnu2_shared.so): New target.
4879 (tls_shared_gnu2_test_SOURCES): New variable.
4880 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4881 (tls_shared_gnu2_test_LDFLAGS): New variable.
4882 (tls_shared_gnu2_test_LDADD): New variable.
4883 * testsuite/Makefile.in: Rebuild.
4884 * testsuite/Makefile.
4886 2008-04-11 Ian Lance Taylor <iant@google.com>
4888 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4890 * testsuite/Makefile.in: Rebuild.
4892 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4894 * testsuite/script_test_2.cc (main): Adjust test.
4896 2008-04-11 David S. Miller <davem@davemloft.net>
4897 Ian Lance Taylor <iant@google.com>
4899 * options.h (General_options): Add entries for '-Y' and
4901 * options.cc (General_options:finalize): If -Y was used, add those
4902 entries to the library path instead of the default "/lib" and
4905 2008-04-11 David S. Miller <davem@davemloft.net>
4907 * testsuite/justsyms.t: Start at 0x100.
4908 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
4909 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4911 * testsuite/script_test_2.cc: Adjust string and section length
4914 2008-04-09 Ian Lance Taylor <iant@google.com>
4917 * script-sections.cc (Sections_element::allocate_to_segment): Add
4919 (Output_section_definition::allocate_to_segment): Likewise.
4920 (Orphan_output_section::allocate_to_segment): Likewise.
4921 (Script_sections::attach_sections_using_phdrs_clause): Don't
4922 propagate non-PT_LOAD segments to orphan sections.
4923 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4924 readelf rather than objdump.
4925 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4926 .interp section and PT_INTERP segment are the same size.
4927 * testsuite/Makefile.in: Rebuild.
4929 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4930 aliases for symbols defined in the same object.
4931 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
4932 (weak_alias_test_SOURCES): New variable.
4933 (weak_alias_test_DEPENDENCIES): New variable.
4934 (weak_alias_test_LDFLAGS): New variable.
4935 (weak_alias_test_LDADD): New variable.
4936 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
4937 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
4938 (weak_alias_test_3.o): New target.
4939 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
4940 * testsuite/weak_alias_test_main.cc: New file.
4941 * testsuite/weak_alias_test_1.cc: New file.
4942 * testsuite/weak_alias_test_2.cc: New file.
4943 * testsuite/weak_alias_test_3.cc: New file.
4945 2008-04-08 Ian Lance Taylor <iant@google.com>
4947 * options.h (class General_options): Add --noinhibit-exec option.
4948 * main.cc (main): Check --noinhibit-exec.
4950 * options.h (class General_options): Define --wrap as a special
4951 option. Add wrap_symbols_ field.
4952 (General_options::any_wrap_symbols): New function.
4953 (General_options::is_wrap_symbol): New function.
4954 * options.cc (General_options::parse_wrap): New function.
4955 (General_options::General_options): Initialize wrap_symbols_.
4956 * symtab.cc (Symbol_table::wrap_symbol): New function.
4957 (Symbol_table::add_from_object): Handle --wrap.
4958 * symtab.h (class Symbol_table): Declare wrap_symbol.
4959 * target.h (Target::wrap_char): New function.
4960 (Target::Target_info): Add wrap_char field.
4961 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
4962 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4963 * testsuite/testfile.cc (Target_test::test_target_info):
4966 * errors.cc (Errors::undefined_symbol): Mention symbol version if
4969 * layout.h (class Layout): Add added_eh_frame_data_ field.
4970 * layout.cc (Layout::Layout): Initialize new field.
4971 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
4972 output section until we find a section we merged successfully.
4973 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
4974 that the size be non-zero.
4976 * merge.cc (Object_merge_map::get_output_offset): Remove inline
4979 2008-04-08 Craig Silverstein <csilvers@google.com>
4981 * configure.ac: Export new conditional variable HAVE_ZLIB.
4982 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
4984 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
4985 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
4987 2008-04-07 Ian Lance Taylor <iant@google.com>
4989 * version.cc (version_string): Set to "1.5".
4991 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
4992 Add issued_non_pic_error_ field. Declare check_non_pic.
4993 (Target_x86_64::Scan::check_non_pic): New function.
4994 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
4995 (Target_x86_64::Scan::global): Likewise.
4997 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
4998 addend parameter. Change caller. Handle merge sections.
4999 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5000 Address to Addend. Don't add in the result of
5001 local_section_offset, pass down the addend and use the returned
5003 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5004 Update declarations of local_section_offset and symbol_value.
5005 * testsuite/two_file_test_1.cc (t18): New function.
5006 * testsuite/two_file_test_2.cc (f18): New function.
5007 * testsuite/two_file_test_main.cc (main): Call t18.
5008 * testsuite/two_file_test.h (t18, f18): Declare.
5010 * configure.ac: Don't test for objdump, c++filt, or readelf.
5011 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5013 (TEST_READELF): New variable.
5014 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5015 (check_PROGRAMS): Add two_file_strip_test.
5016 (two_file_strip_test): New target.
5017 (check_PROGRAMS): Add two_file_same_shared_strip_test.
5018 (two_file_same_shared_strip_test_SOURCES): New variable.
5019 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5020 (two_file_same_shared_strip_test_LDFLAGS): New variable.
5021 (two_file_same_shared_strip_test_LDADD): New variable.
5022 (two_file_shared_strip.so): New target.
5023 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5024 (ver_test_5.syms, ver_test_7.syms): Likewise.
5025 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5026 (strip_test_3.stdout): Use TEST_OBJDUMP.
5027 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5029 2008-04-04 Cary Coutant <ccoutant@google.com>
5031 * symtab.h (Symbol::is_weak_undefined): New function.
5032 (Symbol::is_strong_undefined): New function.
5033 (Symbol::is_absolute): New function.
5034 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5035 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5037 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5038 (weak_undef_test): New target.
5039 * testsuite/Makefile.in: Rebuild.
5040 * testsuite/weak_undef_file1.cc: New file.
5041 * testsuite/weak_undef_file2.cc: New file.
5042 * testsuite/weak_undef_test.cc: New file.
5044 2008-04-03 Craig Silverstein <csilvers@google.com>
5046 * compressed_output.h (class Output_compressed_section): Use
5048 * compressed_output.cc (zlib_compress): Use unsigned buffers,
5050 (zlib_compressed_suffix): Removed.
5051 (Output_compressed_section::set_final_data_size): Use unsigned
5053 * testsuite/Makefile.am (flagstest_compress_debug_sections):
5054 Fix linker invocation.
5055 (flagstest_o_specialfile_and_compress_debug_sections):
5057 * testsuite/Makefile.in: Regenerated.
5059 2008-04-02 David S. Miller <davem@davemloft.net>
5061 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5062 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5064 2008-04-02 Craig Silverstein <csilvers@google.com>
5068 2008-04-02 Ian Lance Taylor <iant@google.com>
5070 * fileread.cc (File_read::find_view): Add byteshift and vshifted
5071 parameters. Update for new key type to views_. Change all
5073 (File_read::read): Adjust for byteshift in returned view.
5074 (File_read::add_view): New function, broken out of
5076 (File_read::make_view): New function, broken out of
5078 (File_read::find_or_make_view): Add offset and aligned
5079 parameters. Rewrite accordingly. Change all callers.
5080 (File_read::get_view): Add offset and aligned parameters. Adjust
5081 for byteshift in return value.
5082 (File_read::get_lasting_view): Likewise.
5083 * fileread.h (class File_read): Update declarations.
5084 (class File_read::View): Add byteshift_ field. Add byteshift to
5085 constructor. Add byteshift method.
5086 * archive.h (Archive::clear_uncached_views): New function.
5087 (Archive::get_view): Add aligned parameter. Change all callers.
5088 * object.h (Object::get_view): Add aligned parameter. Change all
5090 (Object::get_lasting_view): Likewise.
5092 * fileread.cc (File_read::release): Don't call clear_views if
5093 there are multiple objects.
5094 * fileread.h (File_read::clear_uncached_views): New function.
5095 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5098 2008-03-31 Cary Coutant <ccoutant@google.com>
5100 Add thin archive support.
5101 * archive.cc (Archive::armagt): New const.
5102 (Archive::setup): Remove task parameter and calls to unlock.
5103 (Archive::unlock_nested_archives): New function.
5104 (Archive::read_header): Add nested_off parameter. Change
5106 (Archive::interpret_header): Likewise.
5107 (Archive::include_all_members): Change to handle thin
5109 (Archive::include_member): Likewise.
5110 * archive.h (Archive::Archive): Add new parameters and
5112 (Archive::armagt): New const.
5113 (Archive::setup): Remove task parameter.
5114 (Archive::unlock_nested_archives): New function.
5115 (Archive::read_header): Add nested_off parameter.
5116 (Archive::interpret_header): Likewise.
5117 (Archive::Nested_archive_table): New typedef.
5118 (Archive::is_thin_archive_): New field.
5119 (Archive::nested_archives_): New field.
5120 (Archive::options_): New field.
5121 (Archive::dirpath_): New field.
5122 (Archive::task_): New field.
5123 * readsyms.cc (Read_symbols::do_read_symbols): Add check
5124 for thin archives. Pass additional parameters to
5125 Archive::Archive. Unlock the archive file after calling
5128 2008-03-29 Ian Lance Taylor <iant@google.com>
5130 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
5131 version symbol to be local.
5132 * testsuite/ver_test_4.sh: New file.
5133 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
5134 (check_DATA): Add ver_test_4.syms.
5135 (ver_test_4.syms): New target.
5136 * testsuite/Makefile.in: Rebuild.
5139 (Output_section::Input_section_sort_entry::has_priority): New
5141 (Output_section::Input_section_sort_entry::match_file_name): New
5143 (Output_section::Input_section_sort_entry::match_section_name):
5145 (Output_section::Input_section_sort_entry::match_section_name_prefix):
5147 (Output_section::Input_section_sort_entry::match_section_file):
5149 (Output_section::Input_section_sort_compare::operator()): Rewrite
5150 using new Input_section_sort_entry functions. Sort crtbegin and
5151 crtend first. Sort sections with no priority before sections with
5153 * testsuite/initpri1.c (d3): Check j != 4.
5154 (cd5): New constructor/destructor function.
5155 (main): Check j != 2.
5157 * symtab.cc (Symbol_table::add_from_object): If we don't use the
5158 new symbol when resolving, don't call set_is_default.
5159 * testsuite/ver_test_7.cc: New file.
5160 * testsuite/ver_test_7.sh: New file.
5161 * testsuite/Makefile.am (ver_test_7.so): New target.
5162 (ver_test_7.o): New target.
5163 (check_SCRIPTS): Add ver_test_7.sh.
5164 (check_DATA): Add ver_test_7.syms.
5165 (ver_test_7.syms): New target.
5167 2008-03-28 Ian Lance Taylor <iant@google.com>
5169 * layout.cc (Layout::layout): If we see an input section with a
5170 name that needs sorting, set the must_sort flag for the output
5172 (Layout::make_output_section): If the name of the output section
5173 indicates that it might require sorting, set the may_sort flag.
5174 * output.h (Output_section::may_sort_attached_input_sections): New
5176 (Output_section::set_may_sort_attached_input_sections): New
5178 (Output_section::must_sort_attached_input_sections): New
5180 (Output_section::set_must_sort_attached_input_sections): New
5182 (class Output_section): Declare Input_section_sort_entry. Define
5183 Input_section_sort_compare. Declare
5184 sort_attached_input_sections. Add new fields:
5185 may_sort_attached_input_sections_,
5186 must_sort_attached_input_sections_,
5187 attached_input_sections_are_sorted_.
5188 * output.cc (Output_section::Output_section): Initialize new
5190 (Output_section::add_input_section): Add an entry to
5191 input_sections_ if may_sort or must_sort are true.
5192 (Output_section::set_final_data_size): Call
5193 sort_attached_input_sections if necessary.
5194 (Output_section::Input_section_sort_entry): Define new class.
5195 (Output_section::Input_section_sort_compare::operator()): New
5197 (Output_section::sort_attached_input_sections): New function.
5198 * configure.ac: Check whether the compiler supports constructor
5199 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
5200 * testsuite/initpri1.c: New file.
5201 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
5202 CONSTRUCTOR_PRIORITY.
5203 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
5204 (initpri1_LDFLAGS): New variable.
5205 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5207 2008-03-27 Ian Lance Taylor <iant@google.com>
5209 * common.cc (Sort_commons::operator): Correct sorting algorithm.
5210 * testsuite/common_test_1.c: New file.
5211 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
5212 (common_test_1_SOURCES): New variable.
5213 (common_test_1_DEPENDENCIES): New variable.
5214 (common_test_1_LDFLAGS): New variable.
5216 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
5217 and commons_ correctly when NAME/VERSION does not override
5219 * testsuite/ver_test_6.c: New file.
5220 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
5221 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
5222 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
5224 2008-03-26 Ian Lance Taylor <iant@google.com>
5226 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
5227 of an undefined symbol from a version script.
5228 * testsuite/Makefile.am (ver_test_5.so): New target.
5229 (ver_test_5.o): New target.
5230 (check_SCRIPTS): Add ver_test_5.sh.
5231 (check_DATA): Add ver_test_5.syms.
5232 (ver_test_5.syms): New target.
5233 * testsuite/ver_test_5.cc: New file.
5234 * testsuite/ver_test_5.script: New file.
5235 * testsuite/ver_test_5.sh: New file.
5236 * Makefile.in, testsuite/Makefile.in: Rebuild.
5239 Fix problems building gold with gcc 4.3.0.
5240 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
5241 (gold_error_at_location, gold_warning_at_location): Use it.
5242 * configure.ac: Check whether we can compile and use a template
5243 function with a printf attribute.
5244 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
5245 when jumping over bytes.
5246 * object.cc: Instantiate Object::read_section_data.
5247 * debug.h: Include <cstring>
5248 * dwarf_reader.cc: Include <algorithm>
5249 * main.cc: Include <cstring>.
5250 * options.cc: Include <cstring>.
5251 * output.cc: Include <cstring>.
5252 * script.cc: Include <cstring>.
5253 * script.h: Include <string>.
5254 * symtab.cc: Include <cstring> and <algorithm>.
5255 * target-select.cc: Include <cstring>.
5256 * version.cc: Include <string>.
5257 * testsuite/testmain.cc: Include <cstdlib>.
5258 * configure, config.in: Rebuild.
5260 2008-03-25 Ian Lance Taylor <iant@google.com>
5262 * options.cc: Include "../bfd/bfdver.h".
5263 (options::help): Print bug reporting address.
5265 * version.cc (print_version): Adjust output for current value of
5270 * options.cc (options::help): Print list of supported targets.
5271 * target-select.h: Include <vector>.
5272 (class Target_selector): Make machine_, size_, and is_big_endian_
5273 fields const. Add bfd_name_ and instantiated_target_ fields.
5274 (Target_selector::Target_selector): Add bfd_name parameter.
5275 (Target_selector::recognize): Make non-virtual, call
5277 (Target_selector::recognize_by_name): Make non-virtual, call
5278 do_recognize_by_name.
5279 (Target_selector::supported_names): New function.
5280 (Target_selector::bfd_name): New function.
5281 (Target_selector::do_instantiate_target): New pure virtual
5283 (Target_selector::do_recognize): New virtual function.
5284 (Target_selector::do_recognize_by_name): New virtual function.
5285 (Target_selector::instantiate_target): New private function.
5286 (supported_target_names): Declare.
5287 * target-select.cc (Target_selector::Target_selector): Update for
5288 new parameter and fields.
5289 (select_target_by_name): Check that the name matches before
5290 calling recognize_by_name.
5291 (supported_target_names): New function.
5292 * i386.cc (class Target_selector_i386): Update Target_selector
5293 constructor call. Remove recognize and recognize_by_name. Add
5294 do_instantiate_target.
5295 * x86_64.cc (class Target_selector_x86_64): Likewise.
5296 * testsuite/testfile.cc (class Target_selector_test): Update for
5297 changes to Target_selector.
5299 * README: Rewrite, with some notes on unsupported features.
5301 2008-03-24 Cary Coutant <ccoutant@google.com>
5303 * i386.cc (Target_i386::Got_type): New enum declaration.
5304 (Target_i386::Scan::local): Updated callers of Output_data_got
5306 (Target_i386::Scan::global): Likewise.
5307 (Target_i386::Relocate::relocate): Likewise.
5308 (Target_i386::Relocate::relocate_tls): Likewise.
5309 * object.h (Got_offset_list): New class.
5310 (Sized_relobj::local_has_got_offset): Added got_type parameter.
5311 (Sized_relobj::local_got_offset): Likewise.
5312 (Sized_relobj::set_local_got_offset): Likewise.
5313 (Sized_relobj::local_has_tls_got_offset): Removed.
5314 (Sized_relobj::local_tls_got_offset): Removed.
5315 (Sized_relobj::set_local_tls_got_offset): Removed.
5316 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
5317 * output.cc (Output_data_got::add_global): Added got_type parameter.
5318 (Output_data_got::add_global_with_rel): Likewise.
5319 (Output_data_got::add_global_with_rela): Likewise.
5320 (Output_data_got::add_global_pair_with_rel): New function.
5321 (Output_data_got::add_global_pair_with_rela): New function.
5322 (Output_data_got::add_local): Added got_type parameter.
5323 (Output_data_got::add_local_with_rel): Likewise.
5324 (Output_data_got::add_local_with_rela): Likewise.
5325 (Output_data_got::add_local_pair_with_rel): New function.
5326 (Output_data_got::add_local_pair_with_rela): New function.
5327 (Output_data_got::add_global_tls): Removed.
5328 (Output_data_got::add_global_tls_with_rel): Removed.
5329 (Output_data_got::add_global_tls_with_rela): Removed.
5330 (Output_data_got::add_local_tls): Removed.
5331 (Output_data_got::add_local_tls_with_rel): Removed.
5332 (Output_data_got::add_local_tls_with_rela): Removed.
5333 * output.h (Output_data_got::add_global): Added got_type parameter.
5334 (Output_data_got::add_global_with_rel): Likewise.
5335 (Output_data_got::add_global_with_rela): Likewise.
5336 (Output_data_got::add_global_pair_with_rel): New function.
5337 (Output_data_got::add_global_pair_with_rela): New function.
5338 (Output_data_got::add_local): Added got_type parameter.
5339 (Output_data_got::add_local_with_rel): Likewise.
5340 (Output_data_got::add_local_with_rela): Likewise.
5341 (Output_data_got::add_local_pair_with_rel): New function.
5342 (Output_data_got::add_local_pair_with_rela): New function.
5343 (Output_data_got::add_global_tls): Removed.
5344 (Output_data_got::add_global_tls_with_rel): Removed.
5345 (Output_data_got::add_global_tls_with_rela): Removed.
5346 (Output_data_got::add_local_tls): Removed.
5347 (Output_data_got::add_local_tls_with_rel): Removed.
5348 (Output_data_got::add_local_tls_with_rela): Removed.
5349 * resolve.cc (Symbol::override_base_with_special): Removed
5350 reference to has_got_offset_ field.
5351 * symtab.cc (Symbol::init_fields): Replaced initialization
5352 of got_offset_ with got_offsets_. Removed initialization
5354 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
5355 (Symbol::got_offset): Likewise.
5356 (Symbol::set_got_offset): Likewise.
5357 (Symbol::has_tls_got_offset): Removed.
5358 (Symbol::tls_got_offset): Removed.
5359 (Symbol::set_tls_got_offset): Removed.
5360 (Symbol::got_offset_): Removed.
5361 (Symbol::tls_mod_got_offset_): Removed.
5362 (Symbol::tls_pair_got_offset_): Removed.
5363 (Symbol::got_offsets_): New field.
5364 (Symbol::has_got_offset): Removed.
5365 (Symbol::has_tls_mod_got_offset): Removed.
5366 (Symbol::has_tls_pair_got_offset): Removed.
5367 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
5368 (Target_x86_64::Scan::local): Updated callers of Output_data_got
5370 (Target_x86_64::Scan::global): Likewise.
5371 (Target_x86_64::Relocate::relocate): Likewise.
5372 (Target_x86_64::Relocate::relocate_tls): Likewise.
5374 2008-03-25 Ben Elliston <bje@au.ibm.com>
5376 * yyscript.y: Fix spelling error in comment.
5378 2008-03-24 Ian Lance Taylor <iant@google.com>
5380 * options.h (class General_options): Define build_id option.
5381 * layout.h (class Layout): Declare write_build_id, create_note,
5382 create_build_id. Add build_id_note_ member.
5383 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
5384 "libiberty.h", "md5.h", "sha1.h".
5385 (Layout::Layout): Initialize eh_frame_data_,
5386 eh_frame_hdr_section_, and build_id_note_.
5387 (Layout::finalize): Call create_build_id.
5388 (Layout::create_note): New function, broken out of
5389 Layout::create_gold_note.
5390 (Layout::create_gold_note): Call create_note.
5391 (Layout::create_build_id): New function.
5392 (Layout::write_build_id): New function.
5393 (Close_task_runner::run): Call write_build_id.
5395 * x86_64.cc: Correct license to GPLv3.
5397 2008-03-23 Ian Lance Taylor <iant@google.com>
5399 * options.cc: Include "demangle.h".
5400 (parse_optional_string): New function.
5401 (parse_long_option): Handle takes_optional_argument.
5402 (parse_short_option): Update dash_z initializer. Handle
5403 takes_optional_argument.
5404 (General_options::General_options): Initialize do_demangle_.
5405 (General_options::finalize): Set do_demangle_. Handle demangling
5407 * options.h (parse_optional_string): Declare.
5408 (struct One_option): Add optional_arg field. Update constructor.
5409 Update call constructor calls. Add takes_optional_argument
5411 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
5412 (DEFINE_optional_string): Define.
5413 (General_options::demangle): Change from DEFINE_bool to
5414 DEFINE_optional_string.
5415 (General_options::no_demangle): New function.
5416 (General_options::do_demangle): New function.
5417 (General_options::set_do_demangle): New function.
5418 (General_options::execstack_status_): Move definition to end of
5420 (General_options::static_): Likewise.
5421 (General_options::do_demangle_): New field.
5422 * object.cc (big_endian>::get_symbol_location_info): Call
5423 Options::do_demangle, not Options::demangle.
5424 * symtab.cc (demangle): Likewise.
5426 2008-03-22 Ian Lance Taylor <iant@google.com>
5428 * gold.h: Include <cstddef> and <sys/types.h>
5429 * options.h: Include <cstring>.
5431 2008-03-21 Ian Lance Taylor <iant@google.com>
5433 * Added source code to GNU binutils.