1 2009-12-14 Ian Lance Taylor <iant@google.com>
3 Revert -Wshadow changes, all changes from:
4 2009-12-11 Doug Kwan <dougkwan@google.com>
5 2009-12-11 Nick Clifton <nickc@redhat.com>
6 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8 2009-12-11 Doug Kwan <dougkwan@google.com>
10 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12 * attributes.cc (Object_attribute::size): Ditto.
13 (Attributes_section_data::size): Ditto.
14 (Attributes_section_data::Attributes_section_data): Ditto.
15 (Output_attributes_section_data::do_write): Ditto.
16 * attributes.h (Object_attribute::set_type): Ditto.
17 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
19 2009-12-11 Nick Clifton <nickc@redhat.com>
21 * archive.cc: Fix shadowed variable warnings.
23 * compressed_output.cc: Likewise.
24 * compressed_output.h: Likewise.
25 * configure: Likewise.
26 * dwarf_reader.cc: Likewise.
27 * dynobj.cc: Likewise.
29 * ehframe.cc: Likewise.
30 * ehframe.h: Likewise.
31 * errors.cc: Likewise.
32 * expression.cc: Likewise.
33 * fileread.cc: Likewise.
34 * fileread.h: Likewise.
35 * freebsd.h: Likewise.
38 * incremental.h: Likewise.
39 * layout.cc: Likewise.
41 * mapfile.cc: Likewise.
44 * object.cc: Likewise.
46 * options.h: Likewise.
47 * output.cc: Likewise.
49 * parameters.cc: Likewise.
50 * plugin.cc: Likewise.
51 * powerpc.cc: Likewise.
52 * reduced_debug_output.cc: Likewise.
53 * reduced_debug_output.h: Likewise.
56 * resolve.cc: Likewise.
57 * script-sections.cc: Likewise.
58 * script.cc: Likewise.
61 * symtab.cc: Likewise.
63 * target-select.cc: Likewise.
64 * target-select.h: Likewise.
66 * workqueue.cc: Likewise.
67 * workqueue.h: Likewise.
68 * x86_64.cc: Likewise.
70 2009-12-10 Doug Kwan <dougkwan@google.com>
72 * arm.cc (attributes.h): New include.
73 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
74 (Arm_relobj::~Arm_relobj): Delete object pointed by
75 attributes_section_data_.
76 (Arm_relobj::attributes_section_data): New method definition.
77 (Arm_relobj::attributes_section_data_): New data member declaration.
78 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
79 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
80 attributes_section_data_.
81 (Arm_dynobj::attributes_section_data): New method definition.
82 (Arm_dynobj::attributes_section_data_): New data member declaration.
83 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
84 initialization value of may_use_blx_ to false.
85 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
86 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
87 object attributes to compute results instead of hard-coding.
88 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
89 Target_arm::get_secondary_compatible_arch,
90 Target_arm::set_secondary_compatible_arch
91 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
92 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
93 New method declarations.
94 (Target_arm::get_aeabi_object_attribute): New method definition.
95 (Target_arm::attributes_section_data_): New data member declaration.
96 (read_arm_attributes_section): New template definition.
97 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
98 (Arm_dynobj::do_read_symbols): Ditto.
99 (Target_arm::do_finalize_sections): Merge attributes sections from
100 input. Check for BLX use after attributes section merging.
101 Fix __exidx_start and __exidx_end visibility. Create an
102 .ARM.attributes section if necessary.
103 (Target_arm::get_secondary_compatible_arch,
104 Target_arm::set_secondary_compatible_arch,
105 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
106 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
107 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
108 New method definitions.
110 2009-12-09 Ian Lance Taylor <iant@google.com>
112 * plugin.cc (Plugin::load): Don't cast from void* to a function
115 2009-12-09 Ian Lance Taylor <iant@google.com>
117 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
120 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
122 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
123 Replace two_file_shared_1.so with two_file_shared_2.so.
124 * testsuite/Makefile.in: Regenerated.
126 2009-12-08 Doug Kwan <dougkwan@google.com>
128 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
129 (HFILES): Add attributes.h and int_encoding.h.
130 * Makefile.in: Regenerate.
131 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
132 function definitions to int_encoding.cc
133 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
134 prototypes to int_encoding.h
135 * reduced_debug_output.cc (int_encoding.h): New include.
136 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
137 function definitions to int_encoding.cc
138 (insert_into_vector, read_from_pointer): Move template definitions to
140 * attributes.cc: New file.
141 * attributes.h: New file.
142 * int_encoding.cc: New file.
143 * int_encoding.h: New file.
145 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
148 * incremental-dump.cc (dump_incremental_inputs): New.
149 (main): Use dump_incremental_inputs.
151 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
154 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
155 checking elfcpp::STT_FUNC.
156 (Target_i386::Relocate::relocate): Likewise.
157 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
159 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
160 symbols from shared libraries into normal FUNC symbols.
162 * symtab.h (Symbol): Add is_func and use it.
164 2009-12-05 Doug Kwan <dougkwan@google.com>
166 * arm.cc (Target_arm::arm_info): Initialize new fields
167 attributes_section and attributes_vendor.
168 * i386.cc (Target_i386::i386_info): Same.
169 * object.cc (Sized_relobj::do_layout): Skip attribute section.
170 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
171 fields attributes_section and attributes_vendor.
172 * sparc.cc (Target_sparc::sparc_info): Same.
173 * target.h (Target::attributes_section, Target::attributes_vendor,
174 Target::is_attributes_section, Target::attribute_arg_type,
175 Target::attributes_order): New method definitions.
176 (Target::Target_info::attributes_section,
177 Target::Target_info::attributes_vendor): New fields.
178 (Target::do_attribute_arg_type, Target::do_attributes_order): New
179 virtual method definitions.
180 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
181 attributes_section and attributes_vendor.
182 * testsuite/testfile.cc (Target_test::test_target_info): Same.
184 2009-12-05 Doug Kwan <dougkwan@google.com>
186 * arm.cc: Update comments about interworking and stub generation.
187 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
188 considered as non-PIC.
189 (Arm_relocate_functions::base_abs): Fix formatting.
190 (Arm_relocate_functions::got_prel): Fix comment. Change interface
191 of function to use GOT entry address instead of offset.
192 (Target_arm::Scan::global): Issue an error if a symbol would need a
193 PLT does not get one because it is untyped. Remove code to create
194 dynamic symbols for relative branches.
195 (Target_arm::Relocate::relocate: Use 0 instead of false since function
196 takes unsigned integer instead of boolean.
198 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
200 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
201 (two_file_test_LDADD): Likewise.
202 (common_test_1_LDADD): Likewise.
203 (exception_test_LDADD) Likewise.
204 (weak_test_LDADD): Likewise.
205 (many_sections_test_LDADD): Likewise.
206 (initpri1_LDADD): Likewise.
207 (script_test_1_LDADD): Likewise.
208 (script_test_2_LDADD): Likewise.
209 (justsyms_LDADD): Likewise.
210 (binary_test_LDADD): Likewise.
211 (large_LDADD): Likewise.
212 * testsuite/Makefile.in: Regenerated.
214 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
216 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
217 (Symbol_table::override_with_special): Likewise.
218 (Symbol_table::add_from_object): Likewise.
220 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
222 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
223 Don't set the data_offset twice.
225 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
227 * testsuite/Makefile.in: Regenerate.
229 2009-12-03 Doug Kwan <dougkwan@google.com>
231 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
232 (Target_arm::do_finalize_sections): Add parameter for symbol table
233 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
234 * i386.cc (Target_i386::do_finalize_sections): Add an additional
235 parameter for symbol table pointer.
236 * layout.cc (Layout::finalize): Call Target::finalize_sections with
237 an additional parameter for a pointer to symbol table.
238 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
239 parameter for a symbol table pointer.
240 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
241 * target.h (Target::finalize_sections, Target::do_finalize_sections):
243 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
244 parameter for a symbol table pointer.
246 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
248 * incremental.cc (Incremental_inputs_header)
249 (Incremental_inputs_header_write, Incremental_inputs_entry)
250 (Incremental_inputs_entry_write): Move ...
251 * incremental.h (Incremental_inputs_header)
252 (Incremental_inputs_header_write, Incremental_inputs_entry)
253 (Incremental_inputs_entry_write): here.
255 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
257 * incremental.cc (make_sized_incremental_binary): Set the target.
258 Error if it is incompatible.
259 * output.h (Output_file): Add filename method.
261 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
263 * incremental.cc (Incremental_inputs_entry): Remove unused argument
264 from the get_* methods.
266 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
268 * incremental-dump.cc (main): Check that the offeset of a script is 0.
269 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
270 Write 0 for the data_offset of scripts.
272 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
274 * testsuite/Makefile.am: Add the incremental_test.sh test.
275 * testsuite/incremental_test.sh: New.
276 * testsuite/incremental_test_1.c: New.
277 * testsuite/incremental_test_2.c: New.
279 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
281 * incremental-dump.cc (main): Fix typos.
283 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
286 * incremental-dump.cc (main): Use llu to print 64 bit values.
288 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
289 H.J. Lu <hongjiu.lu@intel.com>
291 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
293 (incremental_dump_LDADD): Likewise.
294 * Makefile.in: Regenerated.
296 2009-11-25 Doug Kwan <dougkwan@google.com>
300 2009-11-25 Doug Kwan <dougkwan@google.com>
302 * arm.cc (Target_arm::Target_arm): Move method definition
303 outside of class definition. Add code to handle
304 --target1-rel, --target1-abs and --target2= options.
305 (Target_arm::get_reloc_reloc_type): Change method to be
306 non-static and const.
307 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
308 New data member declaration.
309 (Target_arm::Scan::local, Target_arm::Scan::global,
310 Target_arm::Relocate::relocate,
311 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
312 Adjust call to Target_arm::get_real_reloc_type.
313 (Target_arm::get_real_reloc_type): Use command line options
314 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
315 * options.h (--target1-rel, --target1-abs, --target2): New
318 2009-11-25 Doug Kwan <dougkwan@google.com>
320 * arm.cc (Target_arm::Target_arm): Move method definition outside of
321 class definition. Add code to handle --target1-rel, --target1-abs
322 and --target2= options.
323 (Target_arm::get_reloc_reloc_type): Change method to be non-static
325 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
327 (Target_arm::Scan::local, Target_arm::Scan::global,
328 Target_arm::Relocate::relocate,
329 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
330 call to Target_arm::get_real_reloc_type.
331 (Target_arm::get_real_reloc_type): Use command line options to
332 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
333 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
336 2009-11-25 Doug Kwan <dougkwan@google.com>
338 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
339 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
340 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
342 (Arm_relocate_functions::thm_call): Replace body with a call to
343 Arm_relocate_functions::thumb_branch_common.
344 (Arm_relocate_functions::thm_jump24,
345 Arm_relocate_functions::thm_xpc22): New method definitions.
346 (Arm_relocate_functions::thumb_branch_common): New method definition.
347 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
349 (Target_arm::Relocate::relocate): Adjust call to thm_call.
350 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
352 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
354 * Makefile.am: Build incremental-dump
355 * Makefile.in: Regenerate.
356 * incremental-dump.cc: New.
357 * incremental.cc (Incremental_inputs_header_data,
358 Incremental_inputs_entry_data): Move to incremental.h
359 * incremental.h: (Incremental_inputs_header_data,
360 Incremental_inputs_entry_data): Move from incremental.cc
362 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
364 * incremental.cc (Incremental_inputs_header,
365 Incremental_inputs_header_write, Incremental_inputs_entry,
366 Incremental_inputs_entry_write): Add a typedef with the data type.
368 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
370 * incremental.cc (Incremental_inputs_header,
371 Incremental_inputs_header_write, Incremental_inputs_entry,
372 Incremental_inputs_entry_write): Update comment about which
373 type has the filed descriptions.
375 2009-11-15 Doug Kwan <dougkwan@google.com>
377 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
378 (Arm_relocate_functions::arm_branch_common): Change method defintion
379 in class definition to a method declaration and update list of formal
381 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
382 Arm_relocation_functions::jump24): Adjust call to
383 Arm_relocate_functions::arm_branch_common. Update list of formal
385 (Arm_relocate_functions::xpc25): New method definition.
386 (Arm_relocate_functions::arm_branch_common): Move method defintion
387 out from class definition. Use stubs for mode-switching and extending
389 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
390 specially. Change code to enable use of stubs in ARM branches.
392 2009-11-10 Doug Kwan <dougkwan@google.com>
394 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
395 in method declaration.
396 (Target_arm::relocate_stub): New method declaration.
397 (Target_arm::default_target): Change to return a pointer instead of
399 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
400 Target_arm::default_target.
401 (Arm_Relobj::do_relocate_sections): Remove options paramater in
403 (Target_arm::relocate_section): Adjust view.
404 (Target_arm::relocate_stub): New method definition.
406 2009-11-10 Doug Kwan <dougkwan@google.com>
408 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
410 * incremental.cc (open_incremental_binary): Initialized local
411 variables to avoid warnings.
412 * object.cc (make_elf_object): Ditto.
413 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
416 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
419 * testsuite/plugin_test.c: Include "config.h".
421 2009-11-09 Doug Kwan <dougkwan@google.com>
423 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
424 (arm_symbol_value): Remove.
425 (Arm_relocate_functions::arm_branch_common,
426 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
427 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
428 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
429 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
430 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
431 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
432 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
433 Arm_relocate_functions::thm_mobw_abs_nc,
434 Arm_relocate_functions::thm_mov_abs,
435 Arm_relocate_functions::movw_prel_nc,
436 Arm_relocate_functions::thm_movt_abs,
437 Arm_relocate_functions::movt_prel,
438 Arm_relocate_functions::thm_movw_prel_nc,
439 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
440 (Target_arm::Relocate::relocate): Only decompose address into two
441 parts if relocation type uses the thumb-bit and pass the actual
442 bit instead of a flag indicating that the thumb-bit is used. Adjust
443 calls to methods in Arm_relocate_functions for this change.
445 2009-11-08 Ian Lance Taylor <iant@google.com>
448 * reloc.cc: Instantiate
449 Sized_relobj::initialize_input_to_output_maps and
450 Sized_relobj:free_input_to_output_maps.
452 2009-11-06 Ian Lance Taylor <iant@google.com>
455 * defstd.cc (in_segment): Set only_if_ref true for "end".
457 2009-11-06 Doug Kwan <dougkwan@google.com>
459 * arm.cc (class Reloc_stub): Correct a comment.
460 (Target_arm::Target_arm): Initialize arm_input_section_map_.
461 (Target_arm::scan_section_for_stubs): New method declaration.
462 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
463 Change methods from private to protected.
464 (Target_arm::do_may_relax): New method definition.
465 (Target_arm::do_relax, Target_arm::group_sections,
466 Target_arm::scan_reloc_for_stub,
467 Target_arm::scan_reloc_section_for_stubs): New method declarations.
468 (Target_arm::arm_input_section_map_): New data member declaration.
469 (Target_arm::scan_reloc_for_stub,
470 Target_arm::scan_reloc_section_for_stubs,
471 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
472 Target_arm::do_relax): New method definitions.
474 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
476 * configure.ac: Check for (struct stat)::st_mtim
477 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
478 * config.in: Regenerate.
479 * configure: Regenerate.
481 2009-11-05 Ian Lance Taylor <iant@google.com>
484 * output.cc (Output_segment::add_output_section): Add missing
487 2009-11-04 Ian Lance Taylor <iant@google.com>
490 * object.h (class Object): Add is_needed and set_is_needed
491 methods. Add is_needed_ field. Make bool fields into bitfields.
492 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
493 defined in a dynamic object and referenced by a regular object,
494 set is_needed for the dynamic object.
495 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
496 if the file is marked with as_needed and it is not needed.
498 2009-11-04 Ian Lance Taylor <iant@google.com>
501 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
502 tags if data is discarded by linker script.
503 * i386.cc (Target_i386::do_finalize_sections): Likewise.
504 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
505 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
506 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
508 2009-11-04 Ian Lance Taylor <iant@google.com>
510 * layout.cc (Layout::get_output_section): Add is_interp and
511 is_dynamic_linker_section parameters. Change all callers.
512 (Layout::choose_output_section): Likewise.
513 (Layout::make_output_section): Likewise.
514 (Layout::add_output_section_data): Add is_dynamic_linker_section
515 parameter. Change all callers.
516 * layout.h (class Layout): Update declarations.
517 * output.h (class Output_section): Add is_interp, set_is_interp,
518 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
519 Add is_interp_, is_dynamic_linker_section_ fields. Change
520 generate_code_fills_at_write_ to a bitfield.
521 * output.cc (Output_section::Output_sections): Initialize new
523 (Output_segment::add_output_section): Add do_sort parameter.
526 2009-11-03 Ian Lance Taylor <iant@google.com>
529 * options.h (class General_options): Add --warn-common.
530 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
531 merging two common symbols.
532 (Symbol_table::should_override): Handle --warn-common when merging
533 a common symbol with a defined symbol. Use report_resolve_problem
534 for multiple definitions.
535 (Symbol_table::report_resolve_problem): New function.
536 * symtab.h (class Symbol_table): Declare report_resolve_problem.
538 2009-11-03 Doug Kwan <dougkwan@google.com>
540 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
542 (Target_arm::stub_factory): New method definition.
543 (Target_arm::new_arm_input_section,
544 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
545 Target_arm::reloc_uses_thumb_bit): New method declarations.
546 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
547 New type definitions.
548 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
550 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
551 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
552 New method definitions.
554 2009-11-03 Ian Lance Taylor <iant@google.com>
556 * options.h (class General_options): Add --warn_constructors.
558 2009-11-03 Ian Lance Taylor <iant@google.com>
561 * defstd.cc (in_section): Add entries for __rel_iplt_start,
562 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
564 2009-11-03 Ian Lance Taylor <iant@google.com>
567 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
568 --msgid-bugs-address.
569 (install-pdf): New target.
570 (install-data_yes): Look up one directory to find mkinstalldirs.
572 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
574 * po/Make-in (.po.gmo): Don't generate .gmo files in source
577 2009-10-30 Doug Kwan <dougkwan@google.com>
579 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
581 2009-10-30 Doug Kwan <dougkwan@google.com>
583 * arm.cc (Stub_addend_reader): New struct template definition
584 and partial specializations.
585 (Stub_addend_reader::operator()): New method definition for a
586 partially specialized template.
588 2009-10-30 Doug Kwan <dougkwan@google.com>
590 * arm.cc (Arm_relobj::processor_specific_flags): New method
592 (Arm_relobj::do_read_symbols): New method declaration.
593 (Arm_relobj::processor_specific_flags_): New data member declaration.
594 (Arm_dynobj): New class definition.
595 (Target_arm::do_finalize_sections): Add input_objects parameter.
596 (Target_arm::do_adjust_elf_header): New method declaration.
597 (Target_arm::are_eabi_versions_compatible,
598 (Target_arm::merge_processor_specific_flags): New method declaration.
599 (Target_arm::do_make_elf_object): New overloaded method definitions
601 (Arm_relobj::do_read_symbols): New method definition.
602 (Arm_dynobj::do_read_symbols): Ditto.
603 (Target_arm::do_finalize_sections): Add input_objects parameters.
604 Merge processor-specific flags from all input objects.
605 (Target_arm::are_eabi_versions_compatible,
606 Target_arm::merge_processor_specific_flags,
607 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
608 New method definitions.
609 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
610 Input_objects pointer type parameter.
611 * layout.cc (Layout::finalize): Pass input objects to target's.
612 finalize_sections function.
613 * output.cc (Output_file_header::do_sized_write): Set ELF file
614 header's processor-specific flags.
615 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
616 Input_objects pointer type parameter.
617 * sparc.cc (Target_sparc::do_finalize_sections): Same.
618 * target.h (Input_objects): New forward class declaration.
619 (Target::processor_specific_flags,
620 Target::are_processor_specific_flags_sect): New method definitions.
621 (Target::finalize_sections): Add input_objects parameter.
622 (Target::Target): Initialize processor_specific_flags_ and
623 are_processor_specific_flags_set_.
624 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
626 (Target::set_processor_specific_flags): New method definition.
627 (Target::processor_specific_flags_,
628 Target::are_processor_specific_flags_set_): New data member
630 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
631 Input_objects pointer type parameter.
633 2009-10-30 Doug Kwan <dougkwan@google.com>
635 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
637 2009-10-28 Ian Lance Taylor <iant@google.com>
639 * object.h (class Relobj): Drop options parameter from
640 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
641 do_scan_relocs, do_relocate. Change all callers.
642 (class Sized_relobj): Drop options parameters from
643 do_gc_process_relocs, do_scan_relocs, do_relocate,
644 do_relocate_sections, relocate_sections, emit_relocs_scan,
645 emit_relocs_scan_reltype. Change all callers.
646 (struct Relocate_info): Remove options field and all references to
648 * reloc.h (class Read_relocs): Remove options constructor
649 parameter and options_ field. Change all callers.
650 (class Gc_process_relocs, class Scan_relocs): Likewise.
651 (class Relocate_task): Likewise.
652 * target-reloc.h (scan_relocs): Remove options parameter. Change
654 (scan_relocatable_relocs): Likewise.
655 * target.h (class Sized_target): Remove options parameter from
656 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
658 * gc.h (gc_process_relocs): Remove options parameter. Change all
660 * arm.cc: Update functions to remove options parameters.
662 * powerpc.cc: Likewise.
663 * sparc.cc: Likewise.
664 * x86_64.cc: Likewise.
665 * testsuite/testfile.cc: Likewise.
667 2009-10-28 Doug Kwan <dougkwan@google.com>
669 * arm.cc (Arm_relobj): New class definition.
670 (Arm_relobj::scan_sections_for_stubs,
671 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
672 New method definitions.
674 2009-10-28 Cary Coutant <ccoutant@google.com>
676 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
677 (Plugin::cleanup_done_): New member.
678 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
679 (Plugin_manager::cleanup_done_): Remove.
680 (Plugin_manager::add_input_file): Edit error message.
681 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
682 (Plugin_manager::cleanup): Remove use of cleanup_done_.
684 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
686 * fileread.cc: (File_read::View::~View): Use the new
687 data_ownership_ filed.
688 (File_read::~File_read): Dispose the new whole_file_view_.
689 (File_read::open): Mmap the whole file if needed.
690 (File_read::open): Use whole_file_view_ instead of contents_.
691 (File_read::find_view): Use whole_file_view_ if applicable.
692 (File_read::do_read): Use whole_file_view_ instead of contents_.
693 (File_read::make_view): Use whole_file_view_ instead of contents_,
694 update File_read::View::View call.
695 (File_read::find_or_make_view): Update File_read::View::View
697 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
699 (File_read::View::Data_ownership): New enum.
700 (File_read::View::View): Replace bool mapped_ with Data_ownership
702 (File_read::View::mapped_): Remove (replaced by data_ownership_).
703 (File_read::View::data_ownership_): New field.
704 (File_read::contents_): Remove (replaced by whole_file_view_).
705 (File_read::whole_file_view_): New field.
706 * options.h (class General_options): Add --keep-files-mapped.
708 2009-10-27 Cary Coutant <ccoutant@google.com>
710 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
711 * testsuite/Makefile.am (plugin_test_5): New test case.
712 * testsuite/Makefile.in: Regenerate.
714 2009-10-25 Doug Kwan <dougkwan@google.com>
716 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
717 from private to protected to allow access by child class.
718 (Sized_relobj::do_relocate_sections): New method declaration.
719 (Sized_relobj::relocate_sections): Virtualize.
720 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
721 Sized_relobj::relocate_sections. Instantiate template explicitly
722 for different target sizes and endianity.
724 2009-10-24 Doug Kwan <dougkwan@google.com>
726 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
727 (Arm_input_section::as_arm_input_section): New method.
728 (Arm_output_section): New class definition.
729 (Arm_output_section::create_stub_group,
730 Arm_output_section::group_sections): New method definitions.
732 2009-10-22 Doug Kwan <dougkwan@google.com>
734 * arm.cc (Arm_input_section): New class definition.
735 (Arm_input_section::init, Arm_input_section:do_write,
736 Arm_input_section::set_final_data_size,
737 Arm_input_section::do_reset_address_and_file_offset): New method
740 2009-10-21 Doug Kwan <dougkwan@google.com>
742 * arm.cc (Stub_table, Arm_input_section): New forward class
744 (Stub_table): New class defintion.
745 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
746 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
747 New method definition.
749 2009-10-21 Doug Kwan <dougkwan@google.com>
751 * arm.cc: Update copyright comments.
752 (Target_arm): New forward class template declaration.
753 (Arm_address): New type.
754 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
755 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
756 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
758 (Insn_template): Same.
759 (DEF_STUBS): New macro.
760 (Stub_type): New enum type.
761 (Stub_template): New class definition.
764 (Stub_factory): Same.
765 (Target_arm::Target_arm): Initialize may_use_blx_ and
766 should_force_pic_veneer_.
767 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
768 Target_arm::should_force_pic_veneer,
769 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
770 Target_arm::using_thumb_only, Target_arm:;default_target): New
772 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
773 New data member declarations.
774 (Insn_template::size, Insn_template::alignment): New method defintions.
775 (Stub_template::Stub_template): New method definition.
776 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
777 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
778 (Stub_factory::Stub_factory): New method definition.
779 * gold.h (string_hash): New template.
780 * output.h (Input_section_specifier::hash_value): Use
782 (Input_section_specifier::string_hash): Remove.
783 * stringpool.cc (Stringpool_template::string_hash): Use
786 2009-10-20 Doug Kwan <dougkwan@google.com>
788 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
789 symbols of relaxed input sections.
790 * output.h (Output_section::find_relaxed_input_section): Make
793 2009-10-16 Doug Kwan <dougkwan@google.com>
795 * dynobj.cc (Versions::Versions): Initialize version_script_.
796 Only insert base version symbol definition for a shared object
797 if version script defines any version versions.
798 (Versions::define_base_version): New method definition.
799 (Versions::add_def): Check that base version is not needed.
800 (Versions::add_need): Define base version lazily.
801 * dynobj.h (Versions::define_base_version): New method declaration.
802 (Versions::needs_base_version_): New data member declaration.
803 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
804 (check_DATA): Add no_version_test.stdout.
805 (libno_version_test.so, no_version_test.o no_version_test.stdout):
807 * testsuite/Makefile.in: Regenerate.
808 * testsuite/no_version_test.c: New file.
809 * testsuite/no_version_test.sh: Ditto.
811 2009-10-16 Doug Kwan <dougkwan@google.com>
813 * expression.cc (class Segment_start_expression): New class definition.
814 (Segment_start_expression::value): New method definition.
815 (script_exp_function_segment_start): Return a new
816 Segment_start_expression.
817 * gold/script-c.h (script_saw_segment_start_expression): New function
819 * script-sections.cc (Script_sections::Script_sections): Initialize
820 SAW_SEGMENT_START_EXPRESSION_ to false.
821 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
822 and -Tbbs options to specify section addresses if given in
823 command line and no SEGMENT_START expression is seen in a script.
824 * script-sections.h (Script_sections::saw_segment_start_expression,
825 Script_sections::set_saw_segment_start_expression): New method
827 (Script_sections::saw_segment_start_expression_): New data member
829 * script.cc (script_saw_segment_start_expression): New function.
830 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
831 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
832 script_test_7.sh and script_test_8.sh.
833 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
834 script_test_8.stdout.
835 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
836 (script_test_6, script_test_6.stdout, script_test_7,
837 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
838 * Makefile.in: Regenerate.
839 * testsuite/script_test_6.sh: New file.
840 * testsuite/script_test_6.t: Same.
841 * testsuite/script_test_7.sh: Same.
842 * testsuite/script_test_7.t: Same.
843 * testsuite/script_test_8.sh: Same.
845 2009-10-16 Doug Kwan <dougkwan@google.com>
847 * output.cc (Output_segment::set_section_list_address): Cast
848 expressions to unsigned long long type to avoid format warnings.
850 2009-10-15 Ian Lance Taylor <iant@google.com>
852 * script.cc (Script_options::add_symbol_assignment): Always add a
853 dot assignment to script_sections_.
854 * script-sections.cc (Script_sections::add_dot_assignment):
855 Initialize if necessary.
857 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
858 program headers with no load segment if there is a linker script.
860 * layout.cc (Layout::set_segment_offsets): Align the file offset
861 to the segment aligment for -N or -n with no load segment.
862 * output.cc (Output_segment::add_output_section): Don't crash if
863 the first section is a TLS section.
864 (Output_segment::set_section_list_addresses): Print an error
865 message if the address moves backward in a linker script.
867 (Output_section_element_input::set_section_addresses): Don't
868 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
869 (Orphan_output_section::set_section_addresses): Likewise.
871 2009-10-15 Doug Kwan <dougkwan@google.com>
873 * layout.cc (Layout::finish_dynamic_section): Generate tags
874 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
875 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
876 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
878 2009-10-14 Ian Lance Taylor <iant@google.com>
880 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
882 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
883 data_shdr fields of relinfo.
884 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
885 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
886 R_386_TLS_LDO_32, adjust based on section flags.
887 (Target_i386::Relocate::fix_up_ldo): Remove.
889 2009-10-13 Ian Lance Taylor <iant@google.com>
891 Add support for -pie.
892 * options.h (class General_options): Add -pie and
894 (General_options::output_is_position_independent): Test -pie.
895 (General_options::output_is_executable): Return true if not shared
897 (General_options::output_is_pie): Remove.
898 * options.cc (General_options::finalize): Reject incompatible uses
900 * gold.cc (queue_middle_tasks): A -pie link is not static.
901 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
902 * symtab.cc (Symbol::final_value_is_known): Return false if
903 output_is_position_independent.
904 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
905 output_is_position_independent.
906 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
907 output_is_position_independent.
908 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
909 output_is_position_independent.
910 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
912 (basic_pie_test.o, basic_pie_test): New targets.
913 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
914 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
915 (two_file_pie_test): New target.
916 * testsuite/Makefile.in: Rebuild.
917 * README: Remove note saying that -pie is not supported.
919 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
921 * options.h (class General_options): Add -init and -fini.
922 * layout.cc (Layout::finish_dynamic_section): Emit
923 given init and fini functions.
925 2009-10-13 Sriraman Tallam <tmsriram@google.com>
927 * gc.h (gc_process_relocs): Check if icf is enabled using new
929 * gold.cc (queue_initial_tasks): Likewise.
930 (queue_middle_tasks): Likewise.
931 * object.cc (do_layout): Likewise.
932 * symtab.cc (is_section_folded): Likewise.
933 * main.cc (main): Likewise.
934 * reloc.cc (Read_relocs::run): Likewise.
935 (Sized_relobj::do_scan_relocs): Likewise.
936 * icf.cc (is_function_ctor_or_dtor): New function.
937 (Icf::find_identical_sections): Check if function is ctor or dtor when
939 * options.h (General_options::icf): Change option to be an enum.
940 (Icf_status): New enum.
941 (icf_enabled): New method.
942 (icf_safe_folding): New method.
943 (set_icf_status): New method.
944 (icf_status_): New variable.
945 * (options.cc) (General_options::finalize): Set icf_status_.
946 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
947 icf_test and icf_keep_unique_test to use the --icf enum flag.
948 * testsuite/icf_safe_test.sh: New file.
949 * testsuite/icf_safe_test.cc: New file.
951 2009-10-12 Sriraman Tallam <tmsriram@google.com>
953 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
954 includes to gc.h and icf.h.
955 * arm.cc: Include gc.h.
958 * powerpc.cc: Likewise.
959 * sparc.cc: Likewise.
960 * x86_64.cc: Likewise.
961 * gc.h: Include icf.h.
963 2009-10-11 Ian Lance Taylor <iant@google.com>
965 * plugin.cc: Include "gold.h" before other header files.
967 2009-10-10 Chris Demetriou <cgd@google.com>
969 * options.h (Input_file_argument::Input_file_type): New enum.
970 (Input_file_argument::is_lib_): Replace with...
971 (Input_file_argument::type_): New member.
972 (Input_file_argument::Input_file_argument): Take Input_file_type
973 'type' rather than boolean 'is_lib' as second argument.
974 (Input_file_argument::is_lib): Use type_.
975 (Input_file_argument::is_searched_file): New function.
976 (Input_file_argument::may_need_search): Handle is_searched_file.
977 * options.cc (General_options::parse_library): Support -l:filename.
978 (General_options::parse_just_symbols): Update for Input_file_argument
980 (Command_line::process): Likewise.
981 * archive.cc (Archive::get_file_and_offset): Likewise.
982 * plugin.cc (Plugin_manager::release_input_file): Likewise.
983 * script.cc (read_script_file, script_add_file): Likewise.
984 * fileread.cc (Input_file::Input_file): Likewise.
985 (Input_file::will_search_for): Handle is_searched_file.
986 (Input_file::open): Likewise.
987 * readsyms.cc (Read_symbols::get_name): Likewise.
988 * testsuite/Makefile.am (searched_file_test): New test.
989 * testsuite/Makefile.in: Regenerate.
990 * testsuite/searched_file_test.cc: New file.
991 * testsuite/searched_file_test_lib.cc: New file.
993 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
994 Ian Lance Taylor <iant@google.com>
996 * descriptor.cc: Include <cstdio> and "binary-io.h".
997 (Descriptors::open): Open the files in binary mode always.
998 * script.cc (Lex::get_token): Treat \r as whitespace.
1000 2009-10-09 Ian Lance Taylor <iant@google.com>
1002 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1004 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1005 Ian Lance Taylor <iant@google.com>
1007 * configure.ac: Check for readv function also.
1008 * fileread.cc (readv): Define if not HAVE_READV.
1009 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1011 * config.in: Regenerate.
1012 * configure: Regenerate.
1014 2009-10-09 Doug Kwan <dougkwan@google.com>
1016 * layout.cc (Layout::make_output_section): Call target hook to make
1017 ordinary output section.
1018 (Layout::finalize): Adjust parameter list of call the
1019 Target::may_relax().
1020 * layout.h (class Layout::section_list): New method.
1021 * merge.h (Output_merge_base::entsize): Change visibility to public.
1022 (Output_merge_base::is_string, Output_merge_base::do_is_string):
1024 (Output_merge_string::do_is_string): New method.
1025 * object.cc (Sized_relobj::do_setup): renamed from
1026 Sized_relobj::set_up.
1027 * object.h (Sized_relobj::adjust_shndx,
1028 Sized_relobj::initializ_input_to_output_maps,
1029 Sized_relobj::free_input_to_output_maps): Change visibilities to
1031 (Sized_relobj::setup): Virtualize.
1032 (Sized_relobj::do_setup): New method declaration.
1033 (Sized_relobj::invalidate_section_offset,
1034 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
1035 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
1036 * options.cc (parse_int): New function.
1037 * options.h (parse_int): New declaration.
1038 (DEFINE_int): New macro.
1039 (stub_group_size): New option.
1040 * output.cc (Output_section::Output_section): Initialize memebers
1041 merge_section_map_, merge_section_by_properties_map_,
1042 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
1043 (Output_section::add_input_section): Handled deferred code-fill
1044 generation and remove an old comment.
1045 (Output_section::add_relaxed_input_section): New method definition.
1046 (Output_section::add_merge_input_section): Use merge section by
1047 properties map to speed to search. Update merge section maps
1049 (Output_section::build_relaxation_map): New method definition.
1050 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1052 (Output_section::relax_input_section): Renamed to
1053 Output_section::convert_input_sections_to_relaxed_sections and change
1054 interface to take a vector of pointers to relaxed sections.
1055 (Output_section::find_merge_section,
1056 Output_section::find_relaxed_input_section): New method definitions.
1057 (Output_section::is_input_address_mapped,
1058 Output_section::output_offset, Output_section::output_address):
1059 Use output section data maps to speed up searching.
1060 (Output_section::find_starting_output_address): Add comments.
1061 (Output_section::do_write,
1062 Output_section::write_to_postprocessing_buffer): Do code-fill
1063 generation as appropriate.
1064 (Output_section::get_input_sections): Invalidate relaxed input section
1066 (Output_section::restore_states): Adjust type of checkpoint .
1067 Invalidate relaxed input section map.
1068 * output.h (Output_merge_base): New class declaration.
1069 (Input_section_specifier): New class defintion.
1070 (class Output_relaxed_input_section) Change base class to
1071 Output_section_data_build.
1072 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1073 base class initializer.
1074 (Output_section::add_relaxed_input_section): New method declaration.
1075 (Output_section::Input_section): Change visibility to protected.
1076 (Output_section::Input_section::relobj,
1077 Output_section::Input_section::shndx): Handle relaxed input sections.
1078 Output_section::input_sections) Change visibility to protected. Also
1079 define overload to return a non-const pointer.
1080 (Output_section::Merge_section_properties): New class defintion.
1081 (Output_section::Merge_section_by_properties_map,
1082 Output_section::Output_section_data_by_input_section_map,
1083 Output_section::Relaxation_map): New types.
1084 (Output_section::relax_input_section): Rename method to
1085 Output_section::convert_input_sections_to_relaxed_sections and change
1086 interface to take a vector of relaxed section pointers.
1087 (Output_section::find_merge_section,
1088 Output_section::find_relaxed_input_section,
1089 Output_section::build_relaxation_map,
1090 Output_section::convert_input_sections_in_list_to_relaxed_sections):
1091 New method declarations.
1092 (Output_section::merge_section_map_
1093 Output_section::merge_section_by_properties_map_,
1094 Output_section::relaxed_input_section_map_,
1095 Output_section::is_relaxed_input_section_map_valid_,
1096 Output_section::generate_code_fills_at_write_): New data members.
1097 * script-sections.cc
1098 (Output_section_element_input::set_section_addresses): Call
1099 current_data_size and addralign methods of relaxed input sections.
1100 (Orphan_output_section::set_section_addresses): Call current_data_size
1101 and addralign methods of relaxed input sections.
1102 * symtab.cc (Symbol_table::compute_final_value): Extract template
1103 from the body of Symbol_table::sized_finalize_symbol.
1104 (Symbol_table::sized_finalized_symbol): Call
1105 Symbol_table::compute_final_value.
1106 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1107 (Symbol_table::compute_final_value): New templated method declaration.
1108 * target.cc (Target::do_make_output_section): New method defintion.
1109 * target.h (Target::make_output_section): New method declaration.
1110 (Target::relax): Add more parameters for input objects, symbol table
1111 and layout. Adjust call to do_relax.
1112 (Target::do_make_output_section): New method declaration.
1113 (Target::do_relax): Add parameters for input objects, symbol table
1116 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1118 * pread.c: Include stdio.h.
1120 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1122 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1125 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1127 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1128 Change read_shndx type to unsigned int.
1129 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1131 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1132 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1133 Change read_shndx type to unsigned int.
1134 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1136 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1137 * layout.cc (Layout::create_symtab_sections): Cast the result of
1138 local_symcount * symsize to off_t in the gold_assert.
1140 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1142 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1143 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1145 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1146 (Arm_relocate_functions::thm_abs5): New function.
1147 (Arm_relocate_functions::abs12): New function.
1148 (Arm_relocate_functions::abs16): New function.
1149 (Arm_relocate_functions::base_abs): New function.
1150 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1151 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1152 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1154 (Scan::global): Likewise.
1155 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1156 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1157 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1158 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1161 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1163 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1164 (Arm_relocate_functions::movt_prel): New function.
1165 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1166 (Arm_relocate_functions::thm_movt_prel): New function.
1167 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1168 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1169 (Scan::global, Relocate::relocate): Likewise.
1170 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1172 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1174 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1175 Incremental_checker.
1176 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1178 (class Incremental_inputs_header): New class.
1179 (Incremental_inputs_header_writer): Edit comment.
1180 (Incremental_inputs_entry): New class.
1181 (Incremental_inputs_entry_writer): Edit comment.
1182 (Sized_incremental_binary::do_find_incremental_inputs_section):
1183 Add *strtab_shndx parameter, fill it.
1184 (Sized_incremental_binary::do_check_inputs): New method.
1185 (Incremental_checker::can_incrementally_link_output_file): Use
1186 Sized_incremental_binary::check_inputs.
1187 (Incremental_inputs::report_command_line): Save command line in
1190 (Incremental_binary::find_incremental_inputs_section): New
1192 (Incremental_binary::do_find_incremental_inputs_section): Add
1193 strtab_shndx parameter.
1194 (Incremental_binary::do_check_inputs): New pure virtual method.
1195 (Sized_incremental_binary::do_check_inputs): Declare.
1196 (Incremental_checker::Incremental_checker): Add incremental_inputs
1197 parameter, use it to initialize incremental_inputs_.
1198 (Incremental_checker::incremental_inputs_): New field.
1199 (Incremental_checker::command_line): New method.
1200 (Incremental_checker::inputs): New method.
1201 (Incremental_checker::command_line_): New field.
1203 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1205 * incremental.cc: Include <cstdarg> and "target-select.h".
1206 (vexplain_no_incremental): New function.
1207 (explain_no_incremental): New function.
1208 (Incremental_binary::error): New method.
1209 (Sized_incremental_binary::do_find_incremental_inputs_section): New
1211 (make_sized_incremental_binary): New function.
1212 (open_incremental_binary): New function.
1213 (can_incrementally_link_file): Add checks if output is ELF and has
1215 * incremental.h: Include "elfcpp_file.h" and "output.h".
1216 (Incremental_binary): New class.
1217 (Sized_incremental_binary): New class.
1218 (open_incremental_binary): Declare.
1219 * object.cc (is_elf_object): Use
1220 elfcpp::Elf_recognizer::is_elf_file.
1221 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
1222 * output.h (Output_file::filesize): New method.
1224 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1226 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
1228 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
1229 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
1231 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
1233 (Arm_relocate_functions::movw_abs_nc): New function.
1234 (Arm_relocate_functions::movt_abs): New function.
1235 (Arm_relocate_functions::thm_movw_abs_nc): New function.
1236 (Arm_relocate_functions::thm_movt_abs): New function.
1237 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
1238 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
1239 (Scan::global): Likewise.
1240 (Relocate::relocate): Likewise.
1241 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1243 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1245 * arm.cc (Arm_relocate_functions::got_prel) New function.
1246 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
1247 (Relocate::relocate): Likewise.
1248 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1250 2009-10-06 Ian Lance Taylor <iant@google.com>
1252 * options.h (class General_options): Define
1253 split_stack_adjust_size parameter.
1254 * object.h (class Object): Add uses_split_stack_ and
1255 has_no_split_stack_ fields. Add uses_split_stack and
1256 has_no_split_stack accessor functions. Declare
1257 handle_split_stack_section.
1258 (class Reloc_symbol_changes): Define.
1259 (class Sized_relobj): Define Function_offsets. Declare
1260 split_stack_adjust, split_stack_adjust_reltype, and
1262 * object.cc (Object::handle_split_stack_section): New function.
1263 (Sized_relobj::do_layout): Call handle_split_stack_section.
1264 * dynobj.cc (Sized_dynobj::do_layout): Call
1265 handle_split_stack_section.
1266 * reloc.cc (Sized_relobj::relocate_sections): Call
1267 split_stack_adjust for executable sections in split_stack
1268 objects. Pass reloc_map to relocate_section.
1269 (Sized_relobj::split_stack_adjust): New function.
1270 (Sized_relobj::split_stack_adjust_reltype): New function.
1271 (Sized_relobj::find_functions): New function.
1272 * target-reloc.h: Include "object.h".
1273 (relocate_section): Add reloc_symbol_changes parameter. Change
1275 * target.h (class Target): Add calls_non_split method. Declare
1276 do_calls_non_split virtual method. Declare match_view and
1278 * target.cc: Include "elfcpp.h".
1279 (Target::do_calls_non_split): New function.
1280 (Target::match_view): New function.
1281 (Target::set_view_to_nop): New function.
1282 * gold.cc (queue_middle_tasks): Give an error if mixing
1283 split-stack and non-split-stack objects with -r.
1284 * i386.cc (Target_i386::relocate_section): Add
1285 reloc_symbol_changes parameter.
1286 (Target_i386::do_calls_non_split): New function.
1287 * x86_64.cc (Target_x86_64::relocate_section): Add
1288 reloc_symbol_changes parameter.
1289 (Target_x86_64::do_calls_non_split): New function.
1290 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
1292 * powerpc.cc (Target_powerpc::relocate_section): Add
1293 reloc_symbol_changes parameter.
1294 * sparc.cc (Target_sparc::relocate_section): Add
1295 reloc_symbol_changes parameter.
1296 * configure.ac: Call AM_CONDITIONAL for the default target.
1297 * configure: Rebuild.
1298 * testsuite/Makefile.am (TEST_AS): New variable.
1299 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
1300 (check_DATA): Add split_i386 and split_x86_64 files.
1301 (SPLIT_DEFSYMS): Define.
1302 (split_i386_[1234n].o): New targets.
1303 (split_i386_[124]): New targets.
1304 (split_i386_[1234r].stdout): New targets.
1305 (split_x86_64_[1234n].o): New targets.
1306 (split_x86_64_[124]): New targets.
1307 (split_x86_64_[1234r].stdout): New targets.
1308 (MOSTLYCLEANFILES): Add new executables.
1309 * testsuite/split_i386.sh: New file.
1310 * testsuite/split_x86_64.sh: New file.
1311 * testsuite/split_i386_1.s: New file.
1312 * testsuite/split_i386_2.s: New file.
1313 * testsuite/split_i386_3.s: New file.
1314 * testsuite/split_i386_4.s: New file.
1315 * testsuite/split_i386_n.s: New file.
1316 * testsuite/split_x86_64_1.s: New file.
1317 * testsuite/split_x86_64_2.s: New file.
1318 * testsuite/split_x86_64_3.s: New file.
1319 * testsuite/split_x86_64_4.s: New file.
1320 * testsuite/split_x86_64_n.s: New file.
1321 * testsuite/testfile.cc (Target_test): Update relocation_section
1323 * testsuite/Makefile.in: Rebuild.
1325 2009-10-06 Ian Lance Taylor <iant@google.com>
1327 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
1328 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
1329 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
1330 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
1331 the address on ldo_addrs_.
1332 (Target_i386::Relocate::fix_up_ldo): New function.
1334 2009-10-06 Rafael Espindola <espindola@google.com>
1336 * plugin.cc (add_input_library): New.
1337 (Plugin::load): Add add_input_library to tv.
1338 (Plugin_manager::add_input_file): Add the is_lib argument.
1339 (add_input_file): Update call to Plugin_manager::add_input_file.
1340 (add_input_library): New.
1341 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
1343 2009-09-30 Doug Kwan <dougkwan@google.com>
1345 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
1346 symbol and call Symbol::may_need_copy_reloc to determine if
1347 a copy reloc is needed.
1348 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
1349 nocopyreloc is given in command line.
1350 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
1351 given in command line.
1352 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
1353 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
1354 of the removed Target_i386::may_need_copy_reloc.
1355 * options.h (copyreloc): New option with default value false.
1356 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1357 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
1358 instead of the removed Target_powerpc::may_need_copy_reloc.
1359 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1360 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
1361 instead of the removed Target_sparc::may_need_copy_reloc.
1362 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
1363 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
1364 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
1365 instead of the removed Target_x86_64::may_need_copy_reloc.
1367 2009-09-30 Ian Lance Taylor <iant@google.com>
1369 * object.h (class Object): Remove target_ field, and target,
1370 sized_target, and set_target methods.
1371 (Object::sized_target): Remove.
1372 (class Sized_relobj): Update declarations. Remove sized_target.
1373 * object.cc (Sized_relobj::setup): Remove target parameter.
1375 (Input_objects::add_object): Don't do anything with the target.
1376 (make_elf_sized_object): Add punconfigured parameter. Change all
1377 callers. Set or test parameter target.
1378 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
1380 * parameters.cc (Parameters::set_target): Change parameter type to
1382 (Parameters::default_target): Remove.
1383 (set_parameters_target): Change parameter type to be non-const.
1384 (parameters_force_valid_target): New function.
1385 (parameters_clear_target): New function.
1386 * parameters.h (class Parameters): Update declarations. Remove
1387 default_target method. Add sized_target and clear_target
1388 methods. Change target_ to be non-const.
1389 (set_parameters_target): Update declaration.
1390 (parameters_force_valid_target): Declare.
1391 (parameters_clear_target): Declare.
1392 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
1393 as NULL if we aren't searching.
1394 (Add_symbols::run): Don't check for compatible target.
1395 * fileread.cc (Input_file::open_binary): Call
1396 parameters_force_valid_target.
1397 * gold.cc (queue_middle_tasks): Likewise.
1398 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
1399 set_target on object.
1400 * dynobj.h (class Sized_dynobj): Update declarations.
1401 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
1402 make_elf_object returns NULL.
1403 (Archive::include_member): Don't check whether object target is
1405 * output.cc (Output_section::add_input_section): Get target from
1407 (Output_section::relax_input_section): Likewise.
1408 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
1410 (Sized_relobj::do_scan_relocs): Likewise.
1411 (Sized_relobj::relocate_sections): Likewise.
1412 * resolve.cc (Symbol_table::resolve): Likewise.
1413 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
1414 parameter. Change all callers.
1415 (Symbol_table::add_from_object): Get target from parameters.
1416 (Symbol_table::add_from_relobj): Don't check object target.
1417 (Symbol_table::add_from_dynobj): Likewise.
1418 (Symbol_table::define_special_symbol): Get target from
1420 * symtab.h (class Symbol_table): Update declaration.
1421 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
1422 parameter. Change all callers. Clear parameter target.
1423 (Binary_test): Test target here.
1424 * testsuite/object_unittest.cc (gold_testsuite): Remove
1425 target_test_pointer parameter. Change all callers.
1426 (Object_test): Test target here.
1428 2009-09-26 Ian Lance Taylor <iant@google.com>
1430 * testsuite/initpri1.c: Don't try to use constructor priorities if
1431 compiling with gcc before 4.3.
1433 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
1435 * testsuite/retain_symbols_file_test.sh (check_present): Change
1436 output file name to retain_symbols_file_test.stdout.
1437 (check_absent): Likewise.
1439 2009-09-18 Craig Silverstein <csilvers@google.com>
1441 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
1442 * options.cc: Include <cerrno> and <fstream>.
1443 (General_options::finalize): Parse -retain-symbols-file tag.
1444 * options.h: New flag.
1445 (General_options): New method should_retain_symbol, new
1446 variable symbols_to_retain.
1447 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
1448 should_retain_symbol map.
1449 * testsuite/Makefile.am (retain_symbols_file_test): New test.
1450 * testsuite/Makefile.in: Regenerate.
1451 * testsuite/retain_symbols_file_test.sh: New file.
1453 2009-09-18 Nick Clifton <nickc@redhat.com>
1455 * po/es.po: Updated Spanish translation.
1457 2009-09-17 Doug Kwan <dougkwan@google.com>
1459 * debug.h (DEBUG_RELAXATION): New constant.
1460 (DEBUG_ALL): Add DEBUG_RELAXATION.
1461 (debug_string_to_enum): Add relaxation debug option.
1463 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
1464 Layout::Relaxation_debug_check::read_sections,
1465 Layout::Relaxation_debug_check::read_sections): New method definitions.
1466 (Layout::Layout): Initialize data members
1467 record_output_section_data_from_scrips_,
1468 script_output_section_data_list_ and relaxation_debug_check_.
1469 (Layout::save_segments, Layout::restore_segments,
1470 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1471 Layout::relaxation_loop_body): New method definitions.
1472 (Layout::finalize): Support relaxation. Move section layout code to
1473 Layout::relaxation_loop_body.
1474 (Layout::set_asection_address_from_script): Move code for orphan
1475 section placement out.
1476 (Layout::place_orphan_sections_in_script): New method definition.
1477 * layout.h (Output_segment_headers, Output_file_header):
1478 New forward class declarations.
1479 (Layout::~Layout): Define.
1480 (Layout::new_output_section_data_from_script): New method definition.
1481 (Layout::place_orphan_sections_in_script): New method declaration.
1482 (Layout::Segment_states): New type declaration.
1483 (Layout::save_segments, Layout::restore_segments,
1484 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
1485 Layout::relaxation_loop_body): New method declarations.
1486 (Layout::Output_section_data_list): New type declaration.
1487 (Layout::Relaxation_debug_check): New class definition.
1488 (Layout::record_output_section_data_from_script_,
1489 Layout::script_output_section_data_list_, Layout::segment_states_,
1490 Layout::relaxation_debug_check_): New data members.
1491 * output.cc: (Output_section_headers::do_size): New method definition.
1492 (Output_section_headers::Output_section_headers): Move size
1493 computation to Output_section_headers::do_size.
1494 (Output_segment_headers::do_size): New method definition.
1495 (Output_file_header::Output_file_header): Move size computation to
1496 Output_file_header::do_size and call it.
1497 (Output_file_header::do_size): New method definition.
1498 (Output_data_group::Output_data_group): Adjust call to
1499 Output_section_data.
1500 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
1501 (Output_symtab_xindex::do_write): Add array bound check.
1502 (Output_section::Input_section::print_to_mapfile): Handle
1503 RELAXED_INPUT_SECTION_CODE.
1504 (Output_section::Output_section): Initialize data member checkpoint_.
1505 (Output_section::~Output_section): Delete checkpoint object pointed
1507 (Output_section::add_input_section): Always add an Input_section if
1509 (Output_section::add_merge_input_section): Add assert.
1510 (Output_section::relax_input_section): New method definition.
1511 (Output_section::set_final_data_size): Set load address to zero for
1512 an unallocated section.
1513 (Output_section::do_address_and_file_offset_have_reset_values):
1514 New method definition.
1515 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
1516 Handle relaxed input section.
1517 (Output_section::sort_attached_input_sections): Checkpoint input
1518 section list lazily.
1519 (Output_section::get_input_sections): Change type of input_sections to
1520 list of Simple_input_section pointers. Checkpoint input section list
1521 lazily. Also handle relaxed input sections.
1522 (Output_section::add_input_section_for_script): Take a reference to
1523 a Simple_input_section object instead of Relobj pointer and section
1524 index as parameter. Handle relaxed input sections.
1525 (Output_section::save_states, Output_section::restore_states): New
1527 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
1528 (Output_data::is_data_size_fixed): New method definition.
1529 (Output_data::reset_addresss_and_file_offset): Do not reset data size
1531 (Output_data::address_and_file_offset_have_reset_values): New method
1533 (Output_data::do_address_and_file_offset_have_reset_values): New method
1535 (Output_data::set_data_size): Check that data size is not fixed.
1536 (Output_data::fix_data_size): New method definition.
1537 (Output_data::is_data_size_fixed_): New data member.
1538 (Output_section_headers::set_final_data_size): New method definition.
1539 (Output_section_headers::do_size): New method declaration.
1540 (Output_segment_headers::set_final_data_size): New method definition.
1541 (Output_segment_headers::do_size): New method declaration.
1542 (Output_file_header::set_final_data_size)::New method definition.
1543 (Output_file_header::do_size)::New method declaration.
1544 (Output_section_data::Output_section_data): Add new parameter
1545 is_data_size_fixed and use it to fix data size.
1546 (Output_data_const::Output_data_const): Adjust call to base class
1547 constructor and fix data size.
1548 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
1549 base class constructor and fix data size.
1550 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
1551 base class constructor and fix data size.
1552 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
1553 class constructor and fix data size.
1554 (Output_data_group::set_final_data_size): New method definition.
1555 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
1556 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
1557 class constructor and fix data size.
1558 (Output_relaxed_input_section): New class definition.
1559 (Output_section::Simple_input_section): New class definition.
1560 (Output_section::get_input_sections): Adjust parameter list.
1561 (Output_section::add_input_section_for_script): Same.
1562 (Output_section::save_states, Output_section::restore_states,
1563 Output_section::do_address_and_file_offset_have_reset_values,
1564 (Output_section::Input_section::Input_section): Handle
1565 RELAXED_INPUT_SECTION_CODE. Add new overload for
1566 Output_relaxed_input_section.
1567 (Output_section::Input_section::is_input_section,
1568 Output_section::Input_section::set_output_section): Handle relaxed
1570 (Output_section::Input_section::is_relaxed_input_section,
1571 Output_section::Input_section::output_section_data,
1572 Output_section::Input_section::relaxed_input_section): New method
1574 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
1576 (Output_section::Input_section::u1_): Update comments.
1577 (Output_section::Input_section::u2_): Add new union member poris.
1578 (Output_section::Checkpoint_output_section): New classs definition.
1579 (Output_section::relax_input_section): New method declaration.
1580 (Output_section::checkpoint_): New data member.
1581 (Output_segment): Update comments.
1582 (Output_segment::Output_segment): Un-privatize copy constructor.
1583 (Output_segment::operator=): Un-privatize.
1584 * script-sections.cc (Output_section_element::Input_section_list):
1585 Change element type to Output_section::Simple_input_section.
1586 (Output_section_element_dot_assignment::set_section_addresses):
1587 Register output section data for relaxation clean up.
1588 (Output_data_exression::Output_data_expression): Adjust call to base
1589 constructor to fix data size.
1590 (Output_section_element_data::set_section_addresses): Register
1591 Output_data_expression object for relaxation clean up.
1592 (struct Input_section_info): Replace Relobj pointer and section index
1593 pair with Output_section::Simple_input_section and Convert struct to a
1595 (Input_section_sorter::operator()): Adjust access to
1596 Input_section_info data member to use accessors.
1597 (Output_section_element_input::set_section_addresses): Use layout
1598 parameter. Adjust code to use Output_section::Simple_input_section
1599 and Input_secction_info classes. Register filler for relaxation
1601 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
1602 and section index pair with Output_section::Simple_input_section
1603 class. Adjust code accordingly.
1604 (Phdrs_element::release_segment): New method definition.
1605 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
1607 (Script_sections::release_segments): New method definition.
1608 * gold/script-sections.h (Script_sections::release_segments): New
1610 * gold/target.h (Target::may_relax, Target::relax,
1611 Target::do_may_relax, Target::do_relax): New method definitions.
1613 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1615 * arm.cc (has_signed_unsigned_overflow): New function.
1616 (Arm_relocate_functions::abs8): New function.
1617 (Target_arm::Scan::local): Handle R_ARM_ABS8.
1618 (Target_arm::Scan::global): Likewise.
1619 (Target_arm::relocate::relocate): Likewise.
1620 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1623 2009-09-16 Cary Coutant <ccoutant@google.com>
1625 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
1626 * testsuite/Makefile.in: Regenerate.
1628 2009-09-11 Nick Clifton <nickc@redhat.com>
1630 * po/gold.pot: Updated by the Translation project.
1632 2009-09-08 Cary Coutant <ccoutant@google.com>
1634 * output.cc (Output_file::open): Add execute permission to empty file.
1635 * testsuite/Makefile.am (permission_test): New test.
1636 * testsuite/Makefile.in: Regenerate.
1638 2009-09-02 Ian Lance Taylor <iant@google.com>
1640 * output.cc (Output_file::resize): Call map_no_anonymous rather
1643 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
1645 * gold.cc: Include "incremental.h".
1646 (queue_initial_tasks): Call Incremental_checker methods.
1647 * incremental.cc: Include "output.h".
1648 (Incremental_checker::can_incrementally_link_output_file): New
1650 * incremental.h (Incremental_checker): New class.
1652 * output.cc (Output_file::open_for_modification): New method.
1653 (Output_file::map_anonymous): Changed return type to bool. Record
1655 (Output_file::map_no_anonymous): New method, broken out of map.
1656 (Output_file::map): Use map_no_anonymous and map_anonymous.
1657 * output.h (class Output_file): Update declarations.
1659 2009-08-24 Cary Coutant <ccoutant@google.com>
1661 * options.h (Command_line::Pre_options): New class.
1662 (Command_line::pre_options): New member.
1663 * options.cc (gold::options::ready_to_register): New variable.
1664 (One_option::register_option): Do nothing if not registering options.
1665 Assert if same short option registered twice.
1666 (General_options::General_options): Turn off option registration when
1668 (Command_line::Pre_options::Pre_options): New constructor.
1670 2009-08-24 Cary Coutant <ccoutant@google.com>
1672 * options.h (General_options::no_keep_memory): Remove incorrect
1675 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1677 * Makefile.am (am__skiplex, am__skipyacc): New.
1678 * Makefile.in: Regenerate.
1680 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1682 * Makefile.am (AM_CPPFLAGS): Renamed from ...
1683 (INCLUDES): ... this.
1684 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
1685 (AM_CPPFLAGS): Renamed from ...
1686 (INCLUDE): ... this.
1687 * Makefile.in, testsuite/Makefile.in: Regenerate.
1689 * Makefile.in: Regenerate.
1690 * aclocal.m4: Likewise.
1691 * config.in: Likewise.
1692 * configure: Likewise.
1693 * testsuite/Makefile.in: Likewise.
1695 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1696 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
1697 * Makefile.in: Regenerate.
1698 * testsuite/Makefile.in: Regenerate.
1700 2009-08-19 Cary Coutant <ccoutant@google.com>
1702 * resolve.cc (Symbol_table::resolve): Don't complain about defined
1703 symbols in shared libraries overridden by hidden or internal symbols
1704 in the main program.
1706 2009-08-19 Chris Demetriou <cgd@google.com>
1708 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
1709 checking source file names in error messages.
1711 2009-08-18 Doug Kwan <dougkwan@google.com>
1713 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
1714 an elcpp::Ehdr as parameter. Adjust call to set_target.
1715 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
1716 an elfcpp::Ehdr as parameter.
1717 * object.cc (Object::set_target): Remove the version that looks up
1718 a target and sets it.
1719 (Sized_relobj::setup): Take a Target object instead of
1720 an elfcpp::Ehdr as parameter. Adjust call to set_target.
1721 (make_elf_sized_object): Find target and ask target to
1723 * object.h: (Object::set_target): Remove the version that looks up
1724 a target and sets it.
1725 (Sized_relobj::setup): Take a Target object instead of
1726 an elfcpp:Ehdr as parameter.
1727 * target.cc: Include dynobj.h.
1728 (Target::do_make_elf_object_implementation): New.
1729 (Target::do_make_elf_object): New.
1730 * target.h (Target::make_elf_object): New template declaration.
1731 (Target::do_make_elf_object): New method declarations.
1732 (Target::do_make_elf_object_implementation): New template declaration.
1734 2009-08-14 Ian Lance Taylor <iant@google.com>
1736 * gold.h (FUNCTION_NAME): Define.
1737 (gold_unreachable): Use FUNCTION_NAME.
1739 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1741 * icf.cc (Icf::find_identical_sections): Issue a warning when a
1742 symbol in the --keep-unique list is not found.
1744 2009-08-12 Sriraman Tallam <tmsriram@google.com>
1746 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
1747 been maked as --keep-unique.
1748 (Icf::unfold_section): New function.
1749 * icf.h (Icf::unfold_section): New function.
1750 * options.h (General_options::keep_unique): New option.
1751 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
1752 * testsuite/Makefile.in: Regenerate.
1753 * testsuite/icf_keep_unique_test.sh: New file.
1754 * testsuite/icf_keep_unique_test.cc: New file.
1756 2009-08-12 Cary Coutant <ccoutant@google.com>
1759 * resolve.cc (Symbol_table::resolve): Check for references from
1760 dynamic objects to hidden and internal symbols.
1761 * testsuite/Makefile.am (hidden_test.sh): New test.
1762 * testsuite/Makefile.in: Regenerate.
1763 * testsuite/hidden_test.sh: New script.
1764 * testsuite/hidden_test_1.c: New test source.
1765 * testsuite/hidden_test_main.c: New test source.
1767 2009-08-11 Doug Kwan <dougkwan@google.com>
1769 * arm.cc: Update comments.
1770 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
1771 segment to locate the .ARM.exidx section if present.
1773 2009-08-09 Doug Kwan <dougkwan@google.com>
1775 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
1778 2009-08-07 Sriraman Tallam <tmsriram@google.com>
1779 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
1782 2009-08-06 Sriraman Tallam <tmsriram@google.com>
1784 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
1785 valid tls_segment only for non-debug-section relocations.
1786 * testsuite/Makefile.am: Add gc_tls_test.
1787 * testsuite/Makefile.in: Regenerate.
1788 * testsuite/gc_tls_test.cc: New file.
1789 * testsuite/gc_tls_test.sh: New file.
1791 2009-08-05 Sriraman Tallam <tmsriram@google.com>
1795 * Makefile.am (CCFILES): Add icf.cc.
1797 * Makefile.in: Regenerate.
1798 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
1799 * gc.h (gc_process_relocs): Populate lists used by icf to contain
1800 section, symbol and addend information for the relocs.
1801 * gold.cc (queue_middle_tasks): Call identical code folding.
1802 * gold.h: Add defines for multimap.
1803 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
1804 to the call of finalize_local_symbols.
1805 * main.cc (main): Create object of class Icf.
1806 * object.cc (Sized_relobj::do_layout): Allow this function to be
1807 called twice during icf.
1808 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
1809 to sections marked as identical by icf.
1810 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
1812 (Sized_relobj::do_section_entsize): New function.
1813 * object.h (Object::section_entsize): New function.
1814 (Object::do_section_entsize): New pure virtual function.
1815 (Relobj::finalize_local_symbols): Add new parameter.
1816 (Relobj::do_section_entsize): New function.
1817 * options.h (General_options::icf): New option.
1818 (General_options::icf_iterations): New option.
1819 (General_options::print_icf_sections): New option.
1820 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
1821 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
1822 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
1824 * symtab.cc (Symbol_table::is_section_folded): New function.
1825 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
1826 to sections marked as identical by icf.
1827 * symtab.h (Symbol_table::set_icf): New function.
1828 (Symbol_table::icf): New function.
1829 (Symbol_table::is_section_folded): New function.
1830 (Symbol_table::icf_): New data member.
1831 * target-reloc.h (relocate_section): Ignore sections folded by icf.
1832 * testsuite/Makefile.am: Add commands to build icf_test.
1833 * testsuite/Makefile.in: Regenerate.
1834 * testsuite/icf_test.sh: New file.
1835 * testsuite/icf_test.cc: New file.
1837 2009-07-24 Chris Demetriou <cgd@google.com>
1839 * layout.cc (is_compressible_debug_section): Fix incorrect
1840 comment about compressed section names.
1842 2009-07-20 Ian Lance Taylor <ian@airs.com>
1845 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
1847 2009-07-16 Ian Lance Taylor <iant@google.com>
1850 * layout.h: #include <map>.
1851 (class Kept_section): Change from struct to class. Add accessors
1852 and setters. Add section size to Comdat_group mapping. Change
1853 Comdat_group to std::map. Add is_comdat_ field. Add
1854 linkonce_size field in union.
1855 (class Layout): Update declaration of find_or_add_kept_section.
1856 Don't declare find_kept_object.
1857 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
1858 parameter. Add object, shndx, is_comdat, and is_group_name
1859 parameters. Change all callers. Adjust for new Kept_section.
1860 (Layout::find_kept_object): Remove.
1861 * object.cc (Sized_relobj::include_section_group): Update use of
1862 Kept_section. Rename secnum to shndx. Only record
1863 Kept_comdat_section if sections are the same size.
1864 (Sized_relobj::include_linkonce_section): Update use of
1865 Kept_section. Only record Kept_comdat_section if sections are the
1866 same size. Set size of linkonce section.
1867 (Sized_relobj::map_to_kept_section): Update call to
1868 get_kept_comdat_section.
1869 * object.h (class Sized_relobj): Rename fields in
1870 Kept_comdat_section to drop trailing underscores; change object
1871 field to Relobj*. Change Kept_comdat_section_table to store
1872 struct rather than pointer.
1873 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
1874 Add kept_object and kept_shndx parameters. Change all callers.
1875 (Sized_relobj::get_kept_comdat_section): Change return type to
1876 bool. Add kept_object and kept_shndx parameters. Change all
1878 * plugin.cc (Pluginobj::include_comdat_group): Update call to
1879 Layout::find_or_add_kept_section.
1881 2009-07-09 Ian Lance Taylor <iant@google.com>
1883 * merge.cc (Object_merge_map::initialize_input_to_output_map):
1884 Reserve space in the hash table.
1886 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
1888 * fileread.cc (File_read::get_mtime): New method.
1889 * fileread.h (Timespec): New structure.
1890 (File_read::get_mtime): New method.
1891 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
1892 Renamed from timestamp_nsec.
1893 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
1895 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
1897 (Incremental_inputs::report_archive): Save mtime; style fix.
1898 (Incremental_inputs::report_obejct): Save mtime; style fix.
1899 (Incremental_inputs::report_script): Save mtime; style fix.
1900 (Incremental_inputs::finalize_inputs): Style fix.
1901 (Incremental_inputs::finalize): Style fix.
1902 (Incremental_inputs::create_input_section_data): Store inputs
1904 * incremental.h (Incremental_inputs::report_script): Add mtime
1906 (Incremental_inputs::Input_info::Input_info): Intialize only one
1908 (Incremental_inputs::Input_info::archive): Move to nameless
1910 (Incremental_inputs::Input_info::obejct): Move to nameless union.
1911 (Incremental_inputs::Input_info::script): Move to nameless union.
1912 (Incremental_inputs::mtime): New field.
1913 * script.cc (read_input_script): Pass file mtime to
1915 * script.h (Script_info::inputs): Style fix.
1917 2009-07-01 Ian Lance Taylor <ian@airs.com>
1919 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
1922 2009-06-24 Ian Lance Taylor <iant@google.com>
1925 * layout.cc (Layout::choose_output_section): If we find an
1926 existing section, update the flags.
1927 (Layout::create_notes): New function, broken out of
1929 (Layout::finalize): Don't create note sections.
1930 (Layout::create_note): Don't crash if linker script discards
1932 (Layout::create_gold_note): Likewise.
1933 (Layout::create_build_id): Likewise. Don't set
1934 after_input_sections on the section.
1935 (Layout::create_executable_stack_info): Remove target parameter.
1937 * layout.h (class Layout): Declare create_notes. Update
1938 declaration of create_executable_stack_info.
1939 * gold.cc (queue_middle_tasks): Call create_notes.
1940 * output.cc (Output_section::update_flags_for_input_section): Move
1941 here from output.h. If SHF_ALLOC flag is newly set, mark address
1943 * output.h (Output_data::mark_address_invalid): New function.
1944 (class Output_section): Only declare, not define,
1945 update_flags_for_input_section. Remove set_flags.
1947 2009-06-24 Ian Lance Taylor <iant@google.com>
1949 * script-sections.cc (Output_section_definition::
1950 set_section_addresses): Rename shadowing local load_address to
1953 2009-06-24 Ian Lance Taylor <iant@google.com>
1956 * reloc.cc (relocate_sections): Skip empty relocation sections.
1958 2009-06-23 Ian Lance Taylor <iant@google.com>
1961 * layout.cc (Layout::create_note): Use choose_output_section
1962 rather than make_output_section.
1964 2009-06-23 Ian Lance Taylor <iant@google.com>
1967 * options.cc (General_options::parse_V): Set printed_version_.
1968 (General_options::General_options): Initialize printed_version_.
1969 * options.h (class General_options): Add printed_version_ field.
1970 * gold.cc (queue_initial_tasks): If there are no input files,
1971 don't give a fatal error if we printed the version information.
1972 (queue_middle_tasks): If using -r with a shared object, give a
1973 fatal error rather than an ordinary error.
1975 2009-06-23 Ian Lance Taylor <iant@google.com>
1978 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
1979 (Layout::make_output_section): Set have_stabstr_section_ if we see
1980 a .stab*str section.
1981 (Layout::finalize): Call link_stabs_sections.
1982 (Layout::link_stabs_sections): New file.
1983 * layout.h (class Layout): Add have_stabstr_section_ field.
1984 Declare link_stabs_sections.
1986 2009-06-23 Doug Kwan <dougkwan@google.com>
1988 * Makefile.am (libgold_a_LIBADD): New.
1989 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
1990 * Makefile.in: Regenerate.
1991 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
1992 * configure: Regenerate.
1993 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
1994 * fileread.cc: Include sys/state.h
1995 * gold.h: Declare memmem and strndup if found missing.
1996 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
1998 2009-06-23 Ian Lance Taylor <iant@google.com>
2000 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2001 * configure: Rebuild.
2003 2009-06-23 Ian Lance Taylor <iant@google.com>
2006 * object.cc (Object::section_contents): Don't try to get a view if
2007 the section has length zero.
2008 (Object::handle_gnu_warning_section): If the section is empty, use
2009 the name of the section as the warning.
2011 2009-06-23 Ian Lance Taylor <iant@google.com>
2014 * stringpool.h (class Stringpool_template): Add optimize_ field.
2015 (Stringpool_template::set_optimize): New function.
2016 * stringpool.cc (Stringpool_template::Stringpool_template):
2017 Initialize optimize_ field.
2018 (Stringpool_template::set_string_offsets): Test local optimize
2019 fild rather than parameter.
2020 * layout.cc (Layout::Layout): Call set_optimize on the section
2023 2009-06-22 Ian Lance Taylor <iant@google.com>
2026 * yyscript.y: Parse TARGET.
2027 * script.cc (script_set_target): New function.
2028 * script-c.h (script_set_target): Declare.
2029 * options.cc (General_options::string_to_object_format): Rename
2030 from string_to_object_format in anonymous namespace. Change
2032 * options.h (class General_options): Declare
2033 string_to_object_format.
2035 2009-06-22 Ian Lance Taylor <iant@google.com>
2037 * script-sections.cc (Script_sections::create_segments): Don't put
2038 program headers in a PT_LOAD segment if -n or -N.
2040 2009-06-22 Ian Lance Taylor <iant@google.com>
2043 * options.h (class General_options): Add -z lazy and -z now. Sort
2044 -z options into alphabetical order.
2045 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
2047 2009-06-21 Ian Lance Taylor <iant@google.com>
2049 * layout.cc (Layout::make_output_section): Call
2050 Target::new_output_section.
2051 (Layout::attach_allocated_section_to_segment): Put large section
2052 sections in a separate load segment with the large segment flag
2054 (Layout::segment_precedes): Sort large data segments after other
2056 (align_file_offset): New static function.
2057 (Layout::set_segment_offsets): Use align_file_offset.
2058 * output.h (class Output_section): Add is_small_section_ and
2059 is_large_section_ fields.
2060 (Output_section::is_small_section): New function.
2061 (Output_section::set_is_small_section): New function.
2062 (Output_section::is_large_section): New function.
2063 (Output_section::set_is_large_section): New function.
2064 (Output_section::is_large_data_section): New function.
2065 (class Output_segment): Add is_large_data_segment_ field.
2066 (Output_segment::is_large_data_segment): New function.
2067 (Output_segment::set_is_large_data_segment): New function.
2068 * output.cc (Output_section::Output_section): Initialize new
2070 (Output_segment::Output_segment): Likewise.
2071 (Output_segment::add_output_section): Add assertion that large
2072 data sections always go in large data segments. Force small data
2073 sections to the end of the list of data sections. Force small BSS
2074 sections to the start of the list of BSS sections. For large BSS
2075 sections to the end of the list of BSS sections.
2076 * symtab.h (class Symbol): Declare is_common_shndx.
2077 (Symbol::is_defined): Check Symbol::is_common_shndx.
2078 (Symbol::is_common): Likewise.
2079 (class Symbol_table): Define enum Commons_section_type. Update
2080 declarations. Add small_commons_ and large_commons_ fields.
2081 * symtab.cc (Symbol::is_common_shndx): New function.
2082 (Symbol_table::Symbol_table): Initialize new fields.
2083 (Symbol_table::add_from_object): Put small and large common
2084 symbols in the right list.
2085 (Symbol_table::sized_finalized_symbol): Check
2086 Symbol::is_common_shndx.
2087 (Symbol_table::sized_write_globals): Likewise.
2088 * common.cc (Symbol_table::do_allocate_commons): Allocate new
2089 common symbol lists. Don't call do_allocate_commons_list if the
2091 (Symbol_table::do_allocate_commons_list): Remove is_tls
2092 parameter. Add comons_section_type parameter. Change all
2093 callers. Handle small and large common symbols.
2094 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2095 Symbol::is_common_shndx.
2096 * resolve.cc (symbol_to_bits): Likewise.
2097 * target.h (Target::small_common_shndx): New function.
2098 (Target::small_common_section_flags): New function.
2099 (Target::large_common_shndx): New function.
2100 (Target::large_common_section_flags): New function.
2101 (Target::new_output_section): New function.
2102 (Target::Target_info): Add small_common_shndx, large_common_shndx,
2103 small_common_section_flags, and large_common_section_flags
2105 (Target::do_new_output_section): New virtual function.
2106 * arm.cc (Target_arm::arm_info): Initialize new fields.
2107 * i386.cc (Target_i386::i386_info): Likewise.
2108 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2110 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2111 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2112 (Target_x86_64::do_new_output_section): New function.
2113 * configure.ac: Define conditional MCMODEL_MEDIUM.
2114 * testsuite/Makefile.am (check_PROGRAMS): Add large.
2115 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2116 (large_LDFLAGS): Define.
2117 * testsuite/large.c: New file.
2118 * testsuite/testfile.cc (Target_test::test_target_info):
2119 Initialize new fields.
2120 * configure, testsuite/Makefile.in: Rebuild.
2122 2009-06-05 Doug Kwan <dougkwan@google.com>
2124 * Makefile.am (CCFILES): Add target.cc.
2125 * Makefile.in: Regenerate.
2126 * i386.cc (class Target_i386): Define new virtual method to
2127 override do_is_local_label_name in parent.
2128 * object.cc (Sized_relobj::do_count_local_symbols): Discard
2129 local symbols if --discard-locals or -X is given.
2130 * options.h (class General_options): Declare new options
2131 '--discard-locals' and '-X' for discarding locals.
2132 * target.h (class Target): Define new methods is_local_label_name.
2133 Declare new virtual method do_is_local_label_name.
2134 * target.cc: New file.
2135 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2136 (check_SCRIPTS): Add discard_locals_test.sh.
2137 (check_DATA): Add discard_local_tests.syms.
2138 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2139 (discard_local_tests.syms, discard_locals_test.o): New make rules.
2140 * testsuite/Makefile.in: Regenerate.
2141 * testsuite/discard_locals_test.c: New file.
2142 * testsuite/discard_locals_test.sh: Same.
2144 2009-06-05 Doug Kwan <dougkwan@google.com>
2146 * object.cc (Sized_relobj::Sized_relobj): Initialize
2147 discarded_eh_frame_shndx_ to -1U.
2148 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2150 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2151 a discarded .eh_frame section.
2152 (Sized_relobj::do_finalize_local_symbols): Ditto.
2153 * object.h (class Sized_relobj): Declare new member
2154 discarded_eh_frame_shndx_.
2155 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2156 (local_labels_test.o, local_labels_test): New rules.
2157 * testsuite/Makefile.in: Regenerate.
2159 2009-06-04 Doug Kwan <dougkwan@google.com>
2161 * layout.cc (Layout::section_name_mapping): Add mapping for
2162 special ARM sections.
2164 2009-06-03 Doug Kwan <dougkwan@google.com>
2166 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2167 (utils::has_overflow): Same.
2169 2009-06-03 Ian Lance Taylor <iant@google.com>
2171 * layout.cc (Layout::section_name_mapping): New array, replacing
2172 Layout::linkonce_mapping.
2173 (Layout::section_name_mapping_count): New variable, replacing
2174 Layout::linkonce_mapping_count.
2175 (Layout::linkonce_output_name): Remove.
2176 (Layout::output_section_name): Rewrite.
2177 * layout.h (class Layout): Rename Linkonce_mapping to
2178 Section_name_mapping, linkonce_mapping to section_name_mapping,
2179 linkonce_mapping_count to section_name_mapping_count. Don't
2180 declare linkonce_output_name.
2182 2009-06-03 Doug Kwan <dougkwan@google.com>
2184 * gold/arm.cc (namespace utils): New.
2185 (Target_arm::reloc_is_non_pic): Define new method.
2186 (class Arm_relocate_functions): New.
2187 (Target_arm::Relocate::relocate): Handle relocation types used by
2190 2009-06-03 Ian Lance Taylor <iant@google.com>
2192 * arm.cc (Target_arm::scan::global): Use || instead of |.
2194 2009-06-02 Doug Kwan <dougkwan@google.com>
2196 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
2197 issued_non_pic_error_.
2198 (class Target_arm::Scan): Declare new method check_non_pic.
2199 Define new method symbol_needs_plt_entry.
2200 Declare new data member issued_non_pic_error_.
2201 (class Target_arm::Relocate): Declare new method
2202 should_apply_static_reloc.
2203 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
2204 (Target_arm::Scan::check_non_pic): Define new method.
2205 (Target_arm::Scan::local): Handle a small subset of reloc types used
2207 (Target_arm::Scan::local): Same.
2208 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2210 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
2212 * incremental.cc (Incremental_inputs::report_command_line): Filter
2213 out --incremental-* options.
2215 2009-05-29 Doug Kwan <dougkwan@google.com>
2217 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
2219 (class Target_arm): Update comment.
2220 (Target_arm::Target_arm): Initialize new data members GOT_,
2221 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
2222 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
2223 and Target_arm::rel_dyn_section.
2224 Declare new_enum Target_arm::Got_type.
2225 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
2227 Update commments for member do_dynsym_value.
2228 (Target_arm::got_size, Target_arm::plt_section,
2229 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
2230 new methods inside class defintion.
2231 (Target_arm::got_section): Define new method.
2232 (Target_arm::rel_dyn_section): Same.
2233 (Output_data_plt_arm): New template class.
2234 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
2235 (Output_data_plt_arm:do_adjust_output_section): Define new method.
2236 (Output_data_plt_arm::add_entry): Same.
2237 (Output_data_plt_arm::first_plt_entry): Define new
2238 static data member for PLT instruction template.
2239 (Output_data_plt_arm::plt_entry): Same.
2240 (Output_data_plt_arm::do_write): Define new method.
2241 (Target_arm::make_plt_entry): Same.
2242 (Target_arm::do_finalize_sections): Same.
2243 (Target_arm::do_dynsym_value): Same.
2245 2009-05-28 Doug Kwan <dougkwan@google.com>
2247 * Makefile.am (TARGETSOURCES): Add arm.cc.
2248 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
2249 * Makefile.in: Regenerate.
2251 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2253 2009-05-26 Doug Kwan <dougkwan@google.com>
2255 * options.cc (General_options::parse_exclude_libs). Fix a comment.
2256 (General_options::check_excluded_libs): Strip off directories in
2257 archive name before matching like GNU ld does.
2258 * testsuite/Makefile.am (MOSTLYCLEANFILES,
2259 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
2260 (exclude_libs_test_LDFLAGS): Add linker option
2261 -Wl,--exclude-libs,libexclude_libs_test_3
2262 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
2263 an explicit archive without using -l.
2264 (alt/libexclude_libs_test_3.a): New make rule.
2265 * testsuite/Makefile.in: Regenerate.
2266 * testsuite/exclude_libs_test.c : Declare lib3_default().
2268 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
2269 * exclude_libs_test_3.c: New file.
2271 2009-05-26 Nick Clifton <nickc@redhat.com>
2273 * po/id.po: New Indonesian translation.
2274 * po/gold.pot: Updated template file.
2276 2009-05-22 Sriraman Tallam <tmsriram@google.com>
2278 * testsuite/Makefile.am: Add -ffunction-sections to compile
2279 gc_comdat_test files. Add -Wl,--gc-sections to build
2281 * testsuite/Makefile.in: Regenerate.
2282 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
2284 2009-05-21 Sriraman Tallam <tmsriram@google.com>
2286 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
2287 kept comdat section was garbage collected.
2288 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
2289 * testsuite/Makefile.in: Regenerate.
2290 * testsuite/gc_comdat_test.sh: New file.
2291 * testsuite/gc_comdat_test_1.cc: New file.
2292 * testsuite/gc_comdat_test_2.cc: New file.
2294 2009-05-19 Doug Kwan <dougkwan@google.com>
2296 * archive.cc (Archive::Archive): Move constructor from archive.h
2297 to here. Initialize no_export_.
2298 (Archive::get_elf_object_for_member): Set no_export flag of object.
2299 * archive.h (Archive::Archive): Move constructor body to
2301 (Archive::no_export): New method.
2302 (Archive::no_export_): New field.
2303 * object.h (Object::Object): Initialize no_export_ to false.
2304 (Object::no_export, Object::set_no_export): New methods.
2305 (Object::no_export_): New field.
2306 * options.cc (General_options::parse_exclude_libs): New method.
2307 (General_options::check_excluded_libs) Same.
2308 * options.h (exclude_libs): New option.
2309 (General_options::check_excluded_libs): New method declaration.
2310 (General_options::excluded_libs_): New field.
2311 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
2312 default or protected visibility if an object has no-export flag set.
2313 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
2314 (check_SCRIPTS): Add exclude_libs_test.sh.
2315 (check_DATA): Add exclude_libs_test.syms.
2316 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
2317 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
2318 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
2319 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
2320 (exclude_libs_test.syms, libexclude_libs_test_1.a,
2321 libexclude_libs_test_2.a): New rules.
2322 * testsuite/Makefile.in: Regenerate.
2323 * testsuite/exclude_libs_test.c: New file.
2324 * testsuite/exclude_libs_test.sh: Ditto.
2325 * testsuite/exclude_libs_test_1.c: Ditto.
2326 * testsuite/exclude_libs_test_2.c: Ditto.
2328 2009-05-15 Ian Lance Taylor <iant@google.com>
2330 * configure.ac: Check for declarations for cases where libiberty.h
2331 checks HAVE_DECL_xxx.
2332 * configure, config.in: Rebuild.
2334 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
2336 * gold.h (Incremental_argument_list): Remove (invalid) forward
2338 * incremental.cc (Incremental_inputs::report_achive): New method.
2339 (Incremental_inputs::report_object): New method.
2340 (Incremental_inputs::report_script): New method.
2341 (Incremental_inputs::finalize_inputs): New method.
2342 (Incremental_inputs::finalize): Call finalize_inputs().
2343 (Incremental_inputs::sized_create_incremental_inputs_section_data):
2344 Create inputs entries.
2345 * incremental.h (Incremental_input_type): New enum.
2346 (Incremental_inputs::Incremental_input): Initialize new fields.
2347 (Incremental_inputs::report_inputs): New method.
2348 (Incremental_inputs::report_achive): New method.
2349 (Incremental_inputs::report_object): New method.
2350 (Incremental_inputs::report_script): New method.
2351 (Incremental_inputs::finalize_inputs): New method.
2352 (Incremental_inputs::Input_info): New struct.
2353 (Incremental_inputs::Input_info_map): New typedef.
2354 (Incremental_inputs::lock_): New field.
2355 (Incremental_inputs::Inputs_): New field.
2356 (Incremental_inputs::Inputs_map): New field.
2357 * main.cc (main): Call Incremental_input::report_inputs.
2358 * options.h (Input_argument_list): Typedef moved from
2360 (Input_file_group::Files): Remove, use ::Input_argument_list.
2361 (Input_file_group::Input_argument_list): Remove, use
2362 ::Input_argument_list.
2363 * plugin.cc (Plugin_manager::add_input_file): Add error in
2365 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
2367 * script.cc (read_input_script): Call
2368 Incremental_input::report_script.
2369 * script.h (Script_info): New class.
2371 2009-04-27 Ian Lance Taylor <iant@google.com>
2373 * x86_64.cc (do_adjust_output_section): Set entsize to
2376 2009-04-23 Elliott Hughes <enh@google.com>
2378 * output.cc (Output_file::close): After short writes, continue
2379 writing from the correct offset in the buffer being written.
2381 2009-04-23 Chris Demetriou <cgd@google.com>
2383 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
2384 * configure: Regenerate.
2385 * config.in: Regenerate.
2386 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
2387 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2389 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
2391 * incremental.cc (Incremental_inputs_header_data): Renamed from
2392 Incremental_input_header_data.
2393 (Incremental_inputs_header_data::data_size): New field.
2394 (Incremental_inputs_header_data::put_input_file_count): Renamed
2395 from input_file_count.
2396 (Incremental_inputs_header_data::put_command_line_offset): Renamed
2397 from command_line_offset.
2398 (Incremental_inputs_header_data::put_reserved): Renamed from
2400 (Incremental_inputs_entry_data): Renamed from
2401 Incremental_input_entry_data.
2402 (Incremental_inputs_entry_data::data_size): New field.
2403 (Incremental_inputs::report_command_line): New method.
2404 (Incremental_inputs::finalize): New method.
2405 (Incremental_inputs::create_incremental_inputs_data): New method.
2406 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
2407 * incremental.h: New file.
2408 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
2409 (Layout::finalize): Create incremental inputs section in
2411 (Layout::create_incremental_info_sections): New method.
2412 * layout.h (Layout::incremental_inputs): New method.
2413 (Layout::create_incremental_info_sections): New method.
2414 (Layout::incremental_inputs_): New field.
2415 * main.cc (main): Notify Incremental_input of the command line.
2417 2009-04-01 Ian Lance Taylor <iant@google.com>
2418 Mikolaj Zalewski <mikolajz@google.com>
2420 * gold.h (reserve_unordered_map): Define, three versions, one for
2421 each version of Unordered_map.
2422 * layout.cc (Layout::Layout): Remove options parameter. Add
2423 number_of_input_files parameter. Don't initialize options_.
2424 Initialize number_of_input_files_ and resized_signatures_. Move
2425 sections_are_attached_.
2426 (Layout::layout_group): Reserve space for group_signatures_.
2427 (Layout::find_or_add_kept_section): Change name parameter to be a
2428 reference. Resize signatures_ map when it gets large enough.
2429 (Layout::layout_eh_frame): Use parameters->options() instead of
2431 (Layout::make_output_section): Likewise.
2432 (Layout::attach_allocated_section_to_segment): Likewise.
2433 (Layout::finalize, Layout::create_executable_stack): Likewise.
2434 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
2435 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
2436 * layout.h (class Layout): Update declarations. Remove options_
2437 field. Add number_of_input_files_ and resized_signatures_
2438 fields. Move sections_are_attached_ field.
2439 * main.cc (main): Pass number of input files to Layout
2440 constructor. Don't pass options.
2442 2009-03-30 Ian Lance Taylor <iant@google.com>
2444 * ffsll.c (ffsll): Correct implementation.
2446 2009-03-27 Ian Lance Taylor <iant@google.com>
2448 * ffsll.c: New file.
2449 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
2450 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
2451 * ftruncate.c (ftruncate): Declare before definition.
2452 * mremap.c (mremap): Likewise.
2453 * pread.c (pread): Likewise.
2454 * configure, Makefile.in, config.in: Rebuild.
2456 * mremap.c: New file.
2457 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
2458 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
2459 (mremap): Declare if HAVE_MREMAP is not defined.
2460 * configure, Makefile.in, config.in: Rebuild.
2462 2009-03-27 Cary Coutant <ccoutant@google.com>
2464 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
2465 position independent.
2466 * sparc.cc (Target_sparc::check_non_pic): Likewise.
2467 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
2469 2009-03-24 Cary Coutant <ccoutant@google.com>
2471 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
2473 (needs_dynamic_reloc): Likewise.
2475 2009-03-24 Ian Lance Taylor <iant@google.com>
2477 * yyscript.y (file_cmd): Recognize EXTERN.
2478 (extern_name_list, extern_name_list_body): New nonterminals.
2479 * script.cc (script_add_extern): Define.
2480 * script-c.h (script_add_extern): Declare.
2482 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
2484 * object.cc (is_elf_object): Define.
2485 * object.h (is_elf_object): Declare.
2486 * archive.cc (Archive::get_elf_object_for_member): Call
2488 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
2490 2009-03-24 Elliott Hughes <enh@google.com>
2492 * output.cc (Output_file::map_anonymous): Define.
2493 (Output_file::map): Use map_anonymous. If the regular mmap fails,
2494 try an anonymous one. Report the size if the mmap fails.
2495 * output.h (class Output_file): Declare map_anonymous.
2497 2009-03-24 Ian Lance Taylor <iant@google.com>
2499 * target-select.cc (instantiate_target): Don't acquire the lock if
2500 the instantiated_target_ field has already been set.
2502 2009-03-23 Ian Lance Taylor <iant@google.com>
2504 * gold-threads.h (class Initialize_lock): Define.
2505 * gold-threads.cc (class Initialize_lock_once): Define.
2506 (initialize_lock_control): New static variable.
2507 (initialize_lock_pointer): New static variable.
2508 (initialize_lock_once): New static function.
2509 (Initialize_lock::Initialize_lock): Define.
2510 (Initialize_lock::initialize): Define.
2511 * target-select.h: Include "gold-threads.h".
2512 (class Target_selector): Add lock_ and initialize_lock_ fields.
2513 Don't define instantiate_target, just declare it.
2514 * target-select.cc (Target_selector::Target_selector): Initialize
2516 (Target_selector::instantiate_target): Define.
2517 * descriptors.h: Include "gold-threads.h".
2518 (class Descriptors): Add initialize_lock_ field.
2519 * descriptors.cc (Descriptors::Descriptors): Initialize new
2521 (Descriptors::open): Use initialize_lock_ field
2522 * errors.h (class Errors): Add initialize_lock_ field.
2523 * errors.cc (Errors::Errors): Initialize new field.
2524 (Errors::initialize_lock): Use initialize_lock_ field.
2525 * powerpc.cc (class Target_selector_powerpc): Remove
2526 instantiated_target_ field. In do_recognize call
2527 instantiate_target rather than do_instantiate_target. In
2528 do_instantiate_target just allocate a new target.
2529 * sparc.cc (class Target_selector_sparc): Likewise.
2531 * freebsd.h: New file.
2532 * i386.cc: Include "freebsd.h".
2533 (Target_i386): Derive from Target_freebsd rather than
2535 (Target_selector_i386): Derive from Target_selector_freebsd rather
2536 than Target_selector.
2537 * x86_64.cc: Include "freebsd.h".
2538 (Target_x86_64): Derive from Target_freebsd rather than
2540 (Target_selector_x86_64): Derive from Target_selector_freebsd
2541 rather than Target_selector.
2542 * target.h (class Target): Add adjust_elf_header and
2543 do_adjust_elf_header.
2544 * output.cc (Output_file_header:: do_sized_write): Call target
2545 adjust_elf_header routine.
2546 * configure.tgt: Set targ_osabi.
2547 * configure.ac: Define GOLD_DEFAULT_OSABI.
2548 * parameters.cc (Parameters::default_target): Pass
2549 GOLD_DEFAULT_OSABI to select_target.
2550 * target-select.h (class Target_selector): Make instantiate_target
2551 protected rather than private.
2552 * Makefile.am (HFILES): Add freebsd.h.
2553 * configure, Makefile.in, config.in: Rebuild.
2555 * merge.cc (do_add_input_section): Correct pend value. Change
2556 message about last entry not being null terminated from error to
2559 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
2561 * incremental.cc: New file.
2562 * Makefile.am (CCFILES): Add incremental.cc.
2563 * Makefile.in: Rebuild.
2565 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
2567 * layout.cc (Layout::output_section_name): Preserve names
2568 of '.note.' sections.
2570 2009-03-19 Ian Lance Taylor <iant@google.com>
2572 * descriptors.cc (Descriptors::open): Check that the options are
2573 valid before using them.
2575 2009-03-18 Ian Lance Taylor <iant@google.com>
2577 * script-sections.h: Include <list>.
2578 (class Script_sections): Change Sections_elements from std::vector
2579 to std::list. Typedef public Elements_iterator. Add
2580 orphan_section_placement_, data_segment_align_start_, and
2581 saw_data_segment_align_ fields. Remove data_segment_align_index_
2583 * script-sections.cc (class Orphan_section_placement): New class.
2584 (class Sections_element): Add virtual functions is_relro and
2585 orphan_section_init. Remove virtual function place_orphan_here.
2586 (class Output_section_definition): Add is_relro and
2587 orphan_section_init. Remove place_orphan_here.
2588 (class Orphan_output_section): Likewise.
2589 (Script_sections::Script_sections): Update for field changes.
2590 (Script_sections::data_segment_align): Set saw_data_segment_align_
2591 and data_segment_align_start_, not data_segment_align_index.
2592 (Script_sections::data_segment_relro_end): Check
2593 saw_data_segment_align_. Use data_segment_align_start_ rather
2594 than data_segment_align_index_.
2595 (Script_sections::place_orphan): Rewrite to use
2596 Orphan_section_placement.
2598 2009-03-17 Ian Lance Taylor <iant@google.com>
2600 * archive.cc (Archive::add_symbols): Check for a version attached
2601 to the symbol name in the archive map.
2602 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
2603 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
2604 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
2605 (ver_test_11.a): New target.
2606 * testsuite/Makefile.in: Rebuild.
2608 * configure.ac: Check for chsize and posix_fallocate. Replace
2610 * ftruncate.c: New file, from gnulib.
2611 * output.cc (posix_fallocate): Define dummy version if not
2612 HAVE_POSIX_FALLOCATE.
2613 (Output_file::map): Call posix_fallocate rather than lseek and
2615 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
2616 * configure, Makefile.in, config.in: Rebuild.
2618 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
2620 * layout.h (Layout::create_note): Add section_name parameter.
2621 * layout.cc (Layout::create_note): Likewise.
2622 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
2624 2009-03-17 Ian Lance Taylor <iant@google.com>
2626 * descriptors.cc: Include "options.h".
2627 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
2628 (Descriptors::open): Always use O_CLOEXEC when opening a new
2629 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
2630 then set FD_CLOEXEC.
2632 * sparc.cc (class Target_sparc): Add has_got_section.
2633 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
2634 make sure we have a GOT section.
2636 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
2637 (Target_sparc::Scan::local): Likewise.
2638 (Target_sparc::Scan::global): Likewise.
2639 (Target_sparc::Relocate::relocate): Likewise.
2640 (Target_sparc::Relocate::relocate_tls): Likewise.
2642 * symtab.cc (Symbol_table::define_default_version): New function,
2643 broken out of add_from_object.
2644 (Symbol_table::add_from_object): Call define_default_version.
2645 (Symbol_table::define_special_symbol): Add resolve_oldsym
2646 parameter. Change all callers. If the version for a symbol comes
2647 from a version script, resolve it with the symbol with the same
2648 name with no version. Also add the symbol without a version if
2650 (do_define_in_output_data): If resolving with oldsym, don't delete
2652 (do_define_in_output_segment): Likewise.
2653 (do_define_as_constant): Likewise.
2654 * symtab.h (class Symbol_table): Update declarations.
2656 2009-03-13 Ian Lance Taylor <iant@google.com>
2658 * readsyms.cc (Read_symbols::incompatible_warning): New function.
2659 (Read_symbols::requeue): New function.
2660 (Read_symbols::do_read_symbols): If make_elf_object fails because
2661 the target type is not configured, and the file was searched for,
2662 issue a warning and retry with the next directory.
2663 (Add_symbols::run): If the file has an incompatible format, and
2664 it was searched for, requeue the Read_symbols task. On error,
2666 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
2667 dirindex parameter to constructor. Change all callers. Declare
2668 incompatible_warning and requeue.
2669 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
2670 input_argument_ and input_group_ fields. Add them to
2671 constructor. Change all callers.
2672 (class Read_script): Add dirindex_ field. Add it to constructor.
2674 * archive.cc (Archive::setup): Remove input_objects parameter.
2676 (Archive::get_file_and_offset): Likewise.
2677 (Archive::read_all_symbols): Likewise.
2678 (Archive::read_symbols): Likewise.
2679 (Archive::get_elf_object_for_member): Remove input_objects
2680 parameter. Add punconfigured parameter. Change all callers.
2681 (Archive::add_symbols): Change return type to bool. Check return
2682 value of include_member.
2683 (Archive::include_all_members): Likewise.
2684 (Archive::include_member): Change return type to bool. Return
2685 false if first included object has incompatible target. Set
2686 included_member_ field.
2687 (Add_archive_symbols::run): If add_symbols returns false, requeue
2689 * archive.h (class Archive): Add included_member_ field.
2690 Initialize it in constructor. Add input_file and searched_for
2691 methods. Update declarations.
2692 (class Add_archive_symbols): Add dirpath_, dirindex_, and
2693 input_argument_ fields. Add them to constructor. Change all
2695 * script.cc: Include "target-select.h".
2696 (class Parser_closure): Add skip_on_incompatible_target_ and
2697 found_incompatible_target_ fields. Add
2698 skip_on_incompatible_target parameter to constructor. Change all
2699 callers. Add methods skip_on_incompatible_target,
2700 clear_skip_on_incompatible_target, found_incompatible_target, and
2701 set_found_incompatible_target.
2702 (read_input_script): Add dirindex parameter. Change all callers.
2703 If parser finds an incompatible target, requeue Read_symbols
2705 (script_set_symbol): Clear skip_on_incompatible_target in
2707 (script_add_assertion, script_parse_option): Likewise.
2708 (script_start_sections, script_add_phdr): Likewise.
2709 (script_check_output_format): New function.
2710 * script.h (read_input_script): Update declaration.
2711 * script-c.h (script_check_output_format): Declare.
2712 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
2713 (ignore_cmd): Remove OUTPUT_FORMAT.
2714 * fileread.cc (Input_file::Input_file): Add explicit this.
2715 (Input_file::will_search_for): New function.
2716 (Input_file::open): Add pindex parameter. Change all callers.
2717 * fileread.h (class Input_file): Add input_file_argument method.
2718 Declare will_search_for. Update declarations.
2719 * object.cc (make_elf_object): Add punconfigured parameter.
2721 * object.h (class Object): Make input_file public. Add
2722 searched_for method.
2723 (make_elf_object): Update declaration.
2724 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
2726 * dirsearch.h (class Dirsearch): Update declaration.
2727 * options.h (class General_options): Add --warn-search-mismatch.
2728 * parameters.cc (Parameters::is_compatible_target): New function.
2729 * parameters.h (class Parameters): Declare is_compatible_target.
2730 * workqueue.cc (Workqueue::add_blocker): New function.
2731 * workqueue.h (class Workqueue): Declare add_blocker.
2733 * fileread.cc (Input_file::open): Remove options parameter.
2735 (Input_file::open_binary): Likewise.
2736 * script.cc (read_input_script): Likewise.
2737 * readsyms.h (class Read_symbols): Remove options_ field. Remove
2738 options parameter from constructor. Change all callers.
2739 (class Read_script): Likewise.
2740 * fileread.h (class Input_file): Update declarations.
2741 * script.h (read_input_script): Update declaration.
2743 2009-03-10 Nick Clifton <nickc@redhat.com>
2745 * po/es.po: New Spanish translation.
2747 2009-03-06 Cary Coutant <ccoutant@google.com>
2749 * options.cc (parse_short_option): Keep dash_z from registering itself.
2751 2009-03-03 Ian Lance Taylor <iant@google.com>
2754 * target-reloc.h (relocate_section): Pass output_section to
2756 * i386.cc (Target_i386::should_apply_static_reloc): Add
2757 output_section parameter. Change all callers.
2758 (Target_i386::Relocate::relocate): Add output_section parameter.
2759 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2760 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2761 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2762 * testsuite/two_file_shared.sh: New script.
2763 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
2764 (check_DATA): Add two_file_shared.dbg.
2765 (two_file_shared.dbg): New target.
2766 * testsuite/Makefile.in: Rebuild.
2768 2009-03-01 Ian Lance Taylor <iant@google.com>
2770 * configure.ac: Check for byteswap.h.
2771 * configure: Rebuild.
2772 * config.in: Rebuild.
2774 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
2776 * layout.cc (Layout::find_or_add_kept_section): New function.
2777 (Layout::add_comdat): Removed.
2778 * layout.h (struct Kept_section): Move out of class Layout.
2779 Remove trailing underscores from field names. Add group_sections
2780 field. Rename group_ field to is_group. Change all uses.
2781 (class Layout): Declare find_or_add_kept_section, not add_comdat.
2782 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
2783 comdat_groups_ field.
2784 (Sized_relobj::include_section_group): Use
2785 find_or_add_kept_section and Kept_section::group_sections.
2786 (Sized_relobj::include_linkonce_section): Likewise.
2787 * object.cc (class Sized_relobj): Don't define Comdat_group or
2788 Comdat_group_table. Remove find_comdat_group and
2789 add_comdat_group. Remove comdat_groups_ field.
2790 * plugin.cc (include_comdat_group): Use
2791 Layout::find_or_add_kept_section.
2793 2009-02-28 Ian Lance Taylor <iant@google.com>
2795 * README: --gc-sections and map files are now supported. Document
2796 some build requirements.
2799 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
2800 relocatable link set the value of the section symbol to zero.
2801 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
2802 relocatable link don't include the section address in the local
2805 2009-02-27 Ian Lance Taylor <iant@google.com>
2808 * options.h (class Search_directory): Add is_system_directory.
2809 (class General_options): Declare is_in_system_directory.
2810 * options.cc (get_relative_sysroot): Make static.
2811 (get_default_sysroot): Make static.
2812 (General_optoins::is_in_system_directory): New function.
2813 * fileread.cc (Input_file::is_in_system_directory): New function.
2814 * fileread.h (class Input_file): Declare is_in_system_directory.
2815 * object.h (class Object): Add is_in_system_directory.
2816 (class Input_objects): Remove system_library_directory_ field.
2817 * object.cc (Input_objects::add_object): Don't set
2818 system_library_directory_.
2819 (input_objects::found_in_system_library_directory): Remove.
2820 * symtab.cc (Symbol_table::write_globals): Remove input_objects
2821 parameter. Change all callers.
2822 (Symbol_table::sized_write_globals): Likewise.
2823 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
2824 Call Object::is_in_system_directory.
2825 * symtab.h (class Symbol_table): Update declarations.
2828 * descriptors.h (Open_descriptor): Add is_on_stack field.
2829 * descriptors.cc (Descriptors::open): If the descriptor is on the
2830 top of the stack, remove it. Initialize is_on_stack field.
2831 (Descriptors::release): Only add pod to stack if it is not on the
2833 (Descriptors::close_some_descriptor): Clear stack_next and
2837 * output.cc (Output_section::find_starting_output_address): Rename
2838 from starting_output_address; add PADDR parameter; change return
2840 * output.h (class Output_section): Declare
2841 find_starting_output_address instead of starting_output_address.
2842 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
2843 section symbol for which we can't find a merge section.
2846 * symtab.cc (Symbol_table::add_from_object): If the visibility is
2847 hidden or internal, force the symbol to be local.
2848 * resolve.cc (Symbol::override_visibility): Define.
2849 (Symbol::override_base): Use override_visibility.
2850 (Symbol_table::resolve): Likewise.
2851 (Symbol::override_base_with_special): Likewise.
2852 (Symbol_table::override_with_special): If the visibility is hidden
2853 or internal, force the symbol to be local.
2854 * symtab.h (class Symbol): Add set_visibility and
2855 override_visibility.
2856 * testsuite/ver_test_1.sh: New file.
2857 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
2858 (check_DATA): Add ver_test_1.syms.
2859 (ver_test_1.syms): New target.
2860 * testsuite/Makefile.in: Rebuild.
2862 2009-02-25 Cary Coutant <ccoutant@google.com>
2864 * layout.cc (Layout::choose_output_section): Don't rename sections
2865 when using a linker script that has a SECTIONS clause.
2866 * Makefile.in: Regenerate.
2868 * testsuite/Makefile.am (script_test_5.sh): New test case.
2869 * testsuite/Makefile.in: Regenerate.
2870 * testsuite/script_test_5.cc: New file.
2871 * testsuite/script_test_5.sh: New file.
2872 * testsuite/script_test_5.t: New file.
2874 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
2876 * archive.cc (Archive::include_member): Update calls to add_symbols.
2877 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
2878 the Layout argument.
2879 * dynobj.h (do_add_symbols): Add the Layout argument.
2880 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
2882 * object.h (Object::add_symbols): Add the Layout argument.
2883 (Object::do_add_symbols): Add the Layout argument.
2884 (Sized_relobj::do_add_symbols): Add the Layout argument.
2885 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
2886 Unify the two versions.
2887 (Add_plugin_symbols): Remove.
2888 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
2889 (Sized_pluginobj::do_add_symbols): Unify the two versions.
2890 (Add_plugin_symbols): Remove.
2891 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
2892 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
2893 (Add_symbols::run): Make it work with Pulginobj.
2895 2009-02-06 Ian Lance Taylor <iant@google.com>
2897 * object.cc (Sized_relobj::do_layout): Make info message start
2898 with lower case letter.
2900 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
2902 * binary.cc: Fix file comment.
2904 * options.h (enum Incremental_disposition): Define.
2905 (class General_options): Add new options: --incremental,
2906 --incremental_changed, --incremental_unchanged,
2907 --incremental_unknown. Add incremental_disposition_ and
2908 implicit_incremental_ fields.
2909 (General_options::incremental_disposition): New function.
2910 (class Position_dependent_options): Add incremental_disposition
2912 (Position_dependent_options::copy_from_options): Set incremental
2914 * options.cc (General_options::parse_incremental_changed): New
2916 (General_options::parse_incremental_unchanged): New function.
2917 (General_options::parse_incremental_unknown): New function.
2918 (General_options::General_options): Initialize new fields
2919 incremental_disposition_ and implicit_incremental_.
2920 (General_options::finalize): Check for uasge of --incremental-*
2921 without --incremental.
2923 2009-02-06 Chris Demetriou <cgd@google.com>
2925 * gold.h (gold_undefined_symbol): Change to take only a Symbol
2926 pointer and to report location as the file name associated with
2928 (gold_undefined_symbol_at_location): New function to replace the
2929 old gold_undefined_symbol functionality.
2930 * target-reloc.h (relocate_section): Update to use
2931 gold_undefined_symbol_at_location.
2932 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
2933 Call gold_undefined_symbol function rather than gold_error.
2934 * errors.h (Errors::undefined_symbol): Take location as a
2935 string, rather than calculating it from a relocation.
2936 * errors.cc (Errors::fatal): Print "fatal error:" before the
2938 (Errors::error, Errors::error_at_location): Print "error: "
2939 before the formatted message.
2940 (Errors::undefined_symbol): Take location as a string, rather
2941 than calculating it from a relocation.
2942 (gold_undefined_symbol_at_location): New function akin to
2943 old gold_undefined_symbol, calculates location from relocation.
2944 (gold_undefined_symbol): Change to take only a Symbol pointer
2945 and to report location as the file name associated with the symbol.
2946 * testsuite/debug_msg.sh: Update for changed error messages.
2947 * testsuite/undef_symbol.sh: Likewise.
2949 2009-02-04 Duncan Sands <baldrick@free.fr>
2952 * reduced_debug_output.h
2953 (Output_reduced_debug_abbrev_section::failed): Use format for
2955 (Output_reduced_debug_info_section::faild): Likewise.
2957 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
2959 * script.cc (Lazy_demangler): New class.
2960 (Version_script_info::get_symbol_version_helper): Demangle a
2963 2009-01-29 Cary Coutant <ccoutant@google.com>
2965 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
2967 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2969 2009-01-28 Ian Lance Taylor <iant@google.com>
2971 * version.cc (version_string): Bump to 1.9.
2973 * gold.h: Include <cstring> and <stdint.h>.
2974 * version.cc: Include <cstdio>.
2975 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
2977 * reduced_debug_output.cc (insert_into_vector): Rename from
2978 Insert_into_vector; change all callers. Use Swap_unaligned to
2979 avoid aliasing issue; remove union since it is unnecessary.
2981 2009-01-27 Sriraman Tallam <tmsriram@google.com>
2983 * Makefile.am (CCFILES): Add gc.cc.
2985 * Makefile.in: Regenerate.
2986 * gold.cc (Gc_runner): New class.
2987 (queue_initial_tasks): Call garbage collection related tasks
2988 when corresponding options are invoked.
2989 (queue_middle_gc_tasks): New function.
2990 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
2991 processed early before laying out sections during garbage collection.
2992 * gold.h (queue_middle_gc_tasks): New function.
2993 (is_prefix_of): Move from "layout.cc".
2994 * i386.cc (Target_i386::gc_process_relocs): New function.
2995 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
2996 * main.cc (main): Create object of class "Garbage_collection".
2997 * object.cc (Relobj::copy_symbols_data): New function.
2998 (Relobj::is_section_name_included): New function.
2999 (Sized_relobj::do_layout): Allow this function to be called twice
3000 during garbage collection and defer layout of section during the
3002 * object.h (Relobj::get_symbols_data): New function.
3003 (Relobj::is_section_name_included): New function.
3004 (Relobj::copy_symbols_data): New function.
3005 (Relobj::set_symbols_data): New function.
3006 (Relobj::get_relocs_data): New function.
3007 (Relobj::set_relocs_data): New function.
3008 (Relobj::is_output_section_offset_invalid): New pure virtual function.
3009 (Relobj::gc_process_relocs): New function.
3010 (Relobj::do_gc_process_relocs): New pure virtual function.
3011 (Relobj::sd_): New data member.
3012 (Sized_relobj::is_output_section_offset_invalid): New function.
3013 (Sized_relobj::do_gc_process_relocs): New function.
3014 * options.h (General_options::gc_sections): Modify to not be a no-op.
3015 (General_options::print_gc_sections): New option.
3016 * plugin.cc (Plugin_finish::run): Remove function call to
3017 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
3018 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
3019 * reloc.cc (Read_relocs::run): Add task to process relocs and
3020 determine unreferenced sections when doing garbage collection.
3021 (Gc_process_relocs): New class.
3022 (Sized_relobj::do_gc_process_relocs): New function.
3023 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
3024 sections that are garbage collected.
3025 * reloc.h (Gc_process_relocs): New class.
3026 * sparc.cc (Target_sparc::gc_process_relocs): New function.
3027 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
3028 symbols whose corresponding sections are garbage collected.
3029 (Symbol_table::Symbol_table): Add new parameter for the garbage
3031 (Symbol_table::gc_mark_undef_symbols): New function.
3032 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3033 (Symbol_table::gc_mark_dyn_syms): New function.
3034 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
3036 (Symbol_table::add_from_object): Likewise.
3037 (Symbol_table::add_from_relobj): When building shared objects, do not
3038 treat externally visible symbols as garbage.
3039 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
3040 table information for static and relocatable links.
3041 * symtab.h (Symbol_table::set_gc): New function.
3042 (Symbol_table::gc): New function.
3043 (Symbol_table::gc_mark_undef_symbols): New function.
3044 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3045 (Symbol_table::gc_mark_dyn_syms): New function.
3046 (Symbol_table::gc_): New data member.
3047 * target.h (Sized_target::gc_process_relocs): New pure virtual
3049 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
3050 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
3052 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
3054 * options.h (General_options::gc_sections): Define as a no-op for now.
3055 (General_options::no_keep_memory): Ditto.
3056 (General_options::Bshareable): Define.
3057 * options.cc (General_options::finalize): Honor -Bshareable.
3059 2009-01-20 Andreas Schwab <schwab@suse.de>
3061 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
3062 read the value in the contents, since we don't use it. Use the
3063 template endianness when writing.
3064 (Relocate::relocate): Use it for R_PPC_REL16_HA.
3066 2009-01-19 Andreas Schwab <schwab@suse.de>
3068 * configure.tgt (powerpc64-*): Fix targ_obj.
3070 2009-01-15 Ian Lance Taylor <iant@google.com>
3072 * object.cc (Sized_relobj::write_local_symbols): Don't write out
3073 local symbols when stripping all symbols.
3075 2009-01-14 Cary Coutant <ccoutant@google.com>
3077 * output.cc (Output_reloc): Add explicit instantiations.
3079 2009-01-14 Cary Coutant <ccoutant@google.com>
3081 * archive.cc (Archive::get_elf_object_for_member): Remove call
3082 to File_read::claim_for_plugin.
3083 * descriptors.cc (Descriptors::open): Remove reference to
3085 (Descriptors::claim_for_plugin): Remove.
3086 * descriptors.h (Descriptors::claim_for_plugin): Remove.
3087 (Descriptors::is_claimed): Remove.
3088 (claim_descriptor_for_plugin): Remove.
3089 * fileread.cc (File_read::claim_for_plugin): Remove.
3090 * fileread.h (File_read::claim_for_plugin): Remove.
3091 (File_read::descriptor): Reopen descriptor if necessary.
3092 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
3093 (Plugin_manager::all_symbols_read): Add task parameter. Change
3095 (Plugin_manager::get_input_file): New function.
3096 (Plugin_manager::release_input_file): New function.
3097 (Pluginobj::Pluginobj): Add filesize parameter and initialize
3098 corresponding data member.
3099 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3100 and pass to base constructor. Change all callers.
3101 (get_input_file, release_input_file): New functions.
3102 (make_sized_plugin_object): Add filesize parameter. Change all callers.
3103 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3104 (Plugin_manager::all_symbols_read): Add task parameter.
3105 (Plugin_manager::get_input_file): New function.
3106 (Plugin_manager::release_input_file): New function.
3107 (Plugin_manager::task_): New data member.
3108 (Pluginobj::Pluginobj): Add filesize parameter.
3109 (Pluginobj::filename): New function.
3110 (Pluginobj::descriptor): New function.
3111 (Pluginobj::filesize): New function.
3112 (Pluginobj::filesize_): New data member.
3113 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3114 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3115 File_read::claim_for_plugin; use Object::unlock to unlock the file.
3117 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3118 with archive libraries.
3119 * testsuite/Makefile.in: Regenerate.
3120 * testsuite/plugin_test.c (struct sym_info): New type.
3121 (get_input_file, release_input_file): New static variables.
3122 (onload): Capture new transfer vector entries.
3123 (claim_file_hook): Stop reading at end of file according to filesize.
3124 Factor out parsing of readelf output into separate function.
3125 (all_symbols_read_hook): Exercise get_input_file and release_input_file
3126 APIs and get the source file name from the symbol table. Convert
3127 source file name to corresponding object file name. Print info
3128 message when adding new input files.
3129 (parse_readelf_line): New function.
3130 * testsuite/plugin_test_1.sh: Add checks for new info messages.
3131 * testsuite/plugin_test_2.sh: Likewise.
3132 * testsuite/plugin_test_3.sh: Likewise.
3133 * testsuite/plugin_test_4.sh: New test case.
3135 2009-01-07 Ian Lance Taylor <iant@google.com>
3137 * version.cc (version_string): Bump to 1.8.
3139 2008-12-23 Cary Coutant <ccoutant@google.com>
3141 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3142 * plugin.cc (Plugin_manager::finish): Rename as
3143 layout_deferred_objects. Move cleanup to separate function.
3144 (Plugin_manager::cleanup): New function.
3145 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3147 * plugin.h (Plugin_manager::finish): Rename as
3148 layout_deferred_objects.
3149 (Plugin_manager::cleanup): New function.
3150 (Plugin_manager::cleanup_done): New field.
3152 2008-12-23 Cary Coutant <ccoutant@google.com>
3154 * plugin.cc (is_visible_from_outside): New function.
3155 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3156 so we don't return "IR only" status for exported symbols or -r links.
3158 * testsuite/Makefile.am (plugin_test_3): New test case.
3159 * testsuite/Makefile.in: Regenerate.
3160 * testsuite/plugin_test_3.sh: New file.
3162 2008-12-22 Cary Coutant <ccoutant@google.com>
3164 * object.cc (Sized_relobj::layout_section): New function.
3165 (Sized_relobj::do_layout): Defer layout of input sections until after
3166 plugin has provided replacement files.
3167 (Sized_relobj::do_layout_deferred_sections): New function.
3168 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3169 (Relobj::layout_deferred_sections): New function.
3170 (Relobj::do_layout_deferred_sections): New function.
3171 (Sized_relobj::do_layout_deferred_sections): New function.
3172 (Sized_relobj::layout_section): New function.
3173 (Sized_relobj::Deferred_layout): New structure.
3174 (Sized_relobj::deferred_layout_): New field.
3175 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3176 Change all callers. Layout deferred sections.
3177 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
3179 (Plugin_hook::run): Move code from do_plugin_hook inline.
3180 (Plugin_hook::do_plugin_hook): Remove.
3181 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3182 (Plugin_manager::finish): Renamed, was cleanup.
3183 (Plugin_manager::should_defer_layout): New function.
3184 (Plugin_manager::add_deferred_layout_object): New function.
3185 (Plugin_manager::Deferred_layout_list): New type.
3186 (Plugin_manager::deferred_layout_objects_): New field.
3187 (Plugin_hook::do_plugin_hook): Remove.
3189 2008-12-17 Ian Lance Taylor <iant@google.com>
3191 * options.h (class General_options): Add --no case for
3194 2008-12-16 Cary Coutant <ccoutant@google.com>
3196 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3198 (Plugin_manager::claim_file): Create plugin object even if
3199 plugin did not call the add_symbols callback.
3200 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
3201 asking for more symbols than were added.
3202 * testsuite/Makefile.am (plugin_test_1): Add test case with
3204 (empty.syms): New target.
3205 * testsuite/Makefile.in: Regenerate.
3206 * testsuite/plugin_test.c (claim_file_hook): Add new debug
3207 message. Don't call add_symbols if no globals.
3208 (all_symbols_read_hook): Don't provide replacement for empty
3211 2008-12-12 Ian Lance Taylor <iant@google.com>
3213 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
3214 r_type == 0 for a local symbol with r_sym == 0.
3215 (scan_relocatable_relocs): Pass r_sym to
3216 local_non_section_strategy.
3217 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
3220 * configure.ac: Update test for TLS descriptors: they are
3221 supported as of glibc 2.9.
3222 * configure: Rebuild.
3224 2008-12-11 Ian Lance Taylor <iant@google.com>
3227 * target-reloc.h (Default_scan_relocatable_relocs): For each
3228 function, map r_type == 0 to RELOC_DISCARD.
3230 2008-12-10 Cary Coutant <ccoutant@google.com>
3232 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
3233 object to override a kept COMDAT group from a plugin object.
3235 2008-12-09 Ian Lance Taylor <iant@google.com>
3238 * yyscript.y (file_cmd): Handle INPUT.
3240 * testsuite/initpri1.c: Change all declarations to be full
3241 prototypes by adding void, to avoid compiler warnings.
3243 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
3245 * options.cc (General_options::parse_plugin_opt): New.
3246 (General_options::add_plugin): The argument now is just the filename.
3247 (General_options::add_plugin_option): New.
3248 * options.h (plugin_opt): New.
3249 (add_plugin): Change argument name.
3250 (add_plugin_option): New.
3251 * plugin.cc (Plugin::load): Don't parse the plugin option.
3252 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
3253 (Plugin::add_option): New.
3254 (Plugin::args_): Change type.
3255 (Plugin::filename_): New.
3256 (Plugin_manager::add_plugin_option): New.
3257 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
3258 * testsuite/Makefile.in: Regenerate.
3260 2008-12-05 Cary Coutant <ccoutant@google.com>
3262 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
3263 Handle --strip-lto-sections option.
3264 * options.h (strip_lto_sections): New option.
3266 2008-12-01 Cary Coutant <ccoutant@google.com>
3268 * plugin.cc (ld_plugin_message): Change format parameter to const.
3269 Fix mismatch between new[] and delete.
3271 2008-11-14 Cary Coutant <ccoutant@google.com>
3273 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
3276 2008-11-05 Craig Silverstein <csilvers@google.com>
3278 * options.cc (General_options::parse_dynamic_list): New function.
3279 * options.h (General_options): New flags dynamic_list,
3280 dynamic_list_data, dynamic_list_cpp_new, and
3281 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
3282 (General_options::in_dynamic_list): New function.
3283 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
3284 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
3285 (Lex::can_continue_name): Likewise.
3287 (read_script_file): New parameter script_options.
3288 (read_dynamic_list): New function.
3289 (Script_options::define_dynamic_list): New function.
3290 (dynamic_list_keyword_parsecodes): New variable.
3291 (dynamic_list_keywords): New variable.
3292 * script.h (Script_options::define_dynamic_list): New function
3294 (read_dynamic_list): New function prototype.
3295 * symtab.cc (strprefix): New macro.
3296 (Symbol::should_add_dynsym_entry): Support dynamic_list,
3297 dynamic_list_data, dynamic_list_cpp_new, and
3298 dynamic_list_cpp_typeinfo.
3299 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
3300 (dynamic_list_expr): New rule.
3301 (dynamic_list_nodes): Likewise.
3302 (dynamic_list_node): Likewise.
3303 * testsuite/Makefile.am (dynamic_list): New test.
3304 * testsuite/Makefile.in: Regenerated.
3305 * testsuite/dynamic_list.t: New file.
3306 * testsuite/dynamic_list.sh: New file.
3308 2008-11-05 Craig Silverstein <csilvers@google.com>
3310 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
3311 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
3312 (t11_last): Likewise.
3313 * testsuite/ver_test_6.c (main): Likewise.
3315 2008-10-07 Cary Coutant <ccoutant@google.com>
3317 * options.c (General_options::finalize): Add check for -static and
3319 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
3322 2008-10-02 Cary Coutant <ccoutant@google.com>
3324 * plugin.cc (make_sized_plugin_object): Fix conditional
3325 compilation to work when not all targets are enabled.
3327 2008-09-29 Cary Coutant <ccoutant@google.com>
3329 * archive.cc (Archive::get_file_and_offset): Use filename instead
3330 of name to get library path.
3331 (Archive::include_member): Unlock external member of a thin archive.
3333 * testsuite/Makefile.am (TEST_AR): New variable.
3334 (thin_archive_test_1): New test.
3335 (thin_archive_test_2): New test.
3336 * testsuite/Makefile.in: Regenerate.
3337 * testsuite/thin_archive_main.cc: New file.
3338 * testsuite/thin_archive_test_1.cc: New file.
3339 * testsuite/thin_archive_test_2.cc: New file.
3340 * testsuite/thin_archive_test_3.cc: New file.
3341 * testsuite/thin_archive_test_4.cc: New file.
3343 2008-09-29 Cary Coutant <ccoutant@google.com>
3345 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
3346 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
3348 (Sized_relobj::do_finalize_local_symbols): Likewise.
3349 (Sized_relobj::map_to_kept_section): Likewise.
3350 * object.h (Sized_relobj::invalid_address): New constant.
3351 (Sized_relobj::do_output_section_offset): Check for invalid_address
3353 * output.cc (Output_reloc::local_section_offset): Use constant
3354 invalid_address instead of -1U.
3355 (Output_reloc::get_address): Likewise.
3356 (Output_section::output_address): Change -1U to -1ULL.
3357 * output.h (Output_reloc::invalid_address): New constant.
3358 * reloc.cc (Sized_relobj::write_sections): Use constant
3359 invalid_address instead of -1U.
3360 (Sized_relobj::relocate_sections): Likewise.
3361 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
3362 values for merge sections.
3363 * target-reloc.h (relocate_for_relocatable): Use constant
3364 invalid_address instead of -1U.
3366 2008-09-19 Cary Coutant <ccoutant@google.com>
3368 Add plugin functionality for link-time optimization (LTO).
3369 * configure.ac (plugins): Add --enable-plugins option.
3370 * configure: Regenerate.
3371 * config.in: Regenerate.
3372 * Makefile.am (LIBDL): New variable.
3373 (CCFILES): Add plugin.cc.
3374 (HFILES): Add plugin.h.
3375 (ldadd_var): Add LIBDL.
3376 * Makefile.in: Regenerate.
3378 * archive.cc: Include "plugin.h".
3379 (Archive::setup): Don't preread archive symbols when using a plugin.
3380 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
3381 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
3383 (Archive::include_member): Add symbols from plugin objects.
3384 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
3385 * descriptors.cc (Descriptors::open): Check for file descriptors
3386 abandoned by plugins.
3387 (Descriptors::claim_for_plugin): New function.
3388 * descriptors.h (Descriptors::claim_for_plugin): New function.
3389 (Open_descriptor::is_claimed): New field.
3390 (claim_descriptor_for_plugin): New function.
3391 * fileread.cc (File_read::claim_for_plugin): New function.
3392 * fileread.h (File_read::claim_for_plugin): New function.
3393 (File_read::descriptor): New function.
3394 * gold.cc: Include "plugin.h".
3395 (queue_initial_tasks): Add task to call plugin hooks for generating
3397 * main.cc: Include "plugin.h".
3398 (main): Load plugin libraries.
3399 * object.h (Pluginobj): Declare.
3400 (Object::pluginobj): New function.
3401 (Object::do_pluginobj): New function.
3402 (Object::set_target): New function.
3403 * options.cc: Include "plugin.h".
3404 (General_options::parse_plugin): New function.
3405 (General_options::General_options): Initialize plugins_ field.
3406 (General_options::add_plugin): New function.
3407 * options.h (Plugin_manager): Declare.
3408 (General_options): Add --plugin option.
3409 (General_options::has_plugins): New function.
3410 (General_options::plugins): New function.
3411 (General_options::add_plugin): New function.
3412 (General_options::plugins_): New field.
3413 * plugin.cc: New file.
3414 * plugin.h: New file.
3415 * readsyms.cc: Include "plugin.h".
3416 (Read_symbols::do_read_symbols): Check for archive before checking
3417 for ELF file. Call plugin hooks to claim files.
3418 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
3419 from a real object file; force override when processing replacement
3421 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
3422 (Symbol::init_base_object): Likewise.
3423 (Symbol::init_base_output_data): Likewise.
3424 (Symbol::init_base_output_segment): Likewise.
3425 (Symbol::init_base_constant): Likewise.
3426 (Symbol::init_base_undefined): Likewise.
3427 (Symbol::output_section): Assert that object is not a plugin.
3428 (Symbol_table::add_from_pluginobj): New function.
3429 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
3431 (Symbol_table::sized_write_globals): Likewise.
3432 (Symbol_table::add_from_pluginobj): Instantiate template.
3433 * symtab.h (Sized_pluginobj): Declare.
3434 (Symbol::in_real_elf): New function.
3435 (Symbol::set_in_real_elf): New function.
3436 (Symbol::in_real_elf_): New field.
3437 (Symbol_table::add_from_pluginobj): New function.
3439 * testsuite/Makefile.am (AM_CFLAGS): New variable.
3440 (LIBDL): New variable.
3442 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
3443 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
3444 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
3445 (MOSTLYCLEANFILES): Likewise.
3446 * testsuite/Makefile.in: Regenerate.
3447 * testsuite/plugin_test.c: New file.
3448 * testsuite/plugin_test_1.sh: New file.
3449 * testsuite/plugin_test_2.sh: New file.
3451 2008-09-16 Ian Lance Taylor <iant@google.com>
3453 * target-reloc.h (relocate_section): Check whether a symbol is
3454 defined by the ABI before reporting an undefined symbol error.
3455 * target.h (Target::is_defined_by_abi): Make parameter const.
3456 (Target::do_is_defined_by_abi): Likewise.
3457 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
3458 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
3459 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
3460 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
3461 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
3462 * testsuite/Makefile.in: Rebuild.
3464 * fileread.cc (make_view): Add casts to avoid warning.
3466 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
3468 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
3469 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3471 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
3473 * options.h (General_options::output_is_executable): New.
3474 (General_options::output_is_pie): New.
3475 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
3476 for shared libraries.
3477 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
3479 2008-09-11 Chris Demetriou <cgd@google.com>
3481 * options.h (origin): New -z option.
3482 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
3483 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
3486 2008-09-05 Cary Coutant <ccoutant@google.com>
3488 * fileread.cc (File_read::make_view): Add check for attempt to map
3491 2008-09-05 Cary Coutant <ccoutant@google.com>
3493 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
3494 explicit instantiations.
3496 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
3499 * options.cc (General_options::finalize): Allow undefined symbols
3500 in shlibs if linking -shared.
3503 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
3504 symbols as not needing a dynsym entry.
3506 2008-08-20 Craig Silverstein <csilvers@google.com>
3508 * fileread.cc (File_read::open): Do not lock the file unless it
3509 was successfully opened.
3511 2008-08-14 Cary Coutant <ccoutant@google.com>
3513 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
3514 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
3515 * testsuite/tls_test.cc (struct int128): 128-bit struct
3516 for testing TLS relocs with non-zero addend.
3517 (v12): New TLS variable.
3519 (t_last): Add check for v12.
3520 * testsuite/tls_test.h (t12): New function.
3521 * testsuite/tls_test_main.cc (thread_routine): Call new test.
3523 2008-08-13 Ian Lance Taylor <iant@google.com>
3525 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
3526 set tls_segment_ or relro_segment_.
3527 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
3529 * output.h (Output_section::clear_is_relro): New function.
3530 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
3531 sections specially even when output_data_ is empty.
3532 (Output_segment::maximum_alignment): When first section is relro,
3533 only force alignment for PT_LOAD segments.
3534 * script.cc (script_data_segment_align): New function.
3535 (script_data_segment_relro_end): New function.
3536 * script-c.h (script_data_segment_align): Declare.
3537 (script_data_segment_relro_end): Declare.
3538 * script-sections.h (class Script_sections): Declare
3539 data_segment_align and data_segment_relro_end. Add fields
3540 segment_align_index_ and saw_relro_end_.
3541 * script-sections.cc (class Sections_element): Add set_is_relro
3542 virtual function. Add new bool* parameter to place_orphan_here.
3543 Add get_output_section virtual function.
3544 (class Output_section_definition): Add set_is_relro. Add new
3545 bool* parameter to place_orphan_here. Add get_output_section.
3546 Add is_relro_ field.
3547 (Output_section_definition::Output_section_definition): Initialize
3548 evaluated_address_, evaluated_load_address, evaluated_addralign_,
3549 and is_relro_ fields.
3550 (Output_section_definition::place_orphan_here): Add is_relro
3552 (Output_section_definition::set_section_addresses): Set relro for
3554 (Output_section_definition::alternate_constraint): Likewise.
3555 (class Orphan_output_section): Add new bool* parameter to
3556 place_orphan_here. Add get_output_section.
3557 (Orphan_output_section::place_orphan_here): Add is_relro
3559 (Script_sections::Script_sections): Initialize
3560 data_segment_align_index_ and saw_relro_end_.
3561 (Script_sections::data_segment_align): New function.
3562 (Script_sections::data_segment_relro_end): New function.
3563 (Script_sections::place_orphan): Set or clear is_relro.
3564 (Script_sections::set_section_addresses): Force alignment of first
3566 * yyscript.y (exp): Call script_data_segment_align and
3567 script_data_segment_relro_end.
3568 * testsuite/relro_script_test.t: New file.
3569 * testsuite/relro_test.cc (using_script): Declare.
3570 (t1, t2): Test using_script.
3571 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
3572 (relro_script_test_SOURCES): Define.
3573 (relro_script_test_DEPENDENCIES): Define.
3574 (relro_script_test_LDFLAGS): Define.
3575 (relro_script_test_LDADD): Define.
3576 (relro_script_test.so): New target.
3577 * testsuite/Makefile.in: Rebuild.
3579 2008-08-06 Cary Coutant <ccoutant@google.com>
3581 * archive.cc (Archive::total_archives, Archive::total_members)
3582 (Archive::total_members_loaded): New variables.
3583 (Archive::setup): Add parameter. Add option to preread
3585 (Archive::read_armap): Add counter.
3586 (Archive::get_file_and_offset): New function.
3587 (Archive::get_elf_object_for_member): New function.
3588 (Archive::read_all_symbols): New function.
3589 (Archive::read_symbols): New function.
3590 (Archive::add_symbols): Add counters.
3591 (Archive::include_all_members): Use armap to find members if it's
3593 (Archive::include_member): Skip reading symbols if already read.
3594 Factored code into Archive::get_file_and_offset and
3595 Archive::get_elf_object_for_member. Changed call to
3596 Mapfile::report_include_archive_member.
3597 (Archive::print_stats): New function.
3598 * archive.h: Declare Object and Read_symbols_data classes.
3599 (Archive::Archive): Add initializers for new members.
3600 (Archive::setup): Add parameter.
3601 (Archive::print_stats): New function.
3602 (Archive::total_archives, Archive::total_members)
3603 (Archive::total_members_loaded): New variables.
3604 (Archive::get_file_and_offset): New function.
3605 (Archive::get_elf_object_for_member): New function.
3606 (Archive::read_all_symbols): New function.
3607 (Archive::read_symbols): New function.
3608 (Archive::Archive_member): New class.
3609 (Archive::members_): New member.
3610 (Archive::num_members_): New member.
3611 * main.cc: Include archive.h.
3612 (main): Call Archive::print_stats.
3613 * mapfile.cc (Mapfile::report_include_archive_member): Delete
3614 archive parameter; member_name is now the fully-decorated name.
3615 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
3616 * options.h: (General_options): Add --preread-archive-symbols option.
3617 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
3620 2008-08-04 Ian Lance Taylor <iant@google.com>
3622 * symtab.h (Symbol::use_plt_offset): New function.
3623 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
3624 * powerpc.cc (Relocate::relocate): Likewise.
3625 * sparc.cc (Relocate::relocate): Likewise.
3626 * x86_64.cc (Relocate::relocate): Likewise.
3627 * testsuite/weak_plt.sh: New test.
3628 * testsuite/weak_plt_main.cc: New test.
3629 * testsuite/weak_plt_shared.cc: New test.
3630 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
3631 (check_PROGRAMS): Add weak_plt.
3632 (check_DATA): Add weak_plt_shared.so.
3633 (weak_plt_main_pic.o, weak_plt): New targets.
3634 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
3635 * testsuite/Makefile.in: Rebuild.
3637 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
3639 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
3640 * testsuite/Makefile.in: Rebuild.
3642 2008-08-04 Alan Modra <amodra@bigpond.net.au>
3644 * Makefile.am (POTFILES.in): Set LC_ALL=C.
3645 * Makefile.in: Regenerate.
3646 * po/POTFILES.in: Regenerate.
3648 2008-07-29 Ian Lance Taylor <iant@google.com>
3650 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
3651 symbols before other symbols.
3652 * testsuite/script_test_2.cc (test_addr): Declare.
3653 (test_addr_alias): Declare.
3654 (main): Check that test_addr and test_addr_alias have the right
3656 * testsuite/script_test_2.t: Define test_addr_alias and
3659 2008-07-24 Ian Lance Taylor <iant@google.com>
3662 * descriptors.cc: New file.
3663 * descriptors.h: New file.
3664 * gold-threads.h (class Hold_optional_lock): New class.
3665 * fileread.cc: Include "descriptors.h".
3666 (File_read::~File_read): Release descriptor rather than closing
3668 (File_read::open) [file]: Call open_descriptor rather than open.
3669 Set is_descriptor_opened_.
3670 (File_read::open) [memory]: Assert that descriptor is not open.
3671 (File_read::reopen_descriptor): New function.
3672 (File_read::release): Release descriptor.
3673 (File_read::do_read): Make non-const. Reopen descriptor.
3674 (File_read::read): Make non-const.
3675 (File_read::make_view): Reopen descriptor.
3676 (File_read::do_readv): Likewise.
3677 * fileread.h (class File_read): Add is_descriptor_opened_ field.
3678 Update declarations.
3679 * layout.cc: Include "descriptors.h".
3680 (Layout::create_build_id): Use open_descriptor rather than open.
3681 * output.cc: Include "descriptors.h".
3682 (Output_file::open): Use open_descriptor rather than open.
3683 * archive.cc (Archive::const_iterator): Change Archive to be
3685 (Archive::begin, Archive::end): Make non-const.
3686 (Archive::count_members): Likewise.
3687 * archive.h (class Archive): Update declarations.
3688 * object.h (Object::read): Make non-const.
3689 * Makefile.am (CCFILES): Add descriptors.cc.
3690 (HFILES): Add descriptors.h.
3691 * Makefile.in: Rebuild.
3694 * gold.h: Always include <clocale>. Add Solaris workarounds
3695 following code in binutils/sysdep.h.
3698 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
3699 this->eh_frame_hdr_ is NULL before using it.
3701 * dynobj.cc (Versions::Versions): Update comment.
3703 * dynobj.cc (Versions::Versions): If there is an soname, use it as
3704 the base version name.
3706 * stringpool.cc (Stringpool_template::add_with_length): Set key to
3707 array size plus one.
3708 (Stringpool_template::set_string_offsets): Subtract one from key
3709 before using it as an array index.
3710 (Stringpool_template::get_offset_with_length): Likewise.
3711 (Stringpool_template::write_to_buffer): Likewise.
3712 * stringpool.h (Stringpool_template::get_offset_from_key):
3715 2008-07-23 Ian Lance Taylor <iant@google.com>
3718 * object.h (Merged_symbol_value::value): Do our best to handle a
3722 * script.cc (Version_script_info::get_versions): Don't add empty
3723 version tag to return value.
3724 (Version_script_info::get_symbol_version_helper): Change return
3725 type to bool. Add pversion parameter. Change all callers.
3726 (script_register_vers_node): Don't require a non-NULL tag.
3727 * script.h (class Version_script_info): Update declarations.
3728 (Version_script_info::get_symbol_version): Change return type to
3729 bool. Add version parameter. Change all callers.
3730 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
3731 handling. Handle an empty version from a version script.
3732 (Symbol_table::define_special_symbol): Likewise.
3733 * testsuite/ver_test_10.script: New file.
3734 * testsuite/ver_test_10.sh: New file.
3735 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
3736 (check_DATA): Add ver_test_10.syms.
3737 (ver_test_10.syms, ver_test_10.so): New target.
3738 * testsuite/Makefile.in: Rebuild.
3740 2008-07-23 Simon Baldwin <simonb@google.com>
3742 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
3743 to zero for undefined symbols from dynamic libraries.
3745 2008-07-23 Ian Lance Taylor <iant@google.com>
3747 * symtab.cc (Symbol_table::resolve): Remove version parameter.
3749 * symtab.h (class Symbol_table): Update declaration.
3750 * testsuite/ver_test_9.cc: New file.
3751 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
3752 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
3753 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
3754 (ver_test_9.so, ver_test_9.o): New targets.
3755 * testsuite/Makefile.in: Rebuild.
3757 2008-07-22 Ian Lance Taylor <iant@google.com>
3759 * options.h (class General_options): Define --check-sections.
3760 * layout.cc (Layout::set_segment_offsets): Handle
3763 * options.h (class General_options): Define -n/--nmagic and
3765 * options.cc (General_options::finalize): For -n/--nmagic or
3766 -N/--omagic, set -static.
3767 * layout.cc (Layout::attach_allocated_section_to_segment): If
3768 -N/--omagic, don't put read-only and read-write sections in
3770 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
3771 finding a read-only segment.
3772 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
3773 don't set the minimum segment alignment to the common page size,
3774 and don't set the file offset to the address modulo the page size.
3775 * script-sections.cc (Script_sections::create_segments): If
3776 -n/--omagic, don't put read-only and read-write sections in
3779 * cref.cc: New file.
3781 * options.h (class General_options): Add --print-symbol-counts.
3782 * main.cc (main): Issue defined symbol report if requested.
3783 * archive.cc (Archive::interpret_header): Make into a const member
3785 (Archive::add_symbols): Call Input_objects::archive_start and
3787 (Archive::const_iterator): Define new class.
3788 (Archive::begin, Archive::end): New functions.
3789 (Archive::include_all_members): Rewrite to use iterator.
3790 (Archive::count_members): New function.
3791 * archive.h (class Archive): Update declarations.
3792 (Archive::filename): New function.
3793 * object.cc: Include "cref.h".
3794 (Sized_relobj::Sized_relobj): Initialize defined_count_.
3795 (Sized_relobj::do_get_global_symbol_counts): New function.
3796 (Input_objects::add_object): Add object to cross-referencer.
3797 (Input_objects::archive_start): New function.
3798 (Input_objects::archive_stop): New function.
3799 (Input_objects::print_symbol_counts): New function.
3800 * object.h: Declare Cref and Archive.
3801 (Object::get_global_symbol_counts): New function.
3802 (Object::do_get_global_symbol_counts): New pure virtual function.
3803 (class Sized_relobj): Add defined_count_ field. Update
3805 (class Input_objects): Add cref_ field. Update constructor.
3806 Update declarations.
3807 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
3809 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
3811 (Sized_dynobj::do_get_global_symbol_counts): New function.
3812 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
3813 defined_count_. Update declarations. Define Symbols typedef.
3814 * symtab.cc (Symbol_table::add_from_relobj): Add defined
3815 parameter. Change all callers.
3816 (Symbol_table::add_from_dynobj): Add sympointers and defined
3817 parameters. Change all callers.
3818 * symtab.h (class Symbol_table): Update declarations.
3819 * Makefile.am (CCFILES): Add cref.cc.
3820 (HFILES): Add cref.h.
3821 * Makefile.in: Rebuild.
3823 2008-07-22 Simon Baldwin <simonb@google.com>
3825 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
3826 to zero when writing undefined symbols.
3828 2008-07-22 Ian Lance Taylor <iant@google.com>
3830 * output.cc (Output_section::add_input_section): Don't try to
3831 merge empty merge sections.
3833 2008-07-21 Craig Silverstein <csilvers@google.com>
3835 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3836 Include symbol version in error message.
3838 2008-07-20 Chris Demetriou <cgd@google.com>
3840 * configure.ac (gold_cv_c_random_seed): New configured variable.
3841 (RANDOM_SEED_CFLAGS): New substituted variable.
3842 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
3843 * configure: Rebuild.
3844 * Makefile.in: Likewise.
3845 * testsuite/Makefile.in: Likewise.
3847 2008-07-18 Ian Lance Taylor <iant@google.com>
3849 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
3850 where we see NAME/NULL and NAME/VERSION as separate symbols.
3851 * testsuite/ver_test_main.cc (main): Call t4.
3852 (t4, t4_2a): Define.
3853 * testsuite/ver_test_2.cc (t4_2): Define.
3854 * testsuite/ver_test_2.script: Put t4_2a in VER2.
3855 * testsuite/ver_test_4.cc (t4_2a): Define.
3856 * testsuite/ver_test_4.script: Put t4_2a in VER2.
3857 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
3859 2008-07-17 Ian Lance Taylor <iant@google.com>
3861 * dynobj.cc (Versions::add_def): If we give an error about a
3862 missing version, go ahead and create the version anyhow.
3864 2008-07-10 Ian Lance Taylor <iant@google.com>
3866 Handle output sections with more than 0x7fffffff bytes.
3867 * object.h (class Relobj): Change map_to_output_ to
3868 output_sections_, and just keep a section pointer. Change all
3869 uses. Move comdat group support to Sized_relobj.
3870 (Relobj::is_section_specially_mapped): Remove.
3871 (Relobj::output_section): Remove poff parameter. Change all
3873 (Relobj::output_section_offset): New function.
3874 (Relobj::set_section_offset): Rewrite.
3875 (Relobj::map_to_output): Remove.
3876 (Relobj::output_sections): New function.
3877 (Relobj::do_output_section_offset): New pure virtual function.
3878 (Relobj::do_set_section_offset): Likewise.
3879 (class Sized_relobj): Add section_offsets_ field. Add comdat
3880 group support from Relobj. Update declarations.
3881 (Sized_relobj::get_output_section_offset): New function.
3882 (Sized_relobj::do_output_section_offset): New function.
3883 (Sized_relobj::do_set_section_offset): New function.
3884 * object.cc (Relobj::output_section_address): Remove.
3885 (Sized_relobj::Sized_relobj): Initialize new fields.
3886 (Sized_relobj::include_section_group): Cast find_kept_object to
3888 (Sized_relobj::include_linkonce_section): Likewise.
3889 (Sized_relobj::do_layout): Use separate arrays for output section
3891 (Sized_relobj::do_count_local_symbols): Change map_to_output to
3893 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
3894 output_sections and section_offsets.
3895 (Sized_relobj::write_local_symbols): Likewise.
3896 (map_to_kept_section): Compute output address directly.
3897 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
3898 output_sections and section_offsets.
3899 (Sized_relobj::write_sections): Likewise.
3900 (Sized_relobj::relocate_sections): Likewise.
3901 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
3902 * output.h (class Output_reloc): Update declarations. Change
3903 u2_.relobj to Sized_relobj*.
3904 (class Output_data_reloc): Change add functions to use
3906 * output.cc (Output_reloc::Output_reloc): Change relobj to
3908 (Output_reloc::local_section_offset): Change return type to
3909 Elf_Addr. Use get_output_section_offset.
3910 (Output_reloc::get_address): Likewise.
3911 (Output_section::is_input_address_mapped): Don't call
3912 is_section_specially_mapped.
3913 (Output_section::output_offset): Likewise.
3914 (Output_section::output_address): Likewise.
3915 (Output_section::starting_output_address): Likewise.
3916 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
3917 parameter to Sized_relobj*.
3918 (Copy_relocs::need_copy_reloc): Likewise.
3919 (Copy_relocs::save): Likewise.
3920 * copy-relocs.h (class Copy_relocs): Update declarations.
3921 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
3922 Sized_relobj*. Change relobj_ field to Sized_relobj*.
3923 * target-reloc.h (relocate_for_relocatable): Change
3924 offset_in_output_section type to Elf_Addr. Change code that uses
3926 * layout.cc (Layout::layout): Always set *off.
3927 * mapfile.cc (Mapfile::print_input_section): Use
3928 output_section_offset.
3929 * i386.cc (Target_i386::copy_reloc): Change object parameter to
3931 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
3932 * sparc.cc (Target_sparc::copy_reloc): Likewise.
3933 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
3935 2008-07-03 Ian Lance Taylor <iant@google.com>
3937 * layout.cc (Layout::include_section): Do not discard unrecognized
3938 SHT_STRTAB sections.
3940 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
3942 * script.cc (Lex::can_continue_name): Make '?' allowable in
3943 version-script names.
3944 * testsuite/version_script.map: Change glob pattern to use '?'
3946 2008-06-30 Manish Singh <yosh@gimp.org>
3949 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
3952 2008-06-30 Ian Lance Taylor <iant@google.com>
3956 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
3957 versions]: Don't try to read the value in the contents, since we
3958 don't use it. Use the template endianness when writing.
3960 2008-06-25 Cary Coutant <ccoutant@google.com>
3962 * fileread.cc (File_read::make_view): Assert on zero-length view.
3963 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
3964 symbol table when there are no symbols to read.
3966 2008-06-23 Craig Silverstein <csilvers@google.com>
3968 * version.cc (version_string): Bump to 1.7
3970 2008-06-18 Craig Silverstein <csilvers@google.com>
3972 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
3973 constant 0xFFFF to type Valtype.
3974 (Powerpc_relocate_functions::rel16_ha): Likewise.
3976 2008-06-17 Ian Lance Taylor <iant@google.com>
3978 * output.h (Output_section::Input_section): Initialize p2align_ to
3979 zero for Output_section_data constructors.
3980 (Output_section::Input_section::addralign): If not an input
3981 section, return the alignment of the Output_section_data.
3982 * testsuite/copy_test.cc: New file.
3983 * testsuite/copy_test_1.cc: New file.
3984 * testsuite/copy_test_2.cc: New file.
3985 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
3986 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
3987 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
3988 (copy_test_1_pic.o, copy_test_1.so): New targets.
3989 (copy_test_2_pic.o, copy_test_2.so): New targets.
3990 * testsuite/Makefile.in: Rebuild.
3992 * script-sections.cc (Script_sections::place_orphan): Initialize
3993 local variable exact.
3995 2008-06-13 David Edelsohn <edelsohn@gnu.org>
3997 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
3999 2008-06-12 David Edelsohn <edelsohn@gnu.org>
4000 David S. Miller <davem@davemloft.net>
4002 * powerpc.cc: New file.
4003 * Makefile.am (TARGETSOURCES): Add powerpc.cc
4004 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4005 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4006 * Makefile.in: Rebuild.
4008 2008-06-09 Ian Lance Taylor <iant@google.com>
4010 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4012 (throwing, orig_terminate): New static variables.
4013 (terminate_handler): New static function.
4014 (t2): Set terminate handler.
4016 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
4019 * binary.cc (Binary_to_elf::sized_convert): Fix .data
4022 2008-05-30 Cary Coutant <ccoutant@google.com>
4024 * archive.cc (Archive::include_all_members) Correct to step
4025 over symbol table and extended name table in thin archives.
4027 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
4030 * target-reloc.h (relocate_for_relocatable): Fix new_offset
4033 2008-05-28 Caleb Howe <cshowe@google.com>
4035 * reduced_debug_output.cc: New file.
4036 * reduced_debug_output.h: New file.
4037 * options.h (class General_options): Add --strip-debug-non-line.
4038 * options.cc (General_options::finalize): Add strip_debug_non_line
4039 to the strip heirarchy.
4040 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
4042 * layout.cc: Include "reduced_debug_output.h".
4043 (Layout::Layout): Initialize new fields.
4044 (line_only_debug_sections): New static array.
4045 (is_lines_only_debug_sections): New static inline function.
4046 (Layout::include_section): Handle --strip-debug-non-line.
4047 (Layout::make_output_section): If --strip-debug-non-line, build
4048 new output sections for .debug_abbrev and .debug_info.
4049 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
4050 gold. Warn about possible overflow.
4051 (read_signed_LEB_128): Likewise.
4052 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
4053 (read_signed_LEB_128): Declare.
4054 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
4055 (HFILES): Add reduced_debug_output.h.
4056 * Makefile.in: Rebuild.
4058 2008-05-21 Ian Lance Taylor <iant@google.com>
4060 * mapfile.cc: New file.
4061 * mapfile.h: New file.
4062 * options.h (class General_options): Add -M/--print-map and -Map.
4063 * options.cc (General_options::finalize): Make -M equivalent to
4065 * main.cc: Include <cstdio> and "mapfile.h".
4066 (main): Open mapfile if requested.
4067 * gold.cc (class Middle_runner): Add mapfile_ field. Update
4068 constructor. Change caller.
4069 (queue_initial_tasks): Add mapfile parameter. Change caller.
4070 (queue_middle_tasks): Likewise.
4071 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4073 * archive.cc: Include "mapfile.h".
4074 (Archive::add_symbols): Add mapfile parameter. Change all
4075 callers. Pass mapfile, symbol, and reason to include_member.
4076 (Archive::include_all_members): Add mapfile parameter. Change all
4078 (Archive::include_member): Add mapfile, sym, and why parameters.
4079 Change all callers. Report inclusion to map file.
4080 * archive.h: Include "fileread.h".
4081 (class Archive): Update declarations.
4082 (Archive::file): New const method.
4083 (class Add_archive_symbols): Add mapfile_ field. Update
4084 constructor. Change all callers.
4085 * readsyms.h (class Read_symbols): Likewise.
4086 (class Finish_group): Likewise.
4087 (class Read_script): Likewise.
4088 * common.cc: Include "mapfile.h".
4089 (Symbol_table::allocate_commons): Add mapfile parameter. Change
4091 (Symbol_table::do_allocate_commons): Likewise.
4092 (Symbol_table::do_allocate_commons_list): Likewise. Report common
4093 symbol allocation to mapfile.
4094 * common.h (class Allocate_commons_task): Add mapfile_ field.
4095 Update constructor. Change all callers.
4096 * symtab.h (class Symbol_table): Update declarations.
4097 * layout.cc: Include "mapfile.h".
4098 (Layout_task_runner::run): Print information to mapfile.
4099 (Layout::create_gold_note): Change Output_data_fixed_space to
4100 Output_data_zero_fill.
4101 (Layout::create_build_id): Likewise.
4102 (Layout::print_to_mapfile): New function.
4103 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
4104 constructor. Change caller.
4105 (class Layout): Declare print_to_mapfile.
4106 * output.cc (Output_section::Input_section::print_to_mapfile): New
4108 (Output_section::add_input_section): If producing a map, always
4109 add to input_sections_ list.
4110 (Output_section::do_print_to_mapfile): New function.
4111 (Output_segment::print_sections_to_mapfile): New function.
4112 (Output_segment::print_section_list_to_mapfile): New function.
4113 * output.h: Include "mapfile.h".
4114 (Output_data::print_to_mapfile): New function.
4115 (Output_data::do_print_to_mapfile): New virtual function.
4116 (Output_segment_headers::do_print_to_mapfile): New function.
4117 (Output_file_header::do_print_to_mapfile): New function.
4118 (Output_data_const::do_print_to_mapfile): New function.
4119 (class Output_data_const_buffer): Add map_name_ field. Update
4120 constructor. Change all callers. Add do_print_to_mapfile
4122 (class Output_data_fixed_space): Likewise.
4123 (class Output_data_space): Likewise.
4124 (class Output_data_zero_fill): New class.
4125 (Output_data_strtab::do_print_to_mapfile): New function.
4126 (Output_data_reloc_base::do_print_to_mapfile): New function.
4127 (Output_relocatable_relocs::do_print_to_mapfile): New function.
4128 (Output_data_group::do_print_to_mapfile): New function.
4129 (Output_data_got::do_print_to_mapfile): New function.
4130 (Output_data_dynamic::do_print_to_mapfile): New function.
4131 (Output_symtab_xindex::do_print_to_mapfile): New function.
4132 (class Output_section): Declare do_print_to_mapflie. Declare
4133 print_to_mapfile in Input_section.
4134 (class Output_segment): Declare new functions.
4135 * object.h (Sized_relobj::symbol_count): New function.
4136 * script-sections.cc
4137 (Output_section_element_dot_assignment::set_section_addresses):
4138 Change Output_data_fixed_space to Output_data_zero_fill.
4139 (Output_data_expression::do_print_to_mapfile): New function.
4140 * script.cc (read_input_script): Add mapfile parameter. Change
4142 * script.h (read_input_script): Update declaration.
4143 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4144 (Eh_frame::do_print_to_mapfile): New function.
4145 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4146 (Output_merge_string::do_print_to_mapfile): New function.
4147 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4149 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4151 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4153 * Makefile.am (CCFILES): Add mapfile.cc.
4154 (HFILES): Add mapfile.h.
4155 * Makefile.in: Rebuild.
4157 2008-05-19 Ian Lance Taylor <iant@google.com>
4159 * options.h (class General_options): Add -z relro.
4160 * layout.cc (Layout::Layout): Initialize relro_segment_.
4161 (Layout::add_output_section_data): Return the output section.
4162 (Layout::make_output_section): Rcognize relro sections and mark
4164 (Layout::attach_allocated_section_to_segment): Put relro sections
4165 in a PT_GNU_RELRO segment.
4166 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4168 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4170 (Layout::linkonce_mapping): Map d.rel.ro.local to
4172 (Layout::output_section_name): Us .data.rel.ro.local for any
4173 section which begins with that.
4174 * layout.h (class Layout): Update add_output_section_data
4175 declaration. Add relro_segment_ field.
4176 * output.cc (Output_section::Output_section): Initialize is_relro_
4177 and is_relro_local_ fields.
4178 (Output_segment::add_output_section): Group relro sections.
4179 (Output_segment::is_first_section_relro): New function.
4180 (Output_segment::maximum_alignment): If there is a relro section,
4181 align the segment to the common page size.
4182 (Output_segment::set_section_addresses): Track whether we are
4183 looking at relro sections. If the last section is a relro
4184 section, align to the common page size.
4185 (Output_segment::set_section_list_addresses): Add in_relro
4186 parameter. Change all callers. Align to the page size when
4187 moving from relro to non-relro section.
4188 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4190 * output.h (class Output_section): Add is_relro_ and
4191 is_relro_local_ fields.
4192 (Output_section::is_relro): New function.
4193 (Output_section::set_is_relro): New function.
4194 (Output_section::is_relro_local): New function.
4195 (Output_section::set_is_relro_local): New function.
4196 (class Output_segment): Update declarations.
4197 * i386.cc (Target_i386::got_section): Mark .got section as relro.
4198 * sparc.cc (Target_sparc::got_section): Likewise.
4199 * x86_64.cc (Target_x86_64::got_section): Likewise.
4200 * testsuite/relro_test_main.cc: New file.
4201 * testsuite/relro_test.cc: New file.
4202 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
4203 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
4204 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
4205 (relro_test.so, relro_test_pic.o): New targets.
4206 * testsuite/Makefile.in: Rebuild.
4208 2008-05-16 Ian Lance Taylor <iant@google.com>
4210 * output.cc (Output_segment::add_output_section): Remove front
4212 * output.h (class Output_segment): Remove
4213 add_initial_output_section and overloaded add_output_section.
4214 Update declaration of remaining add_output_section.
4215 * layout.cc (Layout::create_interp): Call add_output_section
4216 rather than add_initial_output_section.
4217 (Layout::finish_dynamic_section): Likewise.
4219 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
4220 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
4221 know the dynamic type.
4222 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
4223 field. Initialize it in constructor.
4224 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
4225 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
4226 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
4229 * output.cc (Output_reloc::get_address): Change return type to
4231 * output.h (class Output_reloc): Update get_address declaration.
4232 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
4233 for section addresses.
4235 2008-05-09 Ian Lance Taylor <iant@google.com>
4238 * gold.cc (gold_nomem): Use return value of write.
4240 2008-05-08 Ian Lance Taylor <iant@google.com>
4242 * symtab.c (Symbol::init_base_output_data): Add version
4243 parameter. Change all callers.
4244 (Symbol::init_base_output_segment): Likewise.
4245 (Symbol::init_base_constant): Likewise.
4246 (Symbol::init_base_undefined): Likewise.
4247 (Sized_symbol::init_output_data): Likewise.
4248 (Sized_symbol::init_output_segment): Likewise.
4249 (Sized_symbol::init_constant): Likewise.
4250 (Sized_symbol::init_undefined): Likewise.
4251 (Symbol_table::do_define_in_output_data): If the new symbol has a
4252 version, mark it as the default.
4253 (Symbol_table::do_define_in_output_segment): Likewise.
4254 (Symbol_table::do_define_as_constant): Likewise.
4255 * symtab.h (class Symbol): Update declarations.
4256 (class Sized_symbol): Likewise.
4257 * resolve.cc (Symbol::override_version): New function.
4258 (Symbol::override_base): Call override_version.
4259 (Symbol::override_base_with_special): Likewise.
4260 * testsuite/ver_script_8.script: New file.
4261 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
4262 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
4263 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
4264 (ver_test_8_1.so, ver_test_8_2.so): New targets.
4266 2008-05-06 Ian Lance Taylor <iant@google.com>
4269 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
4271 (class General_options): Remove existing --undefined, and add
4272 --no-undefined instead. Add new --undefined as synonym for -u.
4273 * archive.cc (Archive::add_symbols): Check whether symbol was
4275 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
4276 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
4277 all uses. Add IS_UNDEFINED. Update declarations to split
4278 different versions of init_base. Declare init_base_undefined.
4279 (Symbol::is_defined): Handle IS_UNDEFINED.
4280 (Symbol::is_undefined): Likewise.
4281 (Symbol::is_weak_undefined): Call is_undefined.
4282 (Symbol::is_absolute): Handle IS_CONSTANT.
4283 (class Sized_symbol): Update declarations to split different
4284 versions of init. Declare init_undefined.
4285 (class Symbol_table): Declare new functions.
4286 * symtab.cc (Symbol::init_base_object): Rename from init_base.
4288 (Symbol::init_base_output_data): Likewise.
4289 (Symbol::init_base_output_segment): Likewise.
4290 (Symbol::init_base_constant): Likewise.
4291 (Symbol::init_base_undefined): New function.
4292 (Sized_symbol::init_object): Rename from init. Change all
4294 (Sized_symbol::init_output_data): Likewise.
4295 (Sized_symbol::init_output_segment): Likewise.
4296 (Sized_symbol::init_constant): Likewise.
4297 (Sized_symbol::init_undefined): New function.
4298 (Symbol_table::add_undefined_symbols_from_command_line): New
4300 (Symbol_table::do_add_undefined_symbols_from_command_line): New
4302 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
4303 (Symbol::output_section): Likewise.
4304 (Symbol::set_output_section): Likewise.
4305 (Symbol_table::sized_finalize_symbol): Likewise.
4306 (Symbol_table::sized_write_globals): Likewise.
4307 * resolve.cc (Symbol_table::should_override): Likewise.
4308 (Symbol::override_base_with_special): Likewise.
4310 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
4311 symbol, change it to have default visibility.
4312 * testsuite/protected_1.cc: New file.
4313 * testsuite/protected_2.cc: New file.
4314 * testsuite/protected_3.cc: New file.
4315 * testsuite/protected_main_1.cc: New file.
4316 * testsuite/protected_main_2.cc: New file.
4317 * testsuite/protected_main_3.cc: New file.
4318 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
4319 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
4320 (protected_1_LDFLAGS, protected_1_LDADD): Define.
4321 (protected_1.so): New target.
4322 (protected_1_pic.o, protected_2_pic.o): New targets.
4323 (protected_3_pic.o): New target.
4324 (check_PROGRAMS): Add protected_2.
4325 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
4326 (protected_2_LDFLAGS, protected_2_LDADD): Define.
4327 * testsuite/Makefile.in: Rebuild.
4329 * options.h (DEFINE_var): Add set_user_set_##varname__.
4330 (DEFINE_bool_alias): New macro.
4331 (class General_options): Define -Bstatic using DEFINE_bool_alias
4332 rather than DEFINE_special. Add --undefined as an alias for -z
4334 * options.cc (General_options::parse_Bstatic): Remove.
4336 * options.h (class General_options): Add --fatal-warnings.
4337 * main.cc (main): Implement --fatal-warnings.
4338 * errors.h (Errors::warning_count): New function.
4340 * options.h (class General_options): Add -Bsymbolic-functions.
4341 * symtab.h (Symbol::is_preemptible): Check for
4342 -Bsymbolic-functions.
4344 2008-05-05 Ian Lance Taylor <iant@google.com>
4346 * options.h (DEFINE_bool): For DASH_Z, create the negative option
4347 as noVARNAME rather than no-VARNAME.
4348 (class General_options): Add option -z combreloc.
4349 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
4351 (Output_reloc::sort_before) [SHT_REL]: New function.
4352 (Output_reloc::sort_before) [SHT_RELA]: New function.
4353 (class Output_data_reloc_base): Add sort_relocs_ field. Define
4354 Sort_relocs_comparison.
4355 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
4356 parameter. Change all callers.
4357 (Output_data_reloc::Output_data_reloc) [both versions]: Add
4358 sort_relocs parameter. Change all callers.
4359 * output.cc (Output_reloc::get_address): New function, broken out
4361 (Output_reloc::write_rel): Call it.
4362 (Output_reloc::compare): New function.
4363 (Output_data_reloc_base::do_write): Optionally sort relocs.
4365 * configure.ac: If targ_extra_obj is set, link it in.
4366 * configure.tgt: Initialize all variables.
4367 (x86_64*): Set targ_extra_obj and targ_extra_size.
4368 * configure: Rebuild.
4370 * object.cc (Sized_relobj::include_section_group): Adjust section
4371 indexes read from group data. Build vector to pass to
4373 * layout.cc (Layout::layout_group): Add flags and shndxes
4374 parameters. Remove contents parameter. Change caller. Update
4375 explicit instantiations.
4376 * layout.h (class Layout): Update layout_group declaration.
4377 * output.cc (Output_data_group::Output_data_group): Add flags and
4378 input_shndxes parameters. Remove contents parameter. Change
4380 (Output_data_group::do_write): Change input_sections_ to
4382 * output.h (class Output_data_group): Update constructor
4383 declaration. Rename input_sections_ to input_shndxes_.
4384 * testsuite/many_sections_test.cc: Add template.
4386 2008-04-30 Cary Coutant <ccoutant@google.com>
4388 * target-reloc.h (relocate_section): Fix dead-pointer bug.
4390 * layout.cc (Layout::include_section): Refactored check for debug
4392 (Layout::add_comdat): Add new parameters. Change type
4393 of signature parameter. Add object and shndx to signatures table.
4394 (Layout::find_kept_object): New function.
4395 * layout.h: Include <cstring>.
4396 (Layout::is_debug_info_section): New function.
4397 (Layout::add_comdat): Add new parameters.
4398 (Layout::find_kept_object): New function.
4399 (Layout::Kept_section): New struct.
4400 (Layout::Signatures): Change type of map range.
4401 * object.cc (Relobj::output_section_address): New function.
4402 (Sized_relobj::include_section_group): Add new parameters. Change
4403 calls to Layout::add_comdat. Change to build table of kept comdat
4404 groups and table mapping discarded sections to kept sections.
4405 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
4406 (Sized_relobj::do_layout): Change calls to include_section_group and
4407 include_linkonce_section.
4408 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
4409 value to zero when section is discarded.
4410 (Sized_relobj::map_to_kept_section): New function.
4411 * object.h (Relobj::output_section_address): New function.
4412 (Relobj::Comdat_group): New type.
4413 (Relobj::find_comdat_group): New function.
4414 (Relobj::Comdat_group_table): New type.
4415 (Relobj::Kept_comdat_section): New type.
4416 (Relobj::Kept_comdat_section_table): New type.
4417 (Relobj::add_comdat_group): New function.
4418 (Relobj::set_kept_comdat_section): New function.
4419 (Relobj::get_kept_comdat_section): New function.
4420 (Relobj::comdat_groups_): New field.
4421 (Relobj::kept_comdat_sections_): New field.
4422 (Symbol_value::input_value): Update comment.
4423 (Sized_relobj::map_to_kept_section) New function.
4424 (Sized_relobj::include_linkonce_section): Add new parameter.
4425 * target-reloc.h (Comdat_behavior): New type.
4426 (get_comdat_behavior): New function.
4427 (relocate_section): Add code to map a discarded section to the
4428 corresponding kept section when applying a relocation.
4430 2008-04-30 Craig Silverstein <csilvers@google.com>
4432 * dwarf_reader.cc (next_generation_count): New static var.
4433 (Addr2line_cache_entry): New struct.
4434 (addr2line_cache): New static var.
4435 (Dwarf_line_info::one_addr2line): Added caching.
4436 (Dwarf_line_info::clear_addr2line_cache): New function.
4437 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
4438 cache-size parameter.
4439 (Dwarf_line_info::one_addr2line_cache): New function.
4440 * symtab.cc (Symbol_table::detect_odr_violations): Pass
4441 new cache-size argument to one_addr2line(), and clear cache.
4443 2008-04-28 Cary Coutant <ccoutant@google.com>
4445 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
4446 R_386_PC8 relocations.
4448 2008-04-23 Ian Lance Taylor <iant@google.com>
4450 * object.cc (Sized_relobj::include_section_group): Check for
4451 invalid section group.
4453 * object.cc (make_elf_object): Correct test for 64-bit ELF file
4456 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
4457 than read for file header.
4458 * archive.cc (Archive::include_member): Likewise.
4460 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
4462 * aclocal.m4: Regenerate.
4463 * configure: Regenerate.
4465 2008-04-19 Ian Lance Taylor <iant@google.com>
4467 * version.cc (version_string): Bump to 1.6.
4469 * testsuite/Makefile.am (many_sections_r_test): New target.
4470 (many_sections_r_test_SOURCES): Remove.
4471 (many_sections_r_test_DEPENDENCIES): Remove.
4472 (many_sections_r_test_LDFLAGS): Remove.
4473 (many_sections_r_test_LDADD): Remove.
4475 * object.cc (Sized_relobj::do_add_symbols): Always pass
4476 local_symbol_count_ to add_from_relobj.
4478 * testsuite/Makefile.am (many_sections_check.h): Only check one in
4479 every thousand variables.
4480 * testsuite/Makefile.in: Rebuild.
4482 * object.cc (Xindex::initialize_symtab_xindex): New function.
4483 (Xindex::read_symtab_xindex): New function.
4484 (Xindex::sym_xindex_to_shndx): New function.
4485 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
4487 (Sized_relobj::do_initialize_xindex): New function.
4488 (Sized_relobj::do_read_symbols): Adjust section links.
4489 (Sized_relobj::symbol_section_and_value): Add is_ordinary
4490 parameter. Change all callers.
4491 (Sized_relobj::include_section_group): Adjust section links and
4492 symbol section indexes.
4493 (Sized_relobj::do_layout): Adjust section links.
4494 (Sized_relobj::do_count_local_symbols): Adjust section links and
4495 symbol section indexes.
4496 (Sized_relobj::do_finalize_local_symbols): Distinguish between
4497 ordinary and special symbols.
4498 (Sized_relobj::write_local_symbols): Add symtab_xindex and
4499 dynsym_xindex parameters. Change all callers. Adjust section
4500 links. Use SHN_XINDEX when needed.
4501 (Sized_relobj::get_symbol_location_info): Adjust section links.
4502 Don't get fooled by special symbols.
4503 * object.h (class Xindex): Define.
4504 (class Object): Add xindex_ parameter. Declare virtual functoin
4505 do_initialize_xindex.
4506 (Object::adjust_sym_shndx): New function.
4507 (Object::set_xindex): New protected function.
4508 (class Symbol_value): Add is_ordinary_shndx_ field.
4509 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
4510 (Symbol_value::value): Assert ordinary section.
4511 (Symbol_value::initialize_input_to_output_map): Likewise.
4512 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
4514 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
4516 (class Sized_relobj): Update declarations.
4517 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
4518 parameter. Change all callers.
4519 (Sized_relobj::adjust_shndx): New function.
4520 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
4522 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
4523 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
4524 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
4525 (Sized_dynobj::read_dynsym_section): Adjust section links.
4526 (Sized_dynobj::read_dynamic): Likewise.
4527 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
4529 (Sized_dynobj::do_initialize_xindex): New function.
4530 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
4531 do_initialize_xindex.
4532 (Sized_dynobj::adjust_shndx): New function.
4533 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
4534 dynsym_xindex_ fields.
4535 (Layout::finalize): Add a call to set_section_indexes before
4536 creating the symtab sections.
4537 (Layout::set_section_indexes): Don't do anything if the section
4538 already has a section index.
4539 (Layout::create_symtab_sections): Add shnum parameter. Change
4540 caller. Create .symtab_shndx section if needed.
4541 (Layout::create_shdrs): Add shstrtab_section parameter. Change
4543 (Layout::allocated_output_section_count): New function.
4544 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
4546 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
4547 fields. Update declarations.
4548 (Layout::symtab_xindex): New function.
4549 (Layout::dynsym_xindex): New function.
4550 (class Write_symbols_task): Add layout_ field.
4551 (Write_symbols_task::Write_symbols_task): Add layout parameter.
4553 * output.cc (Output_section_headers::Output_section_headers): Add
4554 shstrtab_section parameter. Change all callers.
4555 (Output_section_headers::do_sized_write): Store overflow values
4556 for section count and section string table section index in
4557 section header zero.
4558 (Output_file_header::do_sized_write): Check for overflow of
4559 section count and section string table section index.
4560 (Output_symtab_xindex::do_write): New function.
4561 (Output_symtab_xindex::endian_do_write): New function.
4562 * output.h (class Output_section_headers): Add shstrtab_section_.
4563 Update declarations.
4564 (class Output_symtab_xindex): Define.
4565 (Output_section::has_out_shndx): New function.
4566 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
4568 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
4570 (Sized_symbol::init): Likewise.
4571 (Symbol::output_section): Check for ordinary symbol.
4572 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
4573 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
4575 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
4576 Change all callers. Simplify handling of symbols from sections
4577 not included in the link.
4578 (Symbol_table::add_from_dynobj): Handle ordinary symbol
4580 (Weak_alias_sorter::operator()): Assert that symbols are
4582 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
4584 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
4585 parameters. Change all callers.
4586 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
4587 symbol distinction. Use SHN_XINDEX when needed.
4588 (Symbol_table::write_section_symbol): Add symtab_xindex
4589 parameter. Change all callers.
4590 (Symbol_table::sized_write_section_symbol): Likewise. Use
4591 SHN_XINDEX when needed.
4592 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
4594 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
4595 (Symbol::is_defined): Check is_ordinary.
4596 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
4597 (Symbol::is_absolute, Symbol::is_common): Likewise.
4598 (class Sized_symbol): Update declarations.
4599 (class Symbol_table): Update declarations.
4600 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
4601 parameters. Change all callers.
4602 (Sized_symbol::override): Likewise.
4603 (Symbol_table::override): Likewise.
4604 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
4605 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
4606 is_ordinary, and orig_st_shndx parameters. Change all callers.
4607 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
4608 to be in an ordinary section.
4609 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
4610 object and is_ordinary parameters. Change all callers.
4611 (Sized_dwarf_line_info::read_relocs): Add object parameter.
4612 Change all callers. Don't add undefined or non-ordinary symbols
4614 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
4616 * dwarf_reader.h (class Sized_dwarf_line_info): Update
4618 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
4619 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
4620 (Sized_relobj::relocate_sections): Likewise.
4621 * target-reloc.h (scan_relocs): Adjust section symbol index.
4622 (scan_relocatable_relocs): Likewise.
4623 * i386.cc (Scan::local): Check for ordinary symbols.
4624 * sparc.cc (Scan::local): Likewise.
4625 * x86_64.cc (Scan::local): Likewise.
4626 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
4627 to symbol_section_and_value.
4628 * testsuite/many_sections_test.cc: New file.
4629 * testsuite/Makefile.am (BUILT_SOURCES): Define.
4630 (check_PROGRAMS): Add many_sections_test.
4631 (many_sections_test_SOURCES): Define.
4632 (many_sections_test_DEPENDENCIES): Define.
4633 (many_sections_test_LDFLAGS): Define.
4634 (BUILT_SOURCES): Add many_sections_define.h.
4635 (many_sections_define.h): New target.
4636 (BUILT_SOURCES): Add many_sections_check.h.
4637 (many_sections_check.h): New target.
4638 (check_PROGRAMS): Add many_sections_r_test.
4639 (many_sections_r_test_SOURCES): Define.
4640 (many_sections_r_test_DEPENDENCIES): Define.
4641 (many_sections_r_test_LDFLAGS): Define.
4642 (many_sections_r_test_LDADD): Define.
4643 (many_sections_r_test.o): New target.
4644 * testsuite/Makefile.in: Rebuild.
4646 2008-04-17 Cary Coutant <ccoutant@google.com>
4648 * errors.cc (Errors::info): New function.
4649 (gold_info): New function.
4650 * errors.h (Errors::info): New function.
4651 * gold.h (gold_info): New function.
4652 * object.cc (Input_objects::add_object): Print trace output.
4653 * options.cc (options::parse_set): New function.
4654 (General_options::parse_wrap): Deleted.
4655 (General_options::General_options): Deleted initializer.
4656 * options.h (options::String_set): New typedef.
4657 (options::parse_set): New function.
4658 (DEFINE_set): New macro.
4659 (General_options::wrap): Changed to use DEFINE_set. Changed
4660 callers of any_wrap_symbols and is_wrap_symbol.
4661 (General_options::trace, General_options::trace_symbol):
4663 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
4664 (General_options::wrap_symbols_): Deleted.
4665 * symtab.cc (Symbol_table::add_from_object): Print trace output.
4667 2008-04-17 David S. Miller <davem@davemloft.net>
4669 * options.cc (General_options::parse_V): New function.
4670 * options.h: Add entries for -V and -Qy.
4672 2008-04-17 Ian Lance Taylor <iant@google.com>
4674 * common.cc (Symbol_table::allocate_commons): Remove options
4675 parameter. Change caller.
4676 (Symbol_table::do_allocate_commons): Remove options parameter.
4677 Change caller. Just call do_allocate_commons_list twice.
4678 (Symbol_table::do_allocate_commons_list): New function, broken out
4679 of do_allocate_commons.
4680 * common.h (class Allocate_commons_task): Remove options_ field.
4682 * symtab.cc (Symbol_table::Symbol_table): Initialize
4684 (Symbol_table::add_from_object): Put TLS common symbols on
4686 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
4687 which are IN_OUTPUT_DATA.
4688 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
4689 allocate_commons and do_allocate_commons declarations. Declare
4690 do_allocate_commons_list.
4691 * gold.cc (queue_middle_tasks): Update creation of
4692 Allocate_commons_task to not pass options.
4693 * testsuite/Makefile.am (INCLUDES): Add -I.. .
4694 (TLS_TEST_C_FLAGS): New variable.
4695 (tls_test_c_pic.o): New target.
4696 (tls_test_shared.so): Link in tls_test_c_pic.o.
4697 (tls_test_c_pic_ie.o): New target.
4698 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
4699 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
4700 (tls_test_c.o): New target.
4701 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
4702 (tls_pic_test_LDADD): Likewise.
4703 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
4704 (tls_shared_gd_to_ie_test_LDADD): Likewise.
4705 (tls_test_c_gnu2.o): New target.
4706 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
4708 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
4709 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
4710 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
4711 * testsuite/tls_test.cc: Include "config.h".
4712 (t_last): Call t11_last.
4713 * testsuite/tls_test.h (t11, t11_last): Declare.
4714 * testsuite/tls_test_c.c: New file.
4715 * testsuite/tls_test_main.cc (thread_routine): Call t11.
4716 * configure.ac: Check for OpenMP support.
4717 * configure, config.in, Makefile.in: Rebuild.
4718 * testsuite/Makefile.in: Rebuild.
4720 2008-04-16 Cary Coutant <ccoutant@google.com>
4722 * i386.cc (Target_i386::define_tls_base_symbol): New function.
4723 (Target_i386::tls_base_symbol_defined_): New field.
4724 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4725 (Target_i386::Scan::global): Likewise.
4726 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
4727 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
4728 (Target_x86_64::tls_base_symbol_defined_): New field.
4729 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
4730 (Target_x86_64::Scan::global): Likewise.
4732 2008-04-16 Cary Coutant <ccoutant@google.com>
4734 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
4735 (Symbol::needs_plt_entry): Allow weak undefined symbols.
4736 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
4737 building shared libraries.
4738 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
4739 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
4740 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
4741 * testsuite/Makefile.in: Rebuild.
4742 * testsuite/weak_undef.h: New file.
4743 * testsuite/weak_undef_file1.cc: Add extra test cases.
4744 * testsuite/weak_undef_file2.cc: Likewise.
4745 * testsuite/weak_undef_test.cc: Likewise.
4747 2008-04-16 David S. Miller <davem@davemloft.net>
4749 * sparc.cc (Target_sparc::Scan): Change from struct to class.
4750 Add issued_non_pic_error_ field. Declare check_non_pic.
4751 (Target_sparc::Scan::check_non_pic): New function.
4752 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
4753 (Target_sparc::Scan::global): Likewise.
4755 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
4756 * configure: Rebuild.
4758 * options.h (DEFINE_enable): New macro.
4759 (new_dtags): New enable option.
4760 (initfirst, interpose, loadfltr, nodefaultlib,
4761 nodelete, nodlopen, nodump): New -z options.
4762 * layout.cc (Layout:finish_dynamic_section): If new
4763 dtags enabled, emit DT_RUNPATH. Also, emit a
4764 DT_FLAGS_1 containing any specified -z flags.
4766 2008-04-16 Ian Lance Taylor <iant@google.com>
4768 * copy-relocs.cc: New file.
4769 * copy-relocs.h: New file.
4770 * reloc.cc: Remove Copy_relocs code.
4771 * reloc.h: Likewise.
4772 * reloc-types.h (struct Reloc_types) [both versions]: Add
4773 get_reloc_addend_noerror.
4774 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
4775 variants of add_global which take an addend which must be zero.
4776 * i386.cc: Include "copy-relocs.h".
4777 (class Target_i386): Change type of copy_relocs_ to variable,
4779 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
4781 (Target_i386::do_finalize_sections): Change handling of
4783 * sparc.cc: Include "copy-relocs.h".
4784 (class Target_sparc): Change type of copy_relocs_ to variable,
4786 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
4788 (Target_sparc::do_finalize_sections): Change handling of
4790 * x86_64.cc: Include "copy-relocs.h".
4791 (class Target_x86_64): Change type of copy_relocs_ to variable,
4793 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
4794 class. Change all callers.
4795 (Target_x86_64::do_finalize_sections): Change handling of
4797 * Makefile.am (CCFILES): Add copy-relocs.cc.
4798 (HFILES): Add copy-relocs.h.
4800 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
4802 * testsuite/script_test_4.sh: Permit leading zeroes.
4804 2008-04-15 Ian Lance Taylor <iant@google.com>
4806 * script-sections.cc (Script_sections::create_segments): Use
4807 header_size_adjustment even when there is enough room for the
4809 * testsuite/script_test_4.sh: New file.
4810 * testsuite/script_test_4.t: New file.
4811 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
4812 (check_DATA): Add script_test_4.stdout.
4813 (MOSTLYCLEANFILES): Likewise.
4814 (script_test_4): New target.
4815 (script_test_4.stdout): New target.
4816 * testsuite/Makefile.in: Rebuild.
4818 * sparc.cc: Add definitions for Output_data_plt_sparc class
4821 2008-04-14 David S. Miller <davem@davemloft.net>
4823 * sparc.cc: New file.
4824 * Makefile.am (TARGETSOURCES): Add sparc.cc
4825 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
4826 * configure.tgt: Document targ_extra_size and
4827 targ_extra_big_endian. Add entries for sparc-* and
4829 * configure.ac: Handle targ_extra_size and
4830 targ_extra_big_endian.
4831 * Makefile.in: Rebuild.
4832 * configure: Likewise.
4833 * po/POTFILES.in: Likewise.
4834 * po/gold.pot: Likewise.
4836 2008-04-14 Ian Lance Taylor <iant@google.com>
4838 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
4839 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
4840 in the name/type/flags to section mapping. Don't call
4841 allocate_output_section.
4842 (Layout::choose_output_section): Change parameter from adjust_name
4843 to is_input_section. Don't permit input sections after sections
4844 are attached to segments. Don't call allocate_output_section.
4845 (Layout::layout_eh_frame): Call update_flags_for_input_section,
4846 not write_enable_output_section.
4847 (Layout::make_output_section): Don't push to
4848 unattached_section_list_ nor call attach_to_segment. Call
4849 attach_section_to_segment if sections are attached.
4850 (Layout::attach_sections_to_segments): New function.
4851 (Layout::attach_section_to_segment): New function.
4852 (Layout::attach_allocated_section_to_segment): Rename from
4853 attach_to_segment. Remove flags parameter.
4854 (Layout::allocate_output_section): Remove function.
4855 (Layout::write_enable_output_section): Remove function.
4856 * layout.h (class Layout): Update for above changes. Add new
4857 field sections_are_attached_.
4858 * output.h (Output_section::update_flags_for_input_section): New
4860 * output.cc (Output_section::add_input_section): Call
4861 update_flags_for_input_section.
4862 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
4864 2008-04-11 Cary Coutant <ccoutant@google.com>
4866 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
4867 thought unnecessary.
4868 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
4870 2008-04-11 Ian Lance Taylor <iant@google.com>
4872 * output.h (class Output_section_data): Remove inline definition
4874 * output.cc (Output_section_data::set_addralign): New function.
4876 2008-04-11 Cary Coutant <ccoutant@google.com>
4878 Add support for TLS descriptors for i386 and x86_64.
4879 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
4880 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
4881 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
4883 (Target_i386::got_mod_index_entry): Remove unnecessary code.
4884 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
4885 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
4887 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
4888 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
4889 Fix problem with initial-exec relocations.
4890 (Target_i386::Relocate::relocate_tls): Likewise.
4891 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
4893 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
4894 support for section-plus-offset dynamic table entries.
4895 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
4896 (Output_data_dynamic::Dynamic_entry): Add support for
4897 section-plus-offset dynamic table entries.
4898 (Output_data_dynamic::Classification): Likewise.
4899 (Output_data_dynamic::classification_): Renamed offset_.
4900 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
4901 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
4902 (Target_x86_64::make_plt_section): New function.
4903 (Target_x86_64::reserve_tlsdesc_entries): New function.
4904 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
4905 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
4906 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
4907 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
4908 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
4909 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
4910 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
4911 add extra PLT entry for TLS descriptors.
4912 (Output_data_plt_x86_64::got_): New field.
4913 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
4914 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
4916 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
4918 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
4919 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
4920 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
4921 R_386_TLS_DESC_CALL relocations.
4922 (Target_x86_64::Scan::global): Likewise.
4923 (Target_x86_64::do_finalize_sections): Add dynamic table entries
4924 for TLS descriptors.
4925 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
4926 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
4927 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
4928 GD-to-IE relaxation.
4929 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
4930 and TLS_DESCRIPTORS.
4931 * Makefile.in: Rebuild.
4932 * configure: Rebuild.
4933 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
4934 (tls_test_shared2.so): New target.
4935 (tls_shared_gd_to_ie_test_SOURCES): New variable.
4936 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
4937 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
4938 (tls_shared_gd_to_ie_test_LDADD): New variable.
4939 (tls_shared_gnu2_gd_to_ie_test): New target.
4940 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
4942 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
4943 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
4944 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
4945 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
4946 (tls_shared_gnu2_test): New target.
4947 (tls_test_gnu2_shared.so): New target.
4948 (tls_shared_gnu2_test_SOURCES): New variable.
4949 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
4950 (tls_shared_gnu2_test_LDFLAGS): New variable.
4951 (tls_shared_gnu2_test_LDADD): New variable.
4952 * testsuite/Makefile.in: Rebuild.
4953 * testsuite/Makefile.
4955 2008-04-11 Ian Lance Taylor <iant@google.com>
4957 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
4959 * testsuite/Makefile.in: Rebuild.
4961 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
4963 * testsuite/script_test_2.cc (main): Adjust test.
4965 2008-04-11 David S. Miller <davem@davemloft.net>
4966 Ian Lance Taylor <iant@google.com>
4968 * options.h (General_options): Add entries for '-Y' and
4970 * options.cc (General_options:finalize): If -Y was used, add those
4971 entries to the library path instead of the default "/lib" and
4974 2008-04-11 David S. Miller <davem@davemloft.net>
4976 * testsuite/justsyms.t: Start at 0x100.
4977 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
4978 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
4980 * testsuite/script_test_2.cc: Adjust string and section length
4983 2008-04-09 Ian Lance Taylor <iant@google.com>
4986 * script-sections.cc (Sections_element::allocate_to_segment): Add
4988 (Output_section_definition::allocate_to_segment): Likewise.
4989 (Orphan_output_section::allocate_to_segment): Likewise.
4990 (Script_sections::attach_sections_using_phdrs_clause): Don't
4991 propagate non-PT_LOAD segments to orphan sections.
4992 * testsuite/Makefile.am (script_test_3.stdout): Generate using
4993 readelf rather than objdump.
4994 * testsuite/script_test_3.sh: Adjust accordingly. Test that
4995 .interp section and PT_INTERP segment are the same size.
4996 * testsuite/Makefile.in: Rebuild.
4998 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
4999 aliases for symbols defined in the same object.
5000 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5001 (weak_alias_test_SOURCES): New variable.
5002 (weak_alias_test_DEPENDENCIES): New variable.
5003 (weak_alias_test_LDFLAGS): New variable.
5004 (weak_alias_test_LDADD): New variable.
5005 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5006 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5007 (weak_alias_test_3.o): New target.
5008 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5009 * testsuite/weak_alias_test_main.cc: New file.
5010 * testsuite/weak_alias_test_1.cc: New file.
5011 * testsuite/weak_alias_test_2.cc: New file.
5012 * testsuite/weak_alias_test_3.cc: New file.
5014 2008-04-08 Ian Lance Taylor <iant@google.com>
5016 * options.h (class General_options): Add --noinhibit-exec option.
5017 * main.cc (main): Check --noinhibit-exec.
5019 * options.h (class General_options): Define --wrap as a special
5020 option. Add wrap_symbols_ field.
5021 (General_options::any_wrap_symbols): New function.
5022 (General_options::is_wrap_symbol): New function.
5023 * options.cc (General_options::parse_wrap): New function.
5024 (General_options::General_options): Initialize wrap_symbols_.
5025 * symtab.cc (Symbol_table::wrap_symbol): New function.
5026 (Symbol_table::add_from_object): Handle --wrap.
5027 * symtab.h (class Symbol_table): Declare wrap_symbol.
5028 * target.h (Target::wrap_char): New function.
5029 (Target::Target_info): Add wrap_char field.
5030 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
5031 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5032 * testsuite/testfile.cc (Target_test::test_target_info):
5035 * errors.cc (Errors::undefined_symbol): Mention symbol version if
5038 * layout.h (class Layout): Add added_eh_frame_data_ field.
5039 * layout.cc (Layout::Layout): Initialize new field.
5040 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
5041 output section until we find a section we merged successfully.
5042 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
5043 that the size be non-zero.
5045 * merge.cc (Object_merge_map::get_output_offset): Remove inline
5048 2008-04-08 Craig Silverstein <csilvers@google.com>
5050 * configure.ac: Export new conditional variable HAVE_ZLIB.
5051 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
5053 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
5054 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5056 2008-04-07 Ian Lance Taylor <iant@google.com>
5058 * version.cc (version_string): Set to "1.5".
5060 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
5061 Add issued_non_pic_error_ field. Declare check_non_pic.
5062 (Target_x86_64::Scan::check_non_pic): New function.
5063 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
5064 (Target_x86_64::Scan::global): Likewise.
5066 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
5067 addend parameter. Change caller. Handle merge sections.
5068 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5069 Address to Addend. Don't add in the result of
5070 local_section_offset, pass down the addend and use the returned
5072 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5073 Update declarations of local_section_offset and symbol_value.
5074 * testsuite/two_file_test_1.cc (t18): New function.
5075 * testsuite/two_file_test_2.cc (f18): New function.
5076 * testsuite/two_file_test_main.cc (main): Call t18.
5077 * testsuite/two_file_test.h (t18, f18): Declare.
5079 * configure.ac: Don't test for objdump, c++filt, or readelf.
5080 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5082 (TEST_READELF): New variable.
5083 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5084 (check_PROGRAMS): Add two_file_strip_test.
5085 (two_file_strip_test): New target.
5086 (check_PROGRAMS): Add two_file_same_shared_strip_test.
5087 (two_file_same_shared_strip_test_SOURCES): New variable.
5088 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5089 (two_file_same_shared_strip_test_LDFLAGS): New variable.
5090 (two_file_same_shared_strip_test_LDADD): New variable.
5091 (two_file_shared_strip.so): New target.
5092 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5093 (ver_test_5.syms, ver_test_7.syms): Likewise.
5094 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5095 (strip_test_3.stdout): Use TEST_OBJDUMP.
5096 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5098 2008-04-04 Cary Coutant <ccoutant@google.com>
5100 * symtab.h (Symbol::is_weak_undefined): New function.
5101 (Symbol::is_strong_undefined): New function.
5102 (Symbol::is_absolute): New function.
5103 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5104 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5106 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5107 (weak_undef_test): New target.
5108 * testsuite/Makefile.in: Rebuild.
5109 * testsuite/weak_undef_file1.cc: New file.
5110 * testsuite/weak_undef_file2.cc: New file.
5111 * testsuite/weak_undef_test.cc: New file.
5113 2008-04-03 Craig Silverstein <csilvers@google.com>
5115 * compressed_output.h (class Output_compressed_section): Use
5117 * compressed_output.cc (zlib_compress): Use unsigned buffers,
5119 (zlib_compressed_suffix): Removed.
5120 (Output_compressed_section::set_final_data_size): Use unsigned
5122 * testsuite/Makefile.am (flagstest_compress_debug_sections):
5123 Fix linker invocation.
5124 (flagstest_o_specialfile_and_compress_debug_sections):
5126 * testsuite/Makefile.in: Regenerated.
5128 2008-04-02 David S. Miller <davem@davemloft.net>
5130 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5131 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5133 2008-04-02 Craig Silverstein <csilvers@google.com>
5137 2008-04-02 Ian Lance Taylor <iant@google.com>
5139 * fileread.cc (File_read::find_view): Add byteshift and vshifted
5140 parameters. Update for new key type to views_. Change all
5142 (File_read::read): Adjust for byteshift in returned view.
5143 (File_read::add_view): New function, broken out of
5145 (File_read::make_view): New function, broken out of
5147 (File_read::find_or_make_view): Add offset and aligned
5148 parameters. Rewrite accordingly. Change all callers.
5149 (File_read::get_view): Add offset and aligned parameters. Adjust
5150 for byteshift in return value.
5151 (File_read::get_lasting_view): Likewise.
5152 * fileread.h (class File_read): Update declarations.
5153 (class File_read::View): Add byteshift_ field. Add byteshift to
5154 constructor. Add byteshift method.
5155 * archive.h (Archive::clear_uncached_views): New function.
5156 (Archive::get_view): Add aligned parameter. Change all callers.
5157 * object.h (Object::get_view): Add aligned parameter. Change all
5159 (Object::get_lasting_view): Likewise.
5161 * fileread.cc (File_read::release): Don't call clear_views if
5162 there are multiple objects.
5163 * fileread.h (File_read::clear_uncached_views): New function.
5164 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5167 2008-03-31 Cary Coutant <ccoutant@google.com>
5169 Add thin archive support.
5170 * archive.cc (Archive::armagt): New const.
5171 (Archive::setup): Remove task parameter and calls to unlock.
5172 (Archive::unlock_nested_archives): New function.
5173 (Archive::read_header): Add nested_off parameter. Change
5175 (Archive::interpret_header): Likewise.
5176 (Archive::include_all_members): Change to handle thin
5178 (Archive::include_member): Likewise.
5179 * archive.h (Archive::Archive): Add new parameters and
5181 (Archive::armagt): New const.
5182 (Archive::setup): Remove task parameter.
5183 (Archive::unlock_nested_archives): New function.
5184 (Archive::read_header): Add nested_off parameter.
5185 (Archive::interpret_header): Likewise.
5186 (Archive::Nested_archive_table): New typedef.
5187 (Archive::is_thin_archive_): New field.
5188 (Archive::nested_archives_): New field.
5189 (Archive::options_): New field.
5190 (Archive::dirpath_): New field.
5191 (Archive::task_): New field.
5192 * readsyms.cc (Read_symbols::do_read_symbols): Add check
5193 for thin archives. Pass additional parameters to
5194 Archive::Archive. Unlock the archive file after calling
5197 2008-03-29 Ian Lance Taylor <iant@google.com>
5199 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
5200 version symbol to be local.
5201 * testsuite/ver_test_4.sh: New file.
5202 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
5203 (check_DATA): Add ver_test_4.syms.
5204 (ver_test_4.syms): New target.
5205 * testsuite/Makefile.in: Rebuild.
5208 (Output_section::Input_section_sort_entry::has_priority): New
5210 (Output_section::Input_section_sort_entry::match_file_name): New
5212 (Output_section::Input_section_sort_entry::match_section_name):
5214 (Output_section::Input_section_sort_entry::match_section_name_prefix):
5216 (Output_section::Input_section_sort_entry::match_section_file):
5218 (Output_section::Input_section_sort_compare::operator()): Rewrite
5219 using new Input_section_sort_entry functions. Sort crtbegin and
5220 crtend first. Sort sections with no priority before sections with
5222 * testsuite/initpri1.c (d3): Check j != 4.
5223 (cd5): New constructor/destructor function.
5224 (main): Check j != 2.
5226 * symtab.cc (Symbol_table::add_from_object): If we don't use the
5227 new symbol when resolving, don't call set_is_default.
5228 * testsuite/ver_test_7.cc: New file.
5229 * testsuite/ver_test_7.sh: New file.
5230 * testsuite/Makefile.am (ver_test_7.so): New target.
5231 (ver_test_7.o): New target.
5232 (check_SCRIPTS): Add ver_test_7.sh.
5233 (check_DATA): Add ver_test_7.syms.
5234 (ver_test_7.syms): New target.
5236 2008-03-28 Ian Lance Taylor <iant@google.com>
5238 * layout.cc (Layout::layout): If we see an input section with a
5239 name that needs sorting, set the must_sort flag for the output
5241 (Layout::make_output_section): If the name of the output section
5242 indicates that it might require sorting, set the may_sort flag.
5243 * output.h (Output_section::may_sort_attached_input_sections): New
5245 (Output_section::set_may_sort_attached_input_sections): New
5247 (Output_section::must_sort_attached_input_sections): New
5249 (Output_section::set_must_sort_attached_input_sections): New
5251 (class Output_section): Declare Input_section_sort_entry. Define
5252 Input_section_sort_compare. Declare
5253 sort_attached_input_sections. Add new fields:
5254 may_sort_attached_input_sections_,
5255 must_sort_attached_input_sections_,
5256 attached_input_sections_are_sorted_.
5257 * output.cc (Output_section::Output_section): Initialize new
5259 (Output_section::add_input_section): Add an entry to
5260 input_sections_ if may_sort or must_sort are true.
5261 (Output_section::set_final_data_size): Call
5262 sort_attached_input_sections if necessary.
5263 (Output_section::Input_section_sort_entry): Define new class.
5264 (Output_section::Input_section_sort_compare::operator()): New
5266 (Output_section::sort_attached_input_sections): New function.
5267 * configure.ac: Check whether the compiler supports constructor
5268 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
5269 * testsuite/initpri1.c: New file.
5270 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
5271 CONSTRUCTOR_PRIORITY.
5272 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
5273 (initpri1_LDFLAGS): New variable.
5274 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5276 2008-03-27 Ian Lance Taylor <iant@google.com>
5278 * common.cc (Sort_commons::operator): Correct sorting algorithm.
5279 * testsuite/common_test_1.c: New file.
5280 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
5281 (common_test_1_SOURCES): New variable.
5282 (common_test_1_DEPENDENCIES): New variable.
5283 (common_test_1_LDFLAGS): New variable.
5285 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
5286 and commons_ correctly when NAME/VERSION does not override
5288 * testsuite/ver_test_6.c: New file.
5289 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
5290 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
5291 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
5293 2008-03-26 Ian Lance Taylor <iant@google.com>
5295 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
5296 of an undefined symbol from a version script.
5297 * testsuite/Makefile.am (ver_test_5.so): New target.
5298 (ver_test_5.o): New target.
5299 (check_SCRIPTS): Add ver_test_5.sh.
5300 (check_DATA): Add ver_test_5.syms.
5301 (ver_test_5.syms): New target.
5302 * testsuite/ver_test_5.cc: New file.
5303 * testsuite/ver_test_5.script: New file.
5304 * testsuite/ver_test_5.sh: New file.
5305 * Makefile.in, testsuite/Makefile.in: Rebuild.
5308 Fix problems building gold with gcc 4.3.0.
5309 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
5310 (gold_error_at_location, gold_warning_at_location): Use it.
5311 * configure.ac: Check whether we can compile and use a template
5312 function with a printf attribute.
5313 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
5314 when jumping over bytes.
5315 * object.cc: Instantiate Object::read_section_data.
5316 * debug.h: Include <cstring>
5317 * dwarf_reader.cc: Include <algorithm>
5318 * main.cc: Include <cstring>.
5319 * options.cc: Include <cstring>.
5320 * output.cc: Include <cstring>.
5321 * script.cc: Include <cstring>.
5322 * script.h: Include <string>.
5323 * symtab.cc: Include <cstring> and <algorithm>.
5324 * target-select.cc: Include <cstring>.
5325 * version.cc: Include <string>.
5326 * testsuite/testmain.cc: Include <cstdlib>.
5327 * configure, config.in: Rebuild.
5329 2008-03-25 Ian Lance Taylor <iant@google.com>
5331 * options.cc: Include "../bfd/bfdver.h".
5332 (options::help): Print bug reporting address.
5334 * version.cc (print_version): Adjust output for current value of
5339 * options.cc (options::help): Print list of supported targets.
5340 * target-select.h: Include <vector>.
5341 (class Target_selector): Make machine_, size_, and is_big_endian_
5342 fields const. Add bfd_name_ and instantiated_target_ fields.
5343 (Target_selector::Target_selector): Add bfd_name parameter.
5344 (Target_selector::recognize): Make non-virtual, call
5346 (Target_selector::recognize_by_name): Make non-virtual, call
5347 do_recognize_by_name.
5348 (Target_selector::supported_names): New function.
5349 (Target_selector::bfd_name): New function.
5350 (Target_selector::do_instantiate_target): New pure virtual
5352 (Target_selector::do_recognize): New virtual function.
5353 (Target_selector::do_recognize_by_name): New virtual function.
5354 (Target_selector::instantiate_target): New private function.
5355 (supported_target_names): Declare.
5356 * target-select.cc (Target_selector::Target_selector): Update for
5357 new parameter and fields.
5358 (select_target_by_name): Check that the name matches before
5359 calling recognize_by_name.
5360 (supported_target_names): New function.
5361 * i386.cc (class Target_selector_i386): Update Target_selector
5362 constructor call. Remove recognize and recognize_by_name. Add
5363 do_instantiate_target.
5364 * x86_64.cc (class Target_selector_x86_64): Likewise.
5365 * testsuite/testfile.cc (class Target_selector_test): Update for
5366 changes to Target_selector.
5368 * README: Rewrite, with some notes on unsupported features.
5370 2008-03-24 Cary Coutant <ccoutant@google.com>
5372 * i386.cc (Target_i386::Got_type): New enum declaration.
5373 (Target_i386::Scan::local): Updated callers of Output_data_got
5375 (Target_i386::Scan::global): Likewise.
5376 (Target_i386::Relocate::relocate): Likewise.
5377 (Target_i386::Relocate::relocate_tls): Likewise.
5378 * object.h (Got_offset_list): New class.
5379 (Sized_relobj::local_has_got_offset): Added got_type parameter.
5380 (Sized_relobj::local_got_offset): Likewise.
5381 (Sized_relobj::set_local_got_offset): Likewise.
5382 (Sized_relobj::local_has_tls_got_offset): Removed.
5383 (Sized_relobj::local_tls_got_offset): Removed.
5384 (Sized_relobj::set_local_tls_got_offset): Removed.
5385 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
5386 * output.cc (Output_data_got::add_global): Added got_type parameter.
5387 (Output_data_got::add_global_with_rel): Likewise.
5388 (Output_data_got::add_global_with_rela): Likewise.
5389 (Output_data_got::add_global_pair_with_rel): New function.
5390 (Output_data_got::add_global_pair_with_rela): New function.
5391 (Output_data_got::add_local): Added got_type parameter.
5392 (Output_data_got::add_local_with_rel): Likewise.
5393 (Output_data_got::add_local_with_rela): Likewise.
5394 (Output_data_got::add_local_pair_with_rel): New function.
5395 (Output_data_got::add_local_pair_with_rela): New function.
5396 (Output_data_got::add_global_tls): Removed.
5397 (Output_data_got::add_global_tls_with_rel): Removed.
5398 (Output_data_got::add_global_tls_with_rela): Removed.
5399 (Output_data_got::add_local_tls): Removed.
5400 (Output_data_got::add_local_tls_with_rel): Removed.
5401 (Output_data_got::add_local_tls_with_rela): Removed.
5402 * output.h (Output_data_got::add_global): Added got_type parameter.
5403 (Output_data_got::add_global_with_rel): Likewise.
5404 (Output_data_got::add_global_with_rela): Likewise.
5405 (Output_data_got::add_global_pair_with_rel): New function.
5406 (Output_data_got::add_global_pair_with_rela): New function.
5407 (Output_data_got::add_local): Added got_type parameter.
5408 (Output_data_got::add_local_with_rel): Likewise.
5409 (Output_data_got::add_local_with_rela): Likewise.
5410 (Output_data_got::add_local_pair_with_rel): New function.
5411 (Output_data_got::add_local_pair_with_rela): New function.
5412 (Output_data_got::add_global_tls): Removed.
5413 (Output_data_got::add_global_tls_with_rel): Removed.
5414 (Output_data_got::add_global_tls_with_rela): Removed.
5415 (Output_data_got::add_local_tls): Removed.
5416 (Output_data_got::add_local_tls_with_rel): Removed.
5417 (Output_data_got::add_local_tls_with_rela): Removed.
5418 * resolve.cc (Symbol::override_base_with_special): Removed
5419 reference to has_got_offset_ field.
5420 * symtab.cc (Symbol::init_fields): Replaced initialization
5421 of got_offset_ with got_offsets_. Removed initialization
5423 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
5424 (Symbol::got_offset): Likewise.
5425 (Symbol::set_got_offset): Likewise.
5426 (Symbol::has_tls_got_offset): Removed.
5427 (Symbol::tls_got_offset): Removed.
5428 (Symbol::set_tls_got_offset): Removed.
5429 (Symbol::got_offset_): Removed.
5430 (Symbol::tls_mod_got_offset_): Removed.
5431 (Symbol::tls_pair_got_offset_): Removed.
5432 (Symbol::got_offsets_): New field.
5433 (Symbol::has_got_offset): Removed.
5434 (Symbol::has_tls_mod_got_offset): Removed.
5435 (Symbol::has_tls_pair_got_offset): Removed.
5436 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
5437 (Target_x86_64::Scan::local): Updated callers of Output_data_got
5439 (Target_x86_64::Scan::global): Likewise.
5440 (Target_x86_64::Relocate::relocate): Likewise.
5441 (Target_x86_64::Relocate::relocate_tls): Likewise.
5443 2008-03-25 Ben Elliston <bje@au.ibm.com>
5445 * yyscript.y: Fix spelling error in comment.
5447 2008-03-24 Ian Lance Taylor <iant@google.com>
5449 * options.h (class General_options): Define build_id option.
5450 * layout.h (class Layout): Declare write_build_id, create_note,
5451 create_build_id. Add build_id_note_ member.
5452 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
5453 "libiberty.h", "md5.h", "sha1.h".
5454 (Layout::Layout): Initialize eh_frame_data_,
5455 eh_frame_hdr_section_, and build_id_note_.
5456 (Layout::finalize): Call create_build_id.
5457 (Layout::create_note): New function, broken out of
5458 Layout::create_gold_note.
5459 (Layout::create_gold_note): Call create_note.
5460 (Layout::create_build_id): New function.
5461 (Layout::write_build_id): New function.
5462 (Close_task_runner::run): Call write_build_id.
5464 * x86_64.cc: Correct license to GPLv3.
5466 2008-03-23 Ian Lance Taylor <iant@google.com>
5468 * options.cc: Include "demangle.h".
5469 (parse_optional_string): New function.
5470 (parse_long_option): Handle takes_optional_argument.
5471 (parse_short_option): Update dash_z initializer. Handle
5472 takes_optional_argument.
5473 (General_options::General_options): Initialize do_demangle_.
5474 (General_options::finalize): Set do_demangle_. Handle demangling
5476 * options.h (parse_optional_string): Declare.
5477 (struct One_option): Add optional_arg field. Update constructor.
5478 Update call constructor calls. Add takes_optional_argument
5480 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
5481 (DEFINE_optional_string): Define.
5482 (General_options::demangle): Change from DEFINE_bool to
5483 DEFINE_optional_string.
5484 (General_options::no_demangle): New function.
5485 (General_options::do_demangle): New function.
5486 (General_options::set_do_demangle): New function.
5487 (General_options::execstack_status_): Move definition to end of
5489 (General_options::static_): Likewise.
5490 (General_options::do_demangle_): New field.
5491 * object.cc (big_endian>::get_symbol_location_info): Call
5492 Options::do_demangle, not Options::demangle.
5493 * symtab.cc (demangle): Likewise.
5495 2008-03-22 Ian Lance Taylor <iant@google.com>
5497 * gold.h: Include <cstddef> and <sys/types.h>
5498 * options.h: Include <cstring>.
5500 2008-03-21 Ian Lance Taylor <iant@google.com>
5502 * Added source code to GNU binutils.