1 2010-02-03 Doug Kwan <dougkwan@google.com>
3 * arm-reloc-property.cc
4 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9 (Arm_reloc_property_table::reloc_name_in_error_message): New method
11 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
13 (GOT_PREL): Change implemented to Y.
14 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
15 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
16 (Arm_relocate_functions::movw_abs_nc): Remove method.
17 (Arm_relocate_functions::movt_abs): Ditto.
18 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
19 (Arm_relocate_functions::thm_movt_abs): Ditto.
20 (Arm_relocate_functions::movw_rel_nc): Ditto.
21 (Arm_relocate_functions::movw_rel): Ditto.
22 (Arm_relocate_functions::movt_rel): Ditto.
23 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
24 (Arm_relocate_functions:thm_movw_rel): Ditto.
25 (Arm_relocate_functions:thm_movt_rel): Ditto.
26 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
27 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
28 New method definitions.
29 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
30 (Arm_relocation_functions::arm_grp_ldr): Ditto.
31 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
32 (Arm_relocation_functions::arm_grp_ldc): Ditto.
33 (Target_arm::Relocate::relocate): Check for non-static or
34 unimplemented relocation code and exit early. Change calls to
35 Target_arm::reloc_uses_thumb_bit and
36 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
37 instead. Refactor code to handle similar relocations to increase
38 code sharing. Remove check for unsupported relocation code in switch
40 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
41 relocation property table to find out size. Change error message to
42 print out the name of a relocation code instead of the numeric value.
43 (Target_arm::scan_reloc_for_stub): Use relocation property table
44 instead of calling Target_arm::reloc_uses_thumb_bit().
46 2010-02-02 Doug Kwan <dougkwan@google.com>
48 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
49 types of relaxed input section.
51 2010-02-02 Doug Kwan <dougkwan@google.com>
53 * Makefile.am (HFILES): Add arm-reloc-property.h.
55 (TARGETSOURCES): Add arm-reloc-property.cc
56 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
57 (libgold_a_SOURCES): $(DEFFILES)
58 * Makefile.in: Regenerate.
59 * arm-reloc-property.cc: New file.
60 * arm-reloc-property.h: New file.
61 * arm-reloc.def: New file.
62 * arm.cc: Update comments.
63 (arm-reloc-property.h): New included header.
64 (arm_reloc_property_table): New global variable.
65 (Target_arm::do_select_as_default_target): New method definition.
66 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
67 arm-reloc-property to targ_extra_obj.
68 * parameters.cc (set_parameters_target): Call
69 Target::select_as_default_target().
70 * target.h (Target::select_as_default_target): New method definition.
71 (Target::do_select_as_default_target): Same.
73 2010-02-01 Doug Kwan <dougkwan@google.com>
75 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
76 first_output_text_section_.
77 (Arm_exidx_fixup::first_output_text_section): New method definition.
78 (Arm_exidx_fixup::first_output_text_section_): New data member.
79 (Arm_exidx_fixup::process_exidx_section): Record the first text
81 (Arm_output_section::fix_exidx_coverage): Set correct linked section
82 and entsize in output section header.
84 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
86 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
87 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
88 (Arm_relocate_functions::thm_alu11): New Method.
89 (Arm_relocate_functions::thm_pc8): New Method.
90 (Arm_relocate_functions::thm_pc12): New Method.
91 (Target_arm::Scan::local): Handle the relocations.
92 (Target_arm::Scan::global): Likewise.
93 (Target_arm::Relocate::relocate): Likewise.
94 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
96 2010-01-29 Doug Kwan <dougkwan@google.com>
98 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
99 of relocation types as ld.
101 2010-01-29 Doug Kwan <dougkwan@google.com>
103 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
105 (Arm_relocate_functions::thumb_branch_common): Ditto.
106 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
107 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
108 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
109 Arm_relocate_functions::jump24): Remove.
110 (Target_arm::Relocate::relocate): Adjust code to call
111 Arm_relocation_functions::arm_branch_common and
112 Arm_relocation_functions::thumb_branch_common instead of their removed
113 wrappers. Merge switch-cases together to reduce source code size.
115 2010-01-29 Doug Kwan <dougkwan@google.com>
117 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
118 output_local_symbol_count_needs_update_.
119 (Arm_relobj::output_local_symbol_count_needs_update,
120 Arm_relobj::set_output_local_symbol_count_needs_update,
121 Arm_relobj::update_output_local_symbol_count): New methods.
122 (Arm_relobj::output_local_symbol_count_needs_update_): New data
124 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
125 of pointed function as in a R_ARM_PREL31 relocation.
126 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
127 for output local symbol count updating.
128 (Target_arm::do_relax): Update output local symbol counts in objects
130 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
132 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
134 * arm.cc: Added support for the ARM relocations:
135 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
136 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
137 (Arm_relocate_functions::movw_rel_nc): Renamed (was
139 (Arm_relocate_functions::movw_rel): New method.
140 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
141 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
143 (Arm_relocate_functions::thm_movw_rel): New method.
144 (Arm_relocate_functions::thm_movt_rel): Renamed (was
146 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
148 (Target_arm::Scan::global): Likewise.
149 (Target_arm::Relocate::relocate): Likewise.
150 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
153 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
155 * arm.cc: Added support for ARM group relocations.
156 (Target_arm::reloc_needs_sym_origin): New method.
157 (Arm_relocate_functions::calc_grp_kn): New method.
158 (Arm_relocate_functions::calc_grp_residual): New method.
159 (Arm_relocate_functions::calc_grp_gn): New method.
160 (Arm_relocate_functions::arm_grp_alu): New Method.
161 (Arm_relocate_functions::arm_grp_ldr): New Method.
162 (Arm_relocate_functions::arm_grp_ldrs): New Method.
163 (Arm_relocate_functions::arm_grp_ldc): New Method.
164 (Target_arm::Scan::local): Handle the ARM group relocations.
165 (Target_arm::Scan::global): Likewise.
166 (Target_arm::Relocate::relocate): Likewise.
167 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
170 2010-01-26 Doug Kwan <dougkwan@google.com>
172 * arm.cc (set): Include.
173 (class Arm_exidx_fixup): Change type of last_input_section_ to const
175 (Arm_output_section::Text_section_list): New type.
176 (Arm_output_section::append_text_sections_to_list): New method.
177 (Arm_output_section::fix_exidx_coverage): Ditto.
178 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
179 (Arm_relobj::convert_input_section_to_relaxed_section): Use
180 Relobj::set_section_offset() instead of
181 Sized_relobj::invalidate_section_offset().
182 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
183 parameter for section headers. Ignore relocation sections for
184 unallocated sections and EXIDX sections.
185 (Target_arm::fix_exidx_coverage): New method.
186 (Target_arm::output_section_address_less_than): New type.
187 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
188 linked text section instead of the EXIDX section.
189 (Arm_output_section::create_stub_group): Add an assertion to check
190 that this is not an EXIDX output section.
191 (Arm_output_section::append_text_sections_to_list): New method.
192 (Arm_output_section::fix_exidx_coverage): Ditto.
193 (Arm_relobj::scan_sections_for_stubs): Adjust call to
194 Arm_relobj::section_needs_reloc_stub_scanning.
195 (Target_arm::do_relax): Fix EXIDX output section coverage in the
197 (Target_arm::fix_exidx_coverage): New method.
198 * object.h (Relobj::set_output_section): New method.
199 (Sized_relobj::invalidate_section_offset): Remove method.
200 (Sized_relobj::do_invalidate_section_offset): Remove method.
201 (Sized_relobj::do_set_section_offset): Handle offset value -1.
203 2010-01-25 Doug Kwan <dougkwan@google.com>
205 * arm.cc (Arm_exidx_merged_section::do_output_offset):
206 Fix warning due to signed and unsigned comparison on a 32-bit host.
208 2010-01-22 Doug Kwan <dougkwan@google.com>
210 * arm.cc (Target_arm::do_relax): Record an output section for section
211 offset adjustment it contains any stub table that has changed.
212 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
213 offsets in an output section if necessary.
214 * output.cc (Output_section::Output_section): Initialize
215 section_offsets_need_adjustments_.
216 (Output_section::add_input_section_for_script): Renamed to
217 Output_section::add_simple_input_section.
218 (Output_section::save_states): Add a comment.
219 (Output_section::discard_states): New method defintion.
220 (Output_section::adjust_section_offsets): Same.
221 * output.h (Output_section::add_input_section_for_script): Renamed to
222 Output_section::add_simple_input_section.
223 (Output_section::discard_states): New method declaration.
224 (Output_section::adjust_section_offsets): Same.
225 (Output_section::section_offsets_need_adjustment,
226 Output_section::set_section_offsets_need_adjustment): New method
228 (Output_section::section_offsets_need_adjustment_): New data member.
230 (Output_section_element_input::set_section_address): Adjust code for
231 renaming of Output_section::add_input_section_for_script.
232 (Orphan_output_section::set_section_address): Same.
234 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
236 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
237 Fix_v4bx enum values .
238 * gold/options.h (General_options): New option definitions.
239 (General_options::fix_v4bx): New method.
240 (General_options::Fix_v4bx): New enum.
241 * gold/options.cc (General_options::parse_fix_v4bx): New method.
242 (General_options::parse_fix_v4bx_interworking): New method.
244 2010-01-22 Doug Kwan <dougkwan@google.com>
246 * arm.cc (Arm_exidx_fixup): New class.
248 2010-01-21 Doug Kwan <dougkwan@google.com>
250 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
252 (Arm_exidx_section_offset_map): New type.
254 2010-01-21 Doug Kwan <dougkwan@google.com>
256 * arm.cc (Arm_exidx_input_section): New class.
257 (Arm_relobj::exidx_input_section_by_link,
258 Arm_relobj::exidx_input_section_by_shndx,
259 Arm_relobj::make_exidx_input_section): New methods.
260 (read_arm_attributes_section): Remove.
261 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
262 information about them.
263 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
266 2010-01-20 Doug Kwan <dougkwan@google.com>
268 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
269 Input_section_specifier to Section_id.
270 (Target_arm::new_arm_input_section: Adjust code for change of key
272 (Target_arm::find_arm_input_section): Ditto.
273 * gc.h (object.h): Include for Section_id nand Section_id_hash.
274 (Section_id): Remove.
275 (Garbage_collection::Section_id_hash): Remove.
276 * icf.h (object.h): Include for Section_id nand Section_id_hash.
277 (Section_id): Remove.
278 (Icf::Section_id_hash): Remove.
279 * object.h (Section_id, Const_section_id, Section_id_hash,
280 Const_section_id_hash): New type definitions.
281 * output.cc (Output_section::add_relaxed_input_section): Change to
282 use Const_section_id instead of Input_section_specifier as key type.
283 (Output_section::add_merge_input_section): Ditto.
284 (Output_section::build_relaxation_map): Change to use Section_id
285 instead of Input_section_specifier as key type.
286 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
288 (Output_section::convert_input_sections_to_relaxed_sections): Change
289 to use Const_section_id instead of Input_section_specifier as key type.
290 (Output_section::find_merge_section): Ditto.
291 (Output_section::find_relaxed_input_section): Ditto.
292 * output.h (Input_section_specifier): Remove class.
293 (Output_section::Output_section_data_by_input_section_map): Change
294 key type to Const_section_id.
295 (Output_section::Output_relaxed_input_section_by_input_section_map):
297 (Output_section::Relaxation_map): Change key type to Section_id.
299 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
301 * gold/arm.cc: Added support for R_ARM_V4BX relocation
302 (class Arm_v4bx_stub): New class.
303 (DEF_STUBS): Updated definition to support v4_veneer_bx.
304 (Stub_factory::make_arm_v4bx_stub): New method.
305 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
306 (Stub_table::empty): Handle v4bx stubs.
307 (Stub_table::add_arm_v4bx_stub): New method.
308 (Stub_table::find_arm_v4bx_stub): New method.
309 (Arm_relocate_functions::v4bx): New method.
310 (Target_arm::fix_v4bx): New method.
311 (Target_arm::Target_arm): Handle R_ARM_V4BX.
312 (Stub_table::relocate_stubs): Likewise.
313 (Stub_table::do_write): Likewise.
314 (Stub_table::update_data_size_and_addralign): Likewise.
315 (Stub_table::finalize_stubs): Likewise.
316 (Target_arm::Scan::local): Likewise.
317 (Target_arm::Scan::global): Likewise.
318 (Target_arm::do_finalize_sections): Likewise.
319 (Target_arm::Relocate::relocate): Likewise.
320 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
322 (Target_arm::scan_reloc_for_stub): Likewise.
323 (Target_arm::scan_reloc_section_for_stubs): Likewise.
325 2010-01-19 Ian Lance Taylor <iant@google.com>
327 * output.cc (Output_section_headers::do_sized_write): Write large
328 segment count to sh_info field.
329 (Output_file_header::do_sized_write): For large segment count,
330 write PN_XNUM to e_phnum field.
332 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
334 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
335 (Arm_relocate_functions::thm_jump8): New function.
336 (Arm_relocate_functions::thm_jump11): New function.
337 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
339 (Target_arm::Scan::global): Likewise.
340 (Target_arm::Relocate::relocate): Likewise.
341 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
344 2010-01-14 Doug Kwan <dougkwan@google.com>
346 * arm.cc (map, utility): Include headers.
347 (Target_arm::apply_cortex_a8_workaround): New method.
348 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
349 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
350 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
351 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
352 the --[no-]fix-cortex-a8 command line options.
353 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
354 (Target_arm::relocate_stub): Use addend in instruction template.
355 * options.h (DEFINE_bool): Set the user-set flag.
356 (General_options): Add --[no-]-fix-cortex options.
357 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
358 : Update fast look-up map after conversion.
360 2010-01-14 Sriraman Tallam <tmsriram@google.com>
362 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
363 in the first pass of do_layout.
365 2010-01-13 Doug Kwan <dougkwan@google.com>
367 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
368 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
369 apparent compiler problem of not folding static constant integral
370 data members of elfcpp::Elf_sizes<32>.
372 2010-01-13 Doug Kwan <dougkwan@google.com>
374 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
375 Arm_relobj::section_needs_cortex_a8_stub_scanning,
376 Arm_relobj::scan_section_for_cortex_a8_erratum,
377 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
378 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
379 sections to scan for relocation stubs into a new method
380 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
381 relocation and Cortex-A8 stub scanning.
382 (Target_arm::do_relax): Force stubs to be after stubbed sections
383 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
384 the beginning of a new relaxation pass. Update a comment.
385 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
387 2010-01-12 Ian Lance Taylor <iant@google.com>
389 * target-reloc.h (visibility_error): New inline function.
390 (relocate_section): Call visibility_error.
391 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
392 (MOSTLYCLEANFILES): Likewise.
393 (protected_4_pic.o, protected_3.err): New targets.
394 * testsuite/protected_4.cc: New file.
396 2010-01-12 Doug Kwan <dougkwan@google.com>
398 * arm.cc (Cortex_a8_reloc): New class.
399 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
400 and cortex_a8_relocs_info_.
401 (Target_arm::fix_cortex_a8): New method definition.
402 (Target_arm::Cortex_a8_relocs_info): New type.
403 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
404 New data member declarations.
405 (Target_arm::scan_reloc_for_stub): Record information about
406 relocations for THUMB branches that might be exempted from the
407 Cortex-A8 workaround.
408 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
409 at the beginning of a relaxation pass.
411 2010-01-12 Doug Kwan <dougkwan@google.com>
413 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
414 (Arm_relobj::Mapping_symbol_position,
415 Arm_reloj::Mapping_symbol_position_less,
416 Arm_relobj::Mapping_symbols_info): New types.
417 (Target_arm::is_mapping_symbol_name): New method definition.
418 (Arm_relobj::do_count_local_symbols): Save information about mapping
421 2010-01-11 Doug Kwan <dougkwan@google.com>
423 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
424 Arm_relocate_functions::thumb32_branch_upper,
425 Arm_relocate_functions::thumb32_branch_lower,
426 Arm_relocate_functions::thumb32_cond_branch_offset,
427 Arm_relocate_functions::thumb32_cond_branch_upper,
428 Arm_relocate_functions::thumb32_cond_branch_lower,
429 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
430 branch offset encoding.
431 (Arm_relocate_functions::thumb_branch_common): Use new branch
432 offset encoding methods to avoid code duplication.
433 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
434 (Stub_addend_reader::operator()): Use new branch encoding method
435 to avoid code duplication.
437 2010-01-11 Doug Kwan <dougkwan@google.com>
439 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
440 (Target_arm::do_finalize_sections): Define special EXIDX section
441 symbols only if referenced.
442 * gc.h (Garbage_collection::add_reference): New method.
443 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
446 2010-01-11 Ian Lance Taylor <iant@google.com>
448 * script.cc (Version_script_info::build_expression_list_lookup):
449 Change complaing about duplicate wildcard match from error to
452 * script.cc (class Lazy_demangler): Recreate--revert part of patch
454 (Version_script_info::Version_script_info): Initialize globs_,
455 default_version_, default_is_global_, and exact_. Don't
456 initialize globals_ or locals_.
457 (Version_script_info::build_lookup_tables): Build local symbols
459 (Version_script_info::unquote): New function.
460 (Version_script_info::add_exact_match): New function.
461 (Version_script_info::build_expression_list_lookup): Remove lookup
462 parameter. Add is_global parameter. Change all callers. Handle
463 wildcard pattern specially. Unquote pattern. Call
465 (Version_script_info::get_name_to_match): New function.
466 (Version_script_info::get_symbol_version): New function.
467 (Version_script_info::get_symbol_version_helper): Remove.
468 (Version_script_info::check_unmatched_names): Call unquote.
469 * script.h (class Version_script_info): Change get_symbol_version
470 to be non-inline and add is_global parameter; change all callers.
471 Rewrite symbol_is_local. Update declarations. Define struct
472 Version_tree_match, Exact, Globs. Don't define struct Lookup.
473 Remove globals_ and locals_ members. Add exact_, globs_,
474 default_version_, is_global_.
475 (Version_script_info::Glob): Remove pattern, add expression and
476 is_global. Update constructor. Change all callers.
477 * dynobj.cc (Versions::finalize): Mark the version symbol as the
479 (Versions::symbol_section_contents): If a symbol is undefined, or
480 defined in a dynamic object, set the version index to
482 * symtab.cc (Symbol_table::add_from_relobj): Don't call
484 (Symbol_table::add_from_pluginobj): Likewise.
485 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
487 2010-01-11 Doug Kwan <dougkwan@google.com>
489 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
490 (incremental_dump_LDADD): Add linking option for libintl.
491 * Makefile.in: Regenerate.
493 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
496 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
498 * testsuite/Makefile.in: Regenerated.
500 2010-01-10 Doug Kwan <dougkwan@google.com>
502 * options.h (DEFINE_var): Use parentheses around argument varname__
503 in macro body to avoid any unintended subsequent substitutions.
505 2010-01-10 Ian Lance Taylor <iant@google.com>
507 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
508 candidates before doing symbol resolution.
510 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
511 ODR candidates if only one is weak.
513 2010-01-08 Ian Lance Taylor <iant@google.com>
515 * script.cc (Version_script_info::build_expression_list_lookup):
516 Don't warn about ambiguous version, just record the ambiguity.
517 (Version_script_info::get_symbol_version_helper): Give error if
518 version is ambiguous.
520 2010-01-08 Doug Kwan <dougkwan@google.com>
522 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
523 prev_data_size_ and prev_addralign_. Remove initializer for
524 deleted data member has_been_changed_.
525 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
526 to determine if the table is empty.
527 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
529 (Stub_table::add_reloc_stub): Define method in class definition
530 instead of just declaring it there.
531 (Stub_table::add_cortex_a8_stub): New method definition.
532 (Stub_table::update_data_size_and_addralign): Ditto.
533 (Stub_table::finalize_stubs): Ditto.
534 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
535 (Stub_table::do_addralign_): Return address alignment in the
536 (Stub_table::do_reset_address_and_file_offset): Define method in
537 class definition instead of declaring it there. Set current data
538 size to be the data size of the previous pass.
539 (Stub_table::set_final_data_size): Use current data size as the
541 (Stub_table::relocate_stub): Change parameter type of stub from
542 Reloc_stub pointer to Stub pointer.
543 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
544 (Stub_table::Cortex_a8_stub_list): New typedef.
545 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
546 Stub_table::prev_addralign_): New data member.
547 (Arm_relobj::Arm_relobj): Initialize data member
548 section_has_cortex_a8_workaround_.
549 (Arm_relobj::section_has_cortex_a8_workaround,
550 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
552 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
554 (Target_arm::relocate_stub): Change parameter type of stub from
555 Reloc_stub pointer to Stub pointer.
556 (Insn_template::size, Insn_template::alignment): Handle
557 THUMB16_SPECIAL_TYPE.
558 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
559 Stub_table::update_data_size_and_addralign,
560 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
562 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
563 (Stub_table::do_write): Ditto.
564 (Target_arm::do_relax): Adjust code for changes in Stub_table.
566 2010-01-08 Ian Lance Taylor <iant@google.com>
569 * symtab.h (class Symbol): Remove fields is_target_special_ and
570 has_plt_offset_. Add field is_defined_in_discarded_section_.
571 (Symbol::is_defined_in_discarded_section): New function.
572 (Symbol::set_is_defined_in_discarded_section): New function.
573 (Symbol::has_plt_offset): Rewrite.
574 (Symbol::set_plt_offset): Verify that new offset is not -1U.
575 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
576 Don't initialize is_target_special_ or has_plt_offset_.
577 Initialize is_defined_in_discarded_section_.
578 (Symbol_table::add_from_relobj): If appropriate, set
579 is_defined_in_discarded_section.
580 * resolve.cc (Symbol::override_base_with_special): Don't test
581 is_target_special_. Change has_plt_offset_ to has_plt_offset().
582 * target-reloc.h (relocate_section): Do special handling for
583 symbols defined in discarded sections for global symbols as well
586 2010-01-08 Ian Lance Taylor <iant@google.com>
588 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
591 2010-01-08 Ian Lance Taylor <iant@google.com>
593 * object.cc (Sized_relobj::do_layout): Don't get confused if
594 layout_eh_frame returns NULL.
596 2010-01-08 Ian Lance Taylor <iant@google.com>
599 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
600 dynamic symbol table, use the normal symbol table.
601 (Sized_dynobj::do_read_symbols): Remove assertion about type of
604 2010-01-08 Ian Lance Taylor <iant@google.com>
607 * layout.cc (Layout::include_section): Remove .gnu_debuglink
610 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
612 * version.cc (print_version): Change to "Copyright 2010".
614 2010-01-08 Ian Lance Taylor <iant@google.com>
618 * i386.cc (class Target_i386): Change return type of plt_section
620 (class Output_data_plt_i386): Add tls_desc_rel_ field.
621 (Output_data_plt_i386::Output_data_plt_i386): Initialize
623 (Output_data_plt_i386::rel_tls_desc): New function.
624 (Target_i386::rel_tls_desc_section): New function.
625 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
626 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
627 R_386_TLS_DESC reloc in rel_tls_desc_section.
628 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
629 Define struct Tlsdesc_info.
630 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
631 (Target_x86_64::do_reloc_symbol_index): New function.
632 (Target_x86_64::add_tlsdesc_info): New function.
633 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
634 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
636 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
638 (Output_data_plt_x86_64::rela_tlsdesc): New function.
639 (Target_x86_64::rela_tlsdesc_section): New function.
640 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
642 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
643 (Target_x86_64::do_reloc_addend): New function.
644 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
645 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
646 declarations. Define TARGET_CODE. Add arg field to u1_ union.
647 (Output_reloc::type): New function.
648 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
649 (Output_reloc::is_target_specific): New function.
650 (Output_reloc::target_arg): New function.
651 (class Output_reloc) [SHT_RELA]: Add four new constructors for
652 absolute relocs and target specific relocs.
653 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
655 (class Output_data_reloc) [SHT_RELA]: Likewise.
656 * output.cc (Output_reloc::Output_reloc): Add four new versions
657 for absolute relocs and target specific relocs.
658 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
659 (Output_reloc::get_symbol_index): Likewise.
660 (Output_reloc::local_section_offset): Check that local_sym_index_
661 is not TARGET_CODE or 0.
662 (Output_reloc::symbol_value): Likewise.
663 (Output_reloc::write) [SHT_RELA]: Call target for target specific
665 * target.h (class Target): Add reloc_symbol_index and reloc_addend
666 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
668 * layout.cc (add_target_dynamic_tags): Use output section for
669 DT_PLTRELSZ and DT_JMPREL.
671 2010-01-07 Ian Lance Taylor <iant@google.com>
674 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
676 (class Output_data_reloc_generic): Define.
677 (class Output_data_reloc_base): Change base class to
678 Output_data_reloc_generic. Change add() method to call
679 bump_relative_reloc_count for a relative reloc. Remove
681 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
683 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
684 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
686 * layout.h (class Layout): Update declaration.
688 2010-01-07 Ian Lance Taylor <iant@google.com>
690 * output.h (class Output_data): Add const version of
691 output_section and do_output_section.
692 (class Output_section_data): Add const version of
694 (class Output_section): Likewise.
695 * layout.cc (Layout::add_target_dynamic_tags): New function.
696 * layout.h (class Layout): Update declarations.
697 * arm.cc (Target_arm::do_finalize_sections): Use
698 add_target_dynamic_tags.
699 * i386.cc (Target_i386::do_finalize_sections): Likewise.
700 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
701 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
702 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
704 2010-01-07 Ian Lance Taylor <iant@google.com>
707 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
710 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
711 Ian Lance Taylor <iant@google.com>
714 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
715 Xindex::read_symtab_xindex.
717 2010-01-07 Doug Kwan <dougkwan@google.com>
719 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
720 (Insn_template::thumb16_bcond_insn): New method declaration.
721 (Insn_template): Fix spelling.
722 (Stub::thumb16_special): New method declaration.
723 (Stub::do_write): Define virtual method which was previously pure
725 (Stub::do_thumb16_special): New method declaration.
726 (Stub::do_fixed_endian_write): New template member.
727 (Reloc_stub::do_write): Remove.
728 (Reloc_stub::do_fixed_endian_write): Remove.
729 (Cortex_a8_stub): New class definition.
730 (Stub_factory::make_cortex_a8_stub): New method definition.
731 (Stub_factory::Stub_factory): Add missing static storage class
732 qualifier for elf32_arm_stub_a8_veneer_blx.
734 2010-01-07 Ian Lance Taylor <iant@google.com>
737 * options.h (class General_options): Add --warn-unresolved-symbols
738 and --error-unresolved-symbols.
739 * errors.cc (Errors::undefined_symbol): Implement
740 --warn-unresolved-symbols.
742 * options.h (class General_options): Add -z text and -z textoff.
743 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
745 2010-01-06 Sriraman Tallam <tmsriram@google.com>
747 * gc.h (Garbage_collection::Cident_section_map): New typedef.
748 (Garbage_collection::cident_sections): New function.
749 (Garbage_collection::add_cident_section): New function.
750 (Garbage_collection::cident_sections_): New member.
751 (gc_process_relocs): Add references to sections whose names are C
753 * gold.h (cident_section_start_prefix): New constant.
754 (cident_section_stop_prefix): New constant.
755 (is_cident): New function.
756 * layout.cc (Layout::define_section_symbols): Replace string constants
757 with the newly defined constants.
758 * object.cc (Sized_relobj::do_layout): Track sections whose names are
760 * testsuite/Makefile.am: Add gc_orphan_section_test.
761 * testsuite/Makefile.in: Regenerate.
762 * testsuite/gc_orphan_section_test.cc: New file.
763 * testsuite/gc_orphan_section_test.sh: New file.
765 2010-01-06 Ian Lance Taylor <iant@google.com>
768 * options.h (class General_options): Add --warn-shared-textrel.
769 * layout.cc (Layout::finish_dynamic_section): Implement
770 --warn-shared-textrel.
773 * options.h (class General_options): Add --warn-multiple-gp.
775 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
777 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
778 $(THREADSLIB) and $(LIBDL).
779 * Makefile.in: Rebuild.
781 2010-01-06 Ian Lance Taylor <iant@google.com>
784 * options.cc (General_options::parse_section_start): New function.
785 (General_options::section_start): New function.
786 (General_options::General_options): Initialize all members.
787 * options.h: Include <map>
788 (class General_options): Add --section-start. Add section_starts_
790 * layout.cc (Layout::attach_allocated_section_to_segment): If
791 --section-start was used, set the address of the segment. Remove
793 (Layout::relaxation_loop_body): If the address of the load segment
794 has been set by --section-start, don't use it.
795 * output.h (Output_segment::update_flags_for_output_section): New
797 * output.cc (Output_segment::add_output_section): Call
798 update_flags_for_output_section.
800 2010-01-05 Ian Lance Taylor <iant@google.com>
803 * options.h (class General_options): Add --undefined-version.
804 * script.cc (struct Version_expression): Add was_matched_by_symbol
806 (Version_script_info::matched_symbol): New function.
807 (Version_script_info::get_symbol_version_helper): Call
809 (Version_script_info::check_unmatched_names): New function.
810 * script.h (class Version_script_info): Update declarations.
811 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
813 * options.h (class General_options): Use DEFINE_bool_alias for
814 allow_multiple_definition.
815 * resolve.cc (Symbol_table::should_override): Don't test
816 allow_multiple_definition.
819 * options.h (class General_options): Add --cref.
820 * main.cc (main): Print cref table if --cref. Don't close mapfile
821 until after printing cref table.
822 * cref.cc: Include "symtab.h".
823 (class Cref_inputs): Define Cref_table_compare and Cref_table.
824 (Cref_table_compare::operator()): New function.
825 (Cref_inputs::gather_cref): New function.
826 (filecol): New static const.
827 (Cref_inputs::print_cref): New function.
828 (Cref::print_cref): New function.
829 * cref.h: Include <cstdio>.
830 (class Cref): Update declarations.
831 * mapfile.h (Mapfile::file): New function.
832 * object.h (class Object): Define Symbols. Declare virtual
833 do_get_global_symbols.
834 (Object::get_global_symbols): New function.
835 * object.cc (Input_objects::add_object): Pass object to cref_ if
837 (Input_objects::archive_start): Likewise.
838 (Input_objects::archive_stop): Likewise.
839 (Input_objects::print_cref): New function.
840 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
841 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
843 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
845 * plugin.h (class Sized_pluginobj): Update declarations.
847 2010-01-05 Ian Lance Taylor <iant@google.com>
849 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
850 to is_default_version. Rename insdef to insdefault.
851 (Symbol_table::add_from_relobj): Rename def to is_default_version
852 and local to is_forced_local.
853 (Symbol_table::add_from_pluginobj): Likewise.
854 (Symbol_table::add_from_dynobj): Likewise.
855 (Symbol_table::define_special_symbol): Rename insdef to
858 2010-01-04 Ian Lance Taylor <iant@google.com>
861 * options.h (class General_options): Add
862 --allow-multiple-definition and -z muldefs.
863 * resolve.cc (Symbol_table::should_override): Don't warn about a
864 multiple symbol definition if --allow-multiple-definition or -z
868 * options.h (class General_options): Add --add-needed and
869 --copy-dt-needed-entries. Tweak --as-needed help entry.
870 * object.cc (Input_objects::check_dynamic_dependencies): Give an
871 error if --copy-dt-needed-entries aka --add-needed is used and
872 would cause a change in behaviour.
875 * options.h (class General_options): Add -G as a short version of
876 --shared. Add no-op options -assert, -g, and -i.
878 2010-01-04 Sriraman Tallam <tmsriram@google.com>
880 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
881 check for .text or .gnu.linkonce.t sections.
882 * icf.cc (Icf::find_identical_sections): Ditto.
883 Change the detection for mangled function name within the section
885 * icf.h (is_section_foldable_candidate): New function.
887 2009-12-30 Ian Lance Taylor <iant@google.com>
890 * options.h (class General_options): Permit two dashes with
891 --retain-symbols-file.
893 2009-12-30 Ian Lance Taylor <iant@google.com>
896 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
897 don't put the file header and segment headers in the text
901 * common.cc (Sort_commons::operator()): Stabilize sort when both
903 (Symbol_table::do_allocate_commons_list): When allocating common
904 symbols, skip a symbol which is no longer common.
905 * symtab.h (Symbol::is_common): Test whether the symbol comes from
906 an object before checking its type.
907 * testsuite/common_test_2.c: New file.
908 * testsuite/common_test_3.c: New file.
909 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
910 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
911 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
912 (common_test_2_pic.o, common_test_2.so): New targets.
913 (common_test_3_pic.o, common_test_3.so): New targets.
914 * testsuite/Makefile.in: Rebuild.
917 * script.cc (read_input_script): If we see a new SECTIONS clause,
918 and we have added an input section, give an error.
919 * layout.h (class Layout): Add have_added_input_section function.
920 Add have_added_input_section_ field.
921 * layout.cc (Layout::Layout): Initialize
922 have_added_input_section_.
923 (Layout::layout): Set have_added_input_section_.
924 (Layout::layout_eh_frame): Likewise.
926 2009-12-30 Ian Lance Taylor <iant@google.com>
929 * options.h (class General_options): Add --sort-common option.
930 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
931 * common.cc (Sort_common): Add sort_order parameter to
932 constructor. Add sort_order_ field.
933 (Sort_commons::operator): Check sort_order_.
934 (Symbol_table::allocate_commons): Determine the sort order.
935 (Symbol_table::do_allocate_commons): Add sort_order parameter.
937 (Symbol_table::do_allocate_commons_list): Likewise.
939 2009-12-30 Ian Lance Taylor <iant@google.com>
942 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
943 symbols from this object, don't change the visibility of an
945 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
947 2009-12-30 Ian Lance Taylor <iant@google.com>
950 * script.h (class Version_script_info): Define Language enum.
951 Update declarations. Define Glob, Exact, and Lookup types. Add
952 new fields globals_, locals_, and is_finalized_.
953 * script.cc: Various formatting fixes.
954 (class Parser_closure): Change language_stack_ from a vector of
955 std::string to one of Version_script_info::Language. Adjust all
957 (class Lazy_demangler): Remove.
958 (struct Version_expression): Change language from std::string to
959 Version_script_info::Language.
960 (Version_script_info::Version_script_info): New function.
961 (Version_script_info::~Version_script_info): Don't call clear.
962 (Version_script_info::finalize): New function.
963 (Version_script_info::build_lookup_tables): New function.
964 (Version_script_info::build_expression_list_lookup): New
966 (Version_script_info::get_symbol_version_helper): Rewrite to use
968 (Version_script_info::print_expression_list): Adjust to use
969 Version_script_info::Language.
970 (script_push_lex_into_version_mode): Check that the version script
971 has not been finalized.
972 (version_script_push_lang): Change language string to
973 Version_script_info::Language.
974 * options.cc (Command_line::version_script): New function.
975 * options.h (class General_options): Add finalize_dynamic_list
976 function. Change version_script from declaration to definition.
977 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
978 * testsuite/version_script.map: Remove duplicate def of foo.
979 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
981 * testsuite/Makefile.in: Rebuild.
983 2009-12-30 Ian Lance Taylor <iant@google.com>
986 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
987 if the input symbol index is 0, make the output symbol index 0.
989 2009-12-30 Ian Lance Taylor <iant@google.com>
992 * options.h (class General_options): Add -x/--discard-all.
993 * object.cc (Sized_relobj::do_count_local_symbols): Handle
994 --discard-all. If the local symbol needs a dynamic entry, check
995 that before handling --discard-locals.
997 2009-12-30 Ian Lance Taylor <iant@google.com>
1000 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
1002 (Output_segment::add_output_section): Don't change the flags if
1006 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
1007 GNU hash table if they need a dynamic value. Otherwise, don't add
1008 them if they are defined in a dynamic object or are forced local.
1010 2009-12-29 Ian Lance Taylor <iant@google.com>
1013 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
1014 .gnu.hash table for a 32-bit target.
1017 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
1018 regular and a dynamic object only needs a dynamic symbol table
1019 entry if it is externally visible.
1022 * i386.cc (class Target_i386): Initialize global_offset_table_ in
1023 constructor. Add global_offset_table_ field.
1024 (Target_i386::got_section): Set global_offset_table_.
1025 (Target_i386::do_finalize_sections): Set global_offset_table_
1027 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
1028 in constructor. Add global_offset_table_ field.
1029 (Target_x86_64::got_section): Set global_offset_table_.
1030 (Target_x86_64::do_finalize_sections): Set global_offset_table_
1033 * layout.cc (Layout::Layout): Initialize increase_relro_.
1034 (Layout::get_output_section): Add is_relro, is_last_relro, and
1035 is_first_non_relro parameters. Change all callers.
1036 (Layout::choose_output_section): Likewise.
1037 (Layout::add_output_section_data): Likewise.
1038 (Layout::make_output_section): Likewise.
1039 (Layout::set_segment_offsets): Clear increase_relro when using a
1041 * layout.h (class Layout): Add increase_relro method. Add
1042 increase_relro_ field. Update declarations.
1043 * output.cc (Output_section::Output_section): Initialize
1044 is_last_relro_ and is_first_non_relro_.
1045 (Output_segment::add_output_section): Group relro sections is
1046 do_sort is true. Handle is_last_relro and is_first_non_relro.
1047 (Output_segment::maximum_alignment): Remove relro handling.
1048 (Output_segment::set_section_addresses): Add increase_relro
1049 parameter. Change all callers. Add initial alignment to align
1050 relro sections on separate page. Remove old relro handling.
1051 (Output_segment::set_section_list_addresses): Remove in_relro
1052 parameter. Change all callers.
1053 (Output_segment::set_offset): Add increase parameter. Change all
1054 callers. Remove old relro handling.
1055 * output.h (class Output_section): Add new methods: is_last_relro,
1056 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
1057 Add is_last_relro_ and is_first_non_relro_ fields.
1058 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
1059 Create separate .got.plt section. Call increase_relro.
1060 * x86_64.cc (Target_x86_64::got_section): Likewise.
1061 * testsuite/relro_script_test.t: Add .got.plt.
1064 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
1065 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
1066 (Layout::finalize): Call set_dynamic_symbol_size.
1067 (Layout::set_dynamic_symbol_size): New function.
1068 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
1069 set_dynamic_symbol_size.
1072 * output.h (class Output_section): Add is_entsize_zero_ field.
1073 * output.cc (Output_section::Output_section): Initialize
1075 (Output_section::set_entsize): If two different entsizes are
1076 requested, force it to zero.
1077 (Output_section::add_input_section): Set flags for .debug_str
1078 before updating section flags. Set entsize.
1079 (Output_section::update_flags_for_input_section): Set SHF_MERGE
1080 and SHF_STRING if all input sections have those flags.
1082 2009-12-29 Rafael Espindola <espindola@google.com>
1084 * main.cc (main): Fix the sys time reporting.
1085 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
1088 2009-12-29 Sriraman Tallam <tmsriram@google.com>
1090 * options.cc (General_options::parse_version): Allow -v to exit
1091 without an error if there is nothing to link.
1093 2009-12-29 Ian Lance Taylor <iant@google.com>
1095 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
1096 using a version of gcc before 4.1.
1097 * configure: Rebuild.
1099 2009-12-28 Chris Demetriou <cgd@google.com>
1101 * attributes.cc (Output_attributes_section_data::do_write): Use
1102 std::vector::front rather than std::vector::data.
1104 2009-12-28 Ian Lance Taylor <iant@google.com>
1106 * symtab.h (class Symbol_table): Add enum Defined.
1107 * resolve.cc (Symbol_table::should_override): Add defined
1108 parameter. Change all callers. Test whether object is NULL
1109 before calling a method on it.
1110 (Symbol_table::report_resolve_problem): Add defined parameter.
1112 (Symbol_table::should_override_with_special): Likewise.
1113 * symtab.cc (Symbol_table::define_in_output_data): Add defined
1114 parameter. Change all callers.
1115 (Symbol_table::do_define_in_output_data): Likewise.
1116 (Symbol_table::define_in_output_segment): Likewise.
1117 (Symbol_table::do_define_in_output_segment): Likewise.
1118 (Symbol_table::define_as_constant): Likewise.
1119 (Symbol_table::do_define_as_constant): Likewise.
1120 * script.h (class Symbol_assignment): Add is_defsym parameter to
1121 constructor; change all callers.
1122 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
1123 parameter. Change all callers. Add is_defsym_ field.
1124 (class Parser_closure): Add parsing_defsym parameter to
1125 constructor; change all callers. Add parsing_defsym accessor
1126 function. Add parsing_defsym_ field.
1128 2009-12-28 Ian Lance Taylor <iant@google.com>
1130 * gold.cc (queue_middle_tasks): Fix formatting.
1131 * object.cc (Relobj::is_section_name_included): Likewise.
1133 2009-12-23 Ian Lance Taylor <iant@google.com>
1135 * i386.cc (Target_i386::do_calls_non_split): Recognize
1136 -fsplit-stack prologue for a function with a static chain.
1137 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
1138 -fsplit-stack prologue when using %r11.
1140 2009-12-21 Sriraman Tallam <tmsriram@google.com>
1142 * options.cc (General_options::parse_version): Make -v continue and do
1143 the link like GNU ld does.
1145 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
1147 * Makefile.am (CCFILES): Add timer.cc.
1148 (HFILES): Add timer.h.
1149 * configure.ac: Check for sysconf and times.
1150 * main.cc: include timer.h.
1151 (main): Use Timer instead of get_run_time.
1154 * workqueue.cc: include timer.h.
1155 (Workqueue::find_and_run_task):
1156 Report user, sys and wall time.
1157 * Makefile.in: Regenerate.
1158 * config.in: Regenerate.
1159 * configure: Regenerate.
1161 2009-12-16 Doug Kwan <dougkwan@google.com>
1163 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
1165 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
1166 relaxed input sections.
1167 * output.cc (Output_section::find_relaxed_input_section): Change
1168 return type to Output_relaxed_input_section pointer. Adjust code
1169 for new type of relaxed_input_section_map_.
1170 * output.h (Output_section::find_relaxed_input_section): Change
1171 return type to Output_relaxed_input_section pointer.
1172 (Output_section::Output_relaxed_input_section_by_input_section_map):
1174 (Output_section::relaxed_input_section_map_): Change type to
1175 Output_section::Output_relaxed_input_section_by_input_section_map.
1176 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
1179 2009-12-15 Ian Lance Taylor <iant@google.com>
1181 * layout.cc (Layout::create_shstrtab): Only write out after input
1182 sections if we are compressing debug sections.
1184 2009-12-15 Ian Lance Taylor <iant@google.com>
1186 * archive.cc (Archive::add_symbols): Only look up a symbol without
1187 a version if there is, in fact, a version.
1189 2009-12-14 Ian Lance Taylor <iant@google.com>
1191 Revert -Wshadow changes, all changes from:
1192 2009-12-11 Doug Kwan <dougkwan@google.com>
1193 2009-12-11 Nick Clifton <nickc@redhat.com>
1194 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
1196 2009-12-11 Doug Kwan <dougkwan@google.com>
1198 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
1200 * attributes.cc (Object_attribute::size): Ditto.
1201 (Attributes_section_data::size): Ditto.
1202 (Attributes_section_data::Attributes_section_data): Ditto.
1203 (Output_attributes_section_data::do_write): Ditto.
1204 * attributes.h (Object_attribute::set_type): Ditto.
1205 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1207 2009-12-11 Nick Clifton <nickc@redhat.com>
1209 * archive.cc: Fix shadowed variable warnings.
1211 * compressed_output.cc: Likewise.
1212 * compressed_output.h: Likewise.
1213 * configure: Likewise.
1214 * dwarf_reader.cc: Likewise.
1215 * dynobj.cc: Likewise.
1216 * dynobj.h: Likewise.
1217 * ehframe.cc: Likewise.
1218 * ehframe.h: Likewise.
1219 * errors.cc: Likewise.
1220 * expression.cc: Likewise.
1221 * fileread.cc: Likewise.
1222 * fileread.h: Likewise.
1223 * freebsd.h: Likewise.
1224 * i386.cc: Likewise.
1226 * incremental.h: Likewise.
1227 * layout.cc: Likewise.
1228 * layout.h: Likewise.
1229 * mapfile.cc: Likewise.
1230 * merge.cc: Likewise.
1231 * merge.h: Likewise.
1232 * object.cc: Likewise.
1233 * object.h: Likewise.
1234 * options.h: Likewise.
1235 * output.cc: Likewise.
1236 * output.h: Likewise.
1237 * parameters.cc: Likewise.
1238 * plugin.cc: Likewise.
1239 * powerpc.cc: Likewise.
1240 * reduced_debug_output.cc: Likewise.
1241 * reduced_debug_output.h: Likewise.
1242 * reloc.cc: Likewise.
1243 * reloc.h: Likewise.
1244 * resolve.cc: Likewise.
1245 * script-sections.cc: Likewise.
1246 * script.cc: Likewise.
1247 * script.h: Likewise.
1248 * sparc.cc: Likewise.
1249 * symtab.cc: Likewise.
1250 * symtab.h: Likewise.
1251 * target-select.cc: Likewise.
1252 * target-select.h: Likewise.
1253 * token.h: Likewise.
1254 * workqueue.cc: Likewise.
1255 * workqueue.h: Likewise.
1256 * x86_64.cc: Likewise.
1258 2009-12-10 Doug Kwan <dougkwan@google.com>
1260 * arm.cc (attributes.h): New include.
1261 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1262 (Arm_relobj::~Arm_relobj): Delete object pointed by
1263 attributes_section_data_.
1264 (Arm_relobj::attributes_section_data): New method definition.
1265 (Arm_relobj::attributes_section_data_): New data member declaration.
1266 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1267 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1268 attributes_section_data_.
1269 (Arm_dynobj::attributes_section_data): New method definition.
1270 (Arm_dynobj::attributes_section_data_): New data member declaration.
1271 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
1272 initialization value of may_use_blx_ to false.
1273 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1274 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1275 object attributes to compute results instead of hard-coding.
1276 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1277 Target_arm::get_secondary_compatible_arch,
1278 Target_arm::set_secondary_compatible_arch
1279 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1280 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1281 New method declarations.
1282 (Target_arm::get_aeabi_object_attribute): New method definition.
1283 (Target_arm::attributes_section_data_): New data member declaration.
1284 (read_arm_attributes_section): New template definition.
1285 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1286 (Arm_dynobj::do_read_symbols): Ditto.
1287 (Target_arm::do_finalize_sections): Merge attributes sections from
1288 input. Check for BLX use after attributes section merging.
1289 Fix __exidx_start and __exidx_end visibility. Create an
1290 .ARM.attributes section if necessary.
1291 (Target_arm::get_secondary_compatible_arch,
1292 Target_arm::set_secondary_compatible_arch,
1293 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1294 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1295 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
1296 New method definitions.
1298 2009-12-09 Ian Lance Taylor <iant@google.com>
1300 * plugin.cc (Plugin::load): Don't cast from void* to a function
1303 2009-12-09 Ian Lance Taylor <iant@google.com>
1305 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1308 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
1310 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1311 Replace two_file_shared_1.so with two_file_shared_2.so.
1312 * testsuite/Makefile.in: Regenerated.
1314 2009-12-08 Doug Kwan <dougkwan@google.com>
1316 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1317 (HFILES): Add attributes.h and int_encoding.h.
1318 * Makefile.in: Regenerate.
1319 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1320 function definitions to int_encoding.cc
1321 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1322 prototypes to int_encoding.h
1323 * reduced_debug_output.cc (int_encoding.h): New include.
1324 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1325 function definitions to int_encoding.cc
1326 (insert_into_vector, read_from_pointer): Move template definitions to
1328 * attributes.cc: New file.
1329 * attributes.h: New file.
1330 * int_encoding.cc: New file.
1331 * int_encoding.h: New file.
1333 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
1336 * incremental-dump.cc (dump_incremental_inputs): New.
1337 (main): Use dump_incremental_inputs.
1339 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
1342 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1343 checking elfcpp::STT_FUNC.
1344 (Target_i386::Relocate::relocate): Likewise.
1345 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1347 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1348 symbols from shared libraries into normal FUNC symbols.
1350 * symtab.h (Symbol): Add is_func and use it.
1352 2009-12-05 Doug Kwan <dougkwan@google.com>
1354 * arm.cc (Target_arm::arm_info): Initialize new fields
1355 attributes_section and attributes_vendor.
1356 * i386.cc (Target_i386::i386_info): Same.
1357 * object.cc (Sized_relobj::do_layout): Skip attribute section.
1358 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1359 fields attributes_section and attributes_vendor.
1360 * sparc.cc (Target_sparc::sparc_info): Same.
1361 * target.h (Target::attributes_section, Target::attributes_vendor,
1362 Target::is_attributes_section, Target::attribute_arg_type,
1363 Target::attributes_order): New method definitions.
1364 (Target::Target_info::attributes_section,
1365 Target::Target_info::attributes_vendor): New fields.
1366 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1367 virtual method definitions.
1368 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1369 attributes_section and attributes_vendor.
1370 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1372 2009-12-05 Doug Kwan <dougkwan@google.com>
1374 * arm.cc: Update comments about interworking and stub generation.
1375 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1376 considered as non-PIC.
1377 (Arm_relocate_functions::base_abs): Fix formatting.
1378 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1379 of function to use GOT entry address instead of offset.
1380 (Target_arm::Scan::global): Issue an error if a symbol would need a
1381 PLT does not get one because it is untyped. Remove code to create
1382 dynamic symbols for relative branches.
1383 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1384 takes unsigned integer instead of boolean.
1386 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1388 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1389 (two_file_test_LDADD): Likewise.
1390 (common_test_1_LDADD): Likewise.
1391 (exception_test_LDADD) Likewise.
1392 (weak_test_LDADD): Likewise.
1393 (many_sections_test_LDADD): Likewise.
1394 (initpri1_LDADD): Likewise.
1395 (script_test_1_LDADD): Likewise.
1396 (script_test_2_LDADD): Likewise.
1397 (justsyms_LDADD): Likewise.
1398 (binary_test_LDADD): Likewise.
1399 (large_LDADD): Likewise.
1400 * testsuite/Makefile.in: Regenerated.
1402 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1404 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1405 (Symbol_table::override_with_special): Likewise.
1406 (Symbol_table::add_from_object): Likewise.
1408 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1410 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1411 Don't set the data_offset twice.
1413 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1415 * testsuite/Makefile.in: Regenerate.
1417 2009-12-03 Doug Kwan <dougkwan@google.com>
1419 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1420 (Target_arm::do_finalize_sections): Add parameter for symbol table
1421 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1422 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1423 parameter for symbol table pointer.
1424 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1425 an additional parameter for a pointer to symbol table.
1426 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1427 parameter for a symbol table pointer.
1428 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1429 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1431 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1432 parameter for a symbol table pointer.
1434 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
1436 * incremental.cc (Incremental_inputs_header)
1437 (Incremental_inputs_header_write, Incremental_inputs_entry)
1438 (Incremental_inputs_entry_write): Move ...
1439 * incremental.h (Incremental_inputs_header)
1440 (Incremental_inputs_header_write, Incremental_inputs_entry)
1441 (Incremental_inputs_entry_write): here.
1443 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1445 * incremental.cc (make_sized_incremental_binary): Set the target.
1446 Error if it is incompatible.
1447 * output.h (Output_file): Add filename method.
1449 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1451 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1452 from the get_* methods.
1454 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1456 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1457 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1458 Write 0 for the data_offset of scripts.
1460 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1462 * testsuite/Makefile.am: Add the incremental_test.sh test.
1463 * testsuite/incremental_test.sh: New.
1464 * testsuite/incremental_test_1.c: New.
1465 * testsuite/incremental_test_2.c: New.
1467 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
1469 * incremental-dump.cc (main): Fix typos.
1471 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
1474 * incremental-dump.cc (main): Use llu to print 64 bit values.
1476 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1477 H.J. Lu <hongjiu.lu@intel.com>
1479 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1481 (incremental_dump_LDADD): Likewise.
1482 * Makefile.in: Regenerated.
1484 2009-11-25 Doug Kwan <dougkwan@google.com>
1488 2009-11-25 Doug Kwan <dougkwan@google.com>
1490 * arm.cc (Target_arm::Target_arm): Move method definition
1491 outside of class definition. Add code to handle
1492 --target1-rel, --target1-abs and --target2= options.
1493 (Target_arm::get_reloc_reloc_type): Change method to be
1494 non-static and const.
1495 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1496 New data member declaration.
1497 (Target_arm::Scan::local, Target_arm::Scan::global,
1498 Target_arm::Relocate::relocate,
1499 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1500 Adjust call to Target_arm::get_real_reloc_type.
1501 (Target_arm::get_real_reloc_type): Use command line options
1502 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1503 * options.h (--target1-rel, --target1-abs, --target2): New
1506 2009-11-25 Doug Kwan <dougkwan@google.com>
1508 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1509 class definition. Add code to handle --target1-rel, --target1-abs
1510 and --target2= options.
1511 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1513 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1515 (Target_arm::Scan::local, Target_arm::Scan::global,
1516 Target_arm::Relocate::relocate,
1517 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1518 call to Target_arm::get_real_reloc_type.
1519 (Target_arm::get_real_reloc_type): Use command line options to
1520 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1521 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1524 2009-11-25 Doug Kwan <dougkwan@google.com>
1526 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1527 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1528 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1530 (Arm_relocate_functions::thm_call): Replace body with a call to
1531 Arm_relocate_functions::thumb_branch_common.
1532 (Arm_relocate_functions::thm_jump24,
1533 Arm_relocate_functions::thm_xpc22): New method definitions.
1534 (Arm_relocate_functions::thumb_branch_common): New method definition.
1535 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1537 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1538 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1540 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1542 * Makefile.am: Build incremental-dump
1543 * Makefile.in: Regenerate.
1544 * incremental-dump.cc: New.
1545 * incremental.cc (Incremental_inputs_header_data,
1546 Incremental_inputs_entry_data): Move to incremental.h
1547 * incremental.h: (Incremental_inputs_header_data,
1548 Incremental_inputs_entry_data): Move from incremental.cc
1550 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1552 * incremental.cc (Incremental_inputs_header,
1553 Incremental_inputs_header_write, Incremental_inputs_entry,
1554 Incremental_inputs_entry_write): Add a typedef with the data type.
1556 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1558 * incremental.cc (Incremental_inputs_header,
1559 Incremental_inputs_header_write, Incremental_inputs_entry,
1560 Incremental_inputs_entry_write): Update comment about which
1561 type has the filed descriptions.
1563 2009-11-15 Doug Kwan <dougkwan@google.com>
1565 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1566 (Arm_relocate_functions::arm_branch_common): Change method defintion
1567 in class definition to a method declaration and update list of formal
1569 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1570 Arm_relocation_functions::jump24): Adjust call to
1571 Arm_relocate_functions::arm_branch_common. Update list of formal
1573 (Arm_relocate_functions::xpc25): New method definition.
1574 (Arm_relocate_functions::arm_branch_common): Move method defintion
1575 out from class definition. Use stubs for mode-switching and extending
1577 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1578 specially. Change code to enable use of stubs in ARM branches.
1580 2009-11-10 Doug Kwan <dougkwan@google.com>
1582 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1583 in method declaration.
1584 (Target_arm::relocate_stub): New method declaration.
1585 (Target_arm::default_target): Change to return a pointer instead of
1587 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1588 Target_arm::default_target.
1589 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1591 (Target_arm::relocate_section): Adjust view.
1592 (Target_arm::relocate_stub): New method definition.
1594 2009-11-10 Doug Kwan <dougkwan@google.com>
1596 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1598 * incremental.cc (open_incremental_binary): Initialized local
1599 variables to avoid warnings.
1600 * object.cc (make_elf_object): Ditto.
1601 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1604 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1607 * testsuite/plugin_test.c: Include "config.h".
1609 2009-11-09 Doug Kwan <dougkwan@google.com>
1611 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1612 (arm_symbol_value): Remove.
1613 (Arm_relocate_functions::arm_branch_common,
1614 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1615 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1616 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1617 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1618 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1619 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1620 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1621 Arm_relocate_functions::thm_mobw_abs_nc,
1622 Arm_relocate_functions::thm_mov_abs,
1623 Arm_relocate_functions::movw_prel_nc,
1624 Arm_relocate_functions::thm_movt_abs,
1625 Arm_relocate_functions::movt_prel,
1626 Arm_relocate_functions::thm_movw_prel_nc,
1627 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1628 (Target_arm::Relocate::relocate): Only decompose address into two
1629 parts if relocation type uses the thumb-bit and pass the actual
1630 bit instead of a flag indicating that the thumb-bit is used. Adjust
1631 calls to methods in Arm_relocate_functions for this change.
1633 2009-11-08 Ian Lance Taylor <iant@google.com>
1636 * reloc.cc: Instantiate
1637 Sized_relobj::initialize_input_to_output_maps and
1638 Sized_relobj:free_input_to_output_maps.
1640 2009-11-06 Ian Lance Taylor <iant@google.com>
1643 * defstd.cc (in_segment): Set only_if_ref true for "end".
1645 2009-11-06 Doug Kwan <dougkwan@google.com>
1647 * arm.cc (class Reloc_stub): Correct a comment.
1648 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1649 (Target_arm::scan_section_for_stubs): New method declaration.
1650 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1651 Change methods from private to protected.
1652 (Target_arm::do_may_relax): New method definition.
1653 (Target_arm::do_relax, Target_arm::group_sections,
1654 Target_arm::scan_reloc_for_stub,
1655 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1656 (Target_arm::arm_input_section_map_): New data member declaration.
1657 (Target_arm::scan_reloc_for_stub,
1658 Target_arm::scan_reloc_section_for_stubs,
1659 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1660 Target_arm::do_relax): New method definitions.
1662 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1664 * configure.ac: Check for (struct stat)::st_mtim
1665 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1666 * config.in: Regenerate.
1667 * configure: Regenerate.
1669 2009-11-05 Ian Lance Taylor <iant@google.com>
1672 * output.cc (Output_segment::add_output_section): Add missing
1675 2009-11-04 Ian Lance Taylor <iant@google.com>
1678 * object.h (class Object): Add is_needed and set_is_needed
1679 methods. Add is_needed_ field. Make bool fields into bitfields.
1680 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1681 defined in a dynamic object and referenced by a regular object,
1682 set is_needed for the dynamic object.
1683 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1684 if the file is marked with as_needed and it is not needed.
1686 2009-11-04 Ian Lance Taylor <iant@google.com>
1689 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1690 tags if data is discarded by linker script.
1691 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1692 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1693 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1694 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1696 2009-11-04 Ian Lance Taylor <iant@google.com>
1698 * layout.cc (Layout::get_output_section): Add is_interp and
1699 is_dynamic_linker_section parameters. Change all callers.
1700 (Layout::choose_output_section): Likewise.
1701 (Layout::make_output_section): Likewise.
1702 (Layout::add_output_section_data): Add is_dynamic_linker_section
1703 parameter. Change all callers.
1704 * layout.h (class Layout): Update declarations.
1705 * output.h (class Output_section): Add is_interp, set_is_interp,
1706 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1707 Add is_interp_, is_dynamic_linker_section_ fields. Change
1708 generate_code_fills_at_write_ to a bitfield.
1709 * output.cc (Output_section::Output_sections): Initialize new
1711 (Output_segment::add_output_section): Add do_sort parameter.
1714 2009-11-03 Ian Lance Taylor <iant@google.com>
1717 * options.h (class General_options): Add --warn-common.
1718 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1719 merging two common symbols.
1720 (Symbol_table::should_override): Handle --warn-common when merging
1721 a common symbol with a defined symbol. Use report_resolve_problem
1722 for multiple definitions.
1723 (Symbol_table::report_resolve_problem): New function.
1724 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1726 2009-11-03 Doug Kwan <dougkwan@google.com>
1728 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1730 (Target_arm::stub_factory): New method definition.
1731 (Target_arm::new_arm_input_section,
1732 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1733 Target_arm::reloc_uses_thumb_bit): New method declarations.
1734 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1735 New type definitions.
1736 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1737 member declarations.
1738 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1739 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1740 New method definitions.
1742 2009-11-03 Ian Lance Taylor <iant@google.com>
1744 * options.h (class General_options): Add --warn_constructors.
1746 2009-11-03 Ian Lance Taylor <iant@google.com>
1749 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1750 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1752 2009-11-03 Ian Lance Taylor <iant@google.com>
1755 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1756 --msgid-bugs-address.
1757 (install-pdf): New target.
1758 (install-data_yes): Look up one directory to find mkinstalldirs.
1760 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1762 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1765 2009-10-30 Doug Kwan <dougkwan@google.com>
1767 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1769 2009-10-30 Doug Kwan <dougkwan@google.com>
1771 * arm.cc (Stub_addend_reader): New struct template definition
1772 and partial specializations.
1773 (Stub_addend_reader::operator()): New method definition for a
1774 partially specialized template.
1776 2009-10-30 Doug Kwan <dougkwan@google.com>
1778 * arm.cc (Arm_relobj::processor_specific_flags): New method
1780 (Arm_relobj::do_read_symbols): New method declaration.
1781 (Arm_relobj::processor_specific_flags_): New data member declaration.
1782 (Arm_dynobj): New class definition.
1783 (Target_arm::do_finalize_sections): Add input_objects parameter.
1784 (Target_arm::do_adjust_elf_header): New method declaration.
1785 (Target_arm::are_eabi_versions_compatible,
1786 (Target_arm::merge_processor_specific_flags): New method declaration.
1787 (Target_arm::do_make_elf_object): New overloaded method definitions
1789 (Arm_relobj::do_read_symbols): New method definition.
1790 (Arm_dynobj::do_read_symbols): Ditto.
1791 (Target_arm::do_finalize_sections): Add input_objects parameters.
1792 Merge processor-specific flags from all input objects.
1793 (Target_arm::are_eabi_versions_compatible,
1794 Target_arm::merge_processor_specific_flags,
1795 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1796 New method definitions.
1797 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1798 Input_objects pointer type parameter.
1799 * layout.cc (Layout::finalize): Pass input objects to target's.
1800 finalize_sections function.
1801 * output.cc (Output_file_header::do_sized_write): Set ELF file
1802 header's processor-specific flags.
1803 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1804 Input_objects pointer type parameter.
1805 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1806 * target.h (Input_objects): New forward class declaration.
1807 (Target::processor_specific_flags,
1808 Target::are_processor_specific_flags_sect): New method definitions.
1809 (Target::finalize_sections): Add input_objects parameter.
1810 (Target::Target): Initialize processor_specific_flags_ and
1811 are_processor_specific_flags_set_.
1812 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1814 (Target::set_processor_specific_flags): New method definition.
1815 (Target::processor_specific_flags_,
1816 Target::are_processor_specific_flags_set_): New data member
1818 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1819 Input_objects pointer type parameter.
1821 2009-10-30 Doug Kwan <dougkwan@google.com>
1823 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1825 2009-10-28 Ian Lance Taylor <iant@google.com>
1827 * object.h (class Relobj): Drop options parameter from
1828 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1829 do_scan_relocs, do_relocate. Change all callers.
1830 (class Sized_relobj): Drop options parameters from
1831 do_gc_process_relocs, do_scan_relocs, do_relocate,
1832 do_relocate_sections, relocate_sections, emit_relocs_scan,
1833 emit_relocs_scan_reltype. Change all callers.
1834 (struct Relocate_info): Remove options field and all references to
1836 * reloc.h (class Read_relocs): Remove options constructor
1837 parameter and options_ field. Change all callers.
1838 (class Gc_process_relocs, class Scan_relocs): Likewise.
1839 (class Relocate_task): Likewise.
1840 * target-reloc.h (scan_relocs): Remove options parameter. Change
1842 (scan_relocatable_relocs): Likewise.
1843 * target.h (class Sized_target): Remove options parameter from
1844 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1846 * gc.h (gc_process_relocs): Remove options parameter. Change all
1848 * arm.cc: Update functions to remove options parameters.
1849 * i386.cc: Likewise.
1850 * powerpc.cc: Likewise.
1851 * sparc.cc: Likewise.
1852 * x86_64.cc: Likewise.
1853 * testsuite/testfile.cc: Likewise.
1855 2009-10-28 Doug Kwan <dougkwan@google.com>
1857 * arm.cc (Arm_relobj): New class definition.
1858 (Arm_relobj::scan_sections_for_stubs,
1859 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1860 New method definitions.
1862 2009-10-28 Cary Coutant <ccoutant@google.com>
1864 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1865 (Plugin::cleanup_done_): New member.
1866 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1867 (Plugin_manager::cleanup_done_): Remove.
1868 (Plugin_manager::add_input_file): Edit error message.
1869 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1870 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1872 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1874 * fileread.cc: (File_read::View::~View): Use the new
1875 data_ownership_ filed.
1876 (File_read::~File_read): Dispose the new whole_file_view_.
1877 (File_read::open): Mmap the whole file if needed.
1878 (File_read::open): Use whole_file_view_ instead of contents_.
1879 (File_read::find_view): Use whole_file_view_ if applicable.
1880 (File_read::do_read): Use whole_file_view_ instead of contents_.
1881 (File_read::make_view): Use whole_file_view_ instead of contents_,
1882 update File_read::View::View call.
1883 (File_read::find_or_make_view): Update File_read::View::View
1885 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1887 (File_read::View::Data_ownership): New enum.
1888 (File_read::View::View): Replace bool mapped_ with Data_ownership
1890 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1891 (File_read::View::data_ownership_): New field.
1892 (File_read::contents_): Remove (replaced by whole_file_view_).
1893 (File_read::whole_file_view_): New field.
1894 * options.h (class General_options): Add --keep-files-mapped.
1896 2009-10-27 Cary Coutant <ccoutant@google.com>
1898 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1899 * testsuite/Makefile.am (plugin_test_5): New test case.
1900 * testsuite/Makefile.in: Regenerate.
1902 2009-10-25 Doug Kwan <dougkwan@google.com>
1904 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1905 from private to protected to allow access by child class.
1906 (Sized_relobj::do_relocate_sections): New method declaration.
1907 (Sized_relobj::relocate_sections): Virtualize.
1908 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1909 Sized_relobj::relocate_sections. Instantiate template explicitly
1910 for different target sizes and endianity.
1912 2009-10-24 Doug Kwan <dougkwan@google.com>
1914 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1915 (Arm_input_section::as_arm_input_section): New method.
1916 (Arm_output_section): New class definition.
1917 (Arm_output_section::create_stub_group,
1918 Arm_output_section::group_sections): New method definitions.
1920 2009-10-22 Doug Kwan <dougkwan@google.com>
1922 * arm.cc (Arm_input_section): New class definition.
1923 (Arm_input_section::init, Arm_input_section:do_write,
1924 Arm_input_section::set_final_data_size,
1925 Arm_input_section::do_reset_address_and_file_offset): New method
1928 2009-10-21 Doug Kwan <dougkwan@google.com>
1930 * arm.cc (Stub_table, Arm_input_section): New forward class
1932 (Stub_table): New class defintion.
1933 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1934 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1935 New method definition.
1937 2009-10-21 Doug Kwan <dougkwan@google.com>
1939 * arm.cc: Update copyright comments.
1940 (Target_arm): New forward class template declaration.
1941 (Arm_address): New type.
1942 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1943 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1944 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1946 (Insn_template): Same.
1947 (DEF_STUBS): New macro.
1948 (Stub_type): New enum type.
1949 (Stub_template): New class definition.
1952 (Stub_factory): Same.
1953 (Target_arm::Target_arm): Initialize may_use_blx_ and
1954 should_force_pic_veneer_.
1955 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1956 Target_arm::should_force_pic_veneer,
1957 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1958 Target_arm::using_thumb_only, Target_arm:;default_target): New
1960 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1961 New data member declarations.
1962 (Insn_template::size, Insn_template::alignment): New method defintions.
1963 (Stub_template::Stub_template): New method definition.
1964 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1965 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1966 (Stub_factory::Stub_factory): New method definition.
1967 * gold.h (string_hash): New template.
1968 * output.h (Input_section_specifier::hash_value): Use
1970 (Input_section_specifier::string_hash): Remove.
1971 * stringpool.cc (Stringpool_template::string_hash): Use
1974 2009-10-20 Doug Kwan <dougkwan@google.com>
1976 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1977 symbols of relaxed input sections.
1978 * output.h (Output_section::find_relaxed_input_section): Make
1981 2009-10-16 Doug Kwan <dougkwan@google.com>
1983 * dynobj.cc (Versions::Versions): Initialize version_script_.
1984 Only insert base version symbol definition for a shared object
1985 if version script defines any version versions.
1986 (Versions::define_base_version): New method definition.
1987 (Versions::add_def): Check that base version is not needed.
1988 (Versions::add_need): Define base version lazily.
1989 * dynobj.h (Versions::define_base_version): New method declaration.
1990 (Versions::needs_base_version_): New data member declaration.
1991 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1992 (check_DATA): Add no_version_test.stdout.
1993 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1995 * testsuite/Makefile.in: Regenerate.
1996 * testsuite/no_version_test.c: New file.
1997 * testsuite/no_version_test.sh: Ditto.
1999 2009-10-16 Doug Kwan <dougkwan@google.com>
2001 * expression.cc (class Segment_start_expression): New class definition.
2002 (Segment_start_expression::value): New method definition.
2003 (script_exp_function_segment_start): Return a new
2004 Segment_start_expression.
2005 * gold/script-c.h (script_saw_segment_start_expression): New function
2007 * script-sections.cc (Script_sections::Script_sections): Initialize
2008 SAW_SEGMENT_START_EXPRESSION_ to false.
2009 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
2010 and -Tbbs options to specify section addresses if given in
2011 command line and no SEGMENT_START expression is seen in a script.
2012 * script-sections.h (Script_sections::saw_segment_start_expression,
2013 Script_sections::set_saw_segment_start_expression): New method
2015 (Script_sections::saw_segment_start_expression_): New data member
2017 * script.cc (script_saw_segment_start_expression): New function.
2018 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
2019 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
2020 script_test_7.sh and script_test_8.sh.
2021 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
2022 script_test_8.stdout.
2023 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
2024 (script_test_6, script_test_6.stdout, script_test_7,
2025 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
2026 * Makefile.in: Regenerate.
2027 * testsuite/script_test_6.sh: New file.
2028 * testsuite/script_test_6.t: Same.
2029 * testsuite/script_test_7.sh: Same.
2030 * testsuite/script_test_7.t: Same.
2031 * testsuite/script_test_8.sh: Same.
2033 2009-10-16 Doug Kwan <dougkwan@google.com>
2035 * output.cc (Output_segment::set_section_list_address): Cast
2036 expressions to unsigned long long type to avoid format warnings.
2038 2009-10-15 Ian Lance Taylor <iant@google.com>
2040 * script.cc (Script_options::add_symbol_assignment): Always add a
2041 dot assignment to script_sections_.
2042 * script-sections.cc (Script_sections::add_dot_assignment):
2043 Initialize if necessary.
2045 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
2046 program headers with no load segment if there is a linker script.
2048 * layout.cc (Layout::set_segment_offsets): Align the file offset
2049 to the segment aligment for -N or -n with no load segment.
2050 * output.cc (Output_segment::add_output_section): Don't crash if
2051 the first section is a TLS section.
2052 (Output_segment::set_section_list_addresses): Print an error
2053 message if the address moves backward in a linker script.
2054 * script-sections.cc
2055 (Output_section_element_input::set_section_addresses): Don't
2056 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
2057 (Orphan_output_section::set_section_addresses): Likewise.
2059 2009-10-15 Doug Kwan <dougkwan@google.com>
2061 * layout.cc (Layout::finish_dynamic_section): Generate tags
2062 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
2063 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
2064 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
2066 2009-10-14 Ian Lance Taylor <iant@google.com>
2068 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
2070 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
2071 data_shdr fields of relinfo.
2072 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
2073 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
2074 R_386_TLS_LDO_32, adjust based on section flags.
2075 (Target_i386::Relocate::fix_up_ldo): Remove.
2077 2009-10-13 Ian Lance Taylor <iant@google.com>
2079 Add support for -pie.
2080 * options.h (class General_options): Add -pie and
2082 (General_options::output_is_position_independent): Test -pie.
2083 (General_options::output_is_executable): Return true if not shared
2084 and not relocatable.
2085 (General_options::output_is_pie): Remove.
2086 * options.cc (General_options::finalize): Reject incompatible uses
2088 * gold.cc (queue_middle_tasks): A -pie link is not static.
2089 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
2090 * symtab.cc (Symbol::final_value_is_known): Return false if
2091 output_is_position_independent.
2092 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
2093 output_is_position_independent.
2094 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
2095 output_is_position_independent.
2096 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
2097 output_is_position_independent.
2098 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
2100 (basic_pie_test.o, basic_pie_test): New targets.
2101 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
2102 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
2103 (two_file_pie_test): New target.
2104 * testsuite/Makefile.in: Rebuild.
2105 * README: Remove note saying that -pie is not supported.
2107 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2109 * options.h (class General_options): Add -init and -fini.
2110 * layout.cc (Layout::finish_dynamic_section): Emit
2111 given init and fini functions.
2113 2009-10-13 Sriraman Tallam <tmsriram@google.com>
2115 * gc.h (gc_process_relocs): Check if icf is enabled using new
2117 * gold.cc (queue_initial_tasks): Likewise.
2118 (queue_middle_tasks): Likewise.
2119 * object.cc (do_layout): Likewise.
2120 * symtab.cc (is_section_folded): Likewise.
2121 * main.cc (main): Likewise.
2122 * reloc.cc (Read_relocs::run): Likewise.
2123 (Sized_relobj::do_scan_relocs): Likewise.
2124 * icf.cc (is_function_ctor_or_dtor): New function.
2125 (Icf::find_identical_sections): Check if function is ctor or dtor when
2127 * options.h (General_options::icf): Change option to be an enum.
2128 (Icf_status): New enum.
2129 (icf_enabled): New method.
2130 (icf_safe_folding): New method.
2131 (set_icf_status): New method.
2132 (icf_status_): New variable.
2133 * (options.cc) (General_options::finalize): Set icf_status_.
2134 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
2135 icf_test and icf_keep_unique_test to use the --icf enum flag.
2136 * testsuite/icf_safe_test.sh: New file.
2137 * testsuite/icf_safe_test.cc: New file.
2139 2009-10-12 Sriraman Tallam <tmsriram@google.com>
2141 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
2142 includes to gc.h and icf.h.
2143 * arm.cc: Include gc.h.
2144 * gold.cc: Likewise.
2145 * i386.cc: Likewise.
2146 * powerpc.cc: Likewise.
2147 * sparc.cc: Likewise.
2148 * x86_64.cc: Likewise.
2149 * gc.h: Include icf.h.
2151 2009-10-11 Ian Lance Taylor <iant@google.com>
2153 * plugin.cc: Include "gold.h" before other header files.
2155 2009-10-10 Chris Demetriou <cgd@google.com>
2157 * options.h (Input_file_argument::Input_file_type): New enum.
2158 (Input_file_argument::is_lib_): Replace with...
2159 (Input_file_argument::type_): New member.
2160 (Input_file_argument::Input_file_argument): Take Input_file_type
2161 'type' rather than boolean 'is_lib' as second argument.
2162 (Input_file_argument::is_lib): Use type_.
2163 (Input_file_argument::is_searched_file): New function.
2164 (Input_file_argument::may_need_search): Handle is_searched_file.
2165 * options.cc (General_options::parse_library): Support -l:filename.
2166 (General_options::parse_just_symbols): Update for Input_file_argument
2168 (Command_line::process): Likewise.
2169 * archive.cc (Archive::get_file_and_offset): Likewise.
2170 * plugin.cc (Plugin_manager::release_input_file): Likewise.
2171 * script.cc (read_script_file, script_add_file): Likewise.
2172 * fileread.cc (Input_file::Input_file): Likewise.
2173 (Input_file::will_search_for): Handle is_searched_file.
2174 (Input_file::open): Likewise.
2175 * readsyms.cc (Read_symbols::get_name): Likewise.
2176 * testsuite/Makefile.am (searched_file_test): New test.
2177 * testsuite/Makefile.in: Regenerate.
2178 * testsuite/searched_file_test.cc: New file.
2179 * testsuite/searched_file_test_lib.cc: New file.
2181 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2182 Ian Lance Taylor <iant@google.com>
2184 * descriptor.cc: Include <cstdio> and "binary-io.h".
2185 (Descriptors::open): Open the files in binary mode always.
2186 * script.cc (Lex::get_token): Treat \r as whitespace.
2188 2009-10-09 Ian Lance Taylor <iant@google.com>
2190 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
2192 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2193 Ian Lance Taylor <iant@google.com>
2195 * configure.ac: Check for readv function also.
2196 * fileread.cc (readv): Define if not HAVE_READV.
2197 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
2199 * config.in: Regenerate.
2200 * configure: Regenerate.
2202 2009-10-09 Doug Kwan <dougkwan@google.com>
2204 * layout.cc (Layout::make_output_section): Call target hook to make
2205 ordinary output section.
2206 (Layout::finalize): Adjust parameter list of call the
2207 Target::may_relax().
2208 * layout.h (class Layout::section_list): New method.
2209 * merge.h (Output_merge_base::entsize): Change visibility to public.
2210 (Output_merge_base::is_string, Output_merge_base::do_is_string):
2212 (Output_merge_string::do_is_string): New method.
2213 * object.cc (Sized_relobj::do_setup): renamed from
2214 Sized_relobj::set_up.
2215 * object.h (Sized_relobj::adjust_shndx,
2216 Sized_relobj::initializ_input_to_output_maps,
2217 Sized_relobj::free_input_to_output_maps): Change visibilities to
2219 (Sized_relobj::setup): Virtualize.
2220 (Sized_relobj::do_setup): New method declaration.
2221 (Sized_relobj::invalidate_section_offset,
2222 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2223 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2224 * options.cc (parse_int): New function.
2225 * options.h (parse_int): New declaration.
2226 (DEFINE_int): New macro.
2227 (stub_group_size): New option.
2228 * output.cc (Output_section::Output_section): Initialize memebers
2229 merge_section_map_, merge_section_by_properties_map_,
2230 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2231 (Output_section::add_input_section): Handled deferred code-fill
2232 generation and remove an old comment.
2233 (Output_section::add_relaxed_input_section): New method definition.
2234 (Output_section::add_merge_input_section): Use merge section by
2235 properties map to speed to search. Update merge section maps
2237 (Output_section::build_relaxation_map): New method definition.
2238 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2240 (Output_section::relax_input_section): Renamed to
2241 Output_section::convert_input_sections_to_relaxed_sections and change
2242 interface to take a vector of pointers to relaxed sections.
2243 (Output_section::find_merge_section,
2244 Output_section::find_relaxed_input_section): New method definitions.
2245 (Output_section::is_input_address_mapped,
2246 Output_section::output_offset, Output_section::output_address):
2247 Use output section data maps to speed up searching.
2248 (Output_section::find_starting_output_address): Add comments.
2249 (Output_section::do_write,
2250 Output_section::write_to_postprocessing_buffer): Do code-fill
2251 generation as appropriate.
2252 (Output_section::get_input_sections): Invalidate relaxed input section
2254 (Output_section::restore_states): Adjust type of checkpoint .
2255 Invalidate relaxed input section map.
2256 * output.h (Output_merge_base): New class declaration.
2257 (Input_section_specifier): New class defintion.
2258 (class Output_relaxed_input_section) Change base class to
2259 Output_section_data_build.
2260 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2261 base class initializer.
2262 (Output_section::add_relaxed_input_section): New method declaration.
2263 (Output_section::Input_section): Change visibility to protected.
2264 (Output_section::Input_section::relobj,
2265 Output_section::Input_section::shndx): Handle relaxed input sections.
2266 Output_section::input_sections) Change visibility to protected. Also
2267 define overload to return a non-const pointer.
2268 (Output_section::Merge_section_properties): New class defintion.
2269 (Output_section::Merge_section_by_properties_map,
2270 Output_section::Output_section_data_by_input_section_map,
2271 Output_section::Relaxation_map): New types.
2272 (Output_section::relax_input_section): Rename method to
2273 Output_section::convert_input_sections_to_relaxed_sections and change
2274 interface to take a vector of relaxed section pointers.
2275 (Output_section::find_merge_section,
2276 Output_section::find_relaxed_input_section,
2277 Output_section::build_relaxation_map,
2278 Output_section::convert_input_sections_in_list_to_relaxed_sections):
2279 New method declarations.
2280 (Output_section::merge_section_map_
2281 Output_section::merge_section_by_properties_map_,
2282 Output_section::relaxed_input_section_map_,
2283 Output_section::is_relaxed_input_section_map_valid_,
2284 Output_section::generate_code_fills_at_write_): New data members.
2285 * script-sections.cc
2286 (Output_section_element_input::set_section_addresses): Call
2287 current_data_size and addralign methods of relaxed input sections.
2288 (Orphan_output_section::set_section_addresses): Call current_data_size
2289 and addralign methods of relaxed input sections.
2290 * symtab.cc (Symbol_table::compute_final_value): Extract template
2291 from the body of Symbol_table::sized_finalize_symbol.
2292 (Symbol_table::sized_finalized_symbol): Call
2293 Symbol_table::compute_final_value.
2294 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2295 (Symbol_table::compute_final_value): New templated method declaration.
2296 * target.cc (Target::do_make_output_section): New method defintion.
2297 * target.h (Target::make_output_section): New method declaration.
2298 (Target::relax): Add more parameters for input objects, symbol table
2299 and layout. Adjust call to do_relax.
2300 (Target::do_make_output_section): New method declaration.
2301 (Target::do_relax): Add parameters for input objects, symbol table
2304 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2306 * pread.c: Include stdio.h.
2308 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2310 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2313 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2315 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2316 Change read_shndx type to unsigned int.
2317 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2319 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2320 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2321 Change read_shndx type to unsigned int.
2322 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2324 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2325 * layout.cc (Layout::create_symtab_sections): Cast the result of
2326 local_symcount * symsize to off_t in the gold_assert.
2328 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2330 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2331 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2333 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2334 (Arm_relocate_functions::thm_abs5): New function.
2335 (Arm_relocate_functions::abs12): New function.
2336 (Arm_relocate_functions::abs16): New function.
2337 (Arm_relocate_functions::base_abs): New function.
2338 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2339 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
2340 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2342 (Scan::global): Likewise.
2343 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2344 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2345 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2346 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2349 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2351 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2352 (Arm_relocate_functions::movt_prel): New function.
2353 (Arm_relocate_functions::thm_movw_prel_nc): New function.
2354 (Arm_relocate_functions::thm_movt_prel): New function.
2355 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2356 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2357 (Scan::global, Relocate::relocate): Likewise.
2358 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2360 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2362 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2363 Incremental_checker.
2364 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2366 (class Incremental_inputs_header): New class.
2367 (Incremental_inputs_header_writer): Edit comment.
2368 (Incremental_inputs_entry): New class.
2369 (Incremental_inputs_entry_writer): Edit comment.
2370 (Sized_incremental_binary::do_find_incremental_inputs_section):
2371 Add *strtab_shndx parameter, fill it.
2372 (Sized_incremental_binary::do_check_inputs): New method.
2373 (Incremental_checker::can_incrementally_link_output_file): Use
2374 Sized_incremental_binary::check_inputs.
2375 (Incremental_inputs::report_command_line): Save command line in
2378 (Incremental_binary::find_incremental_inputs_section): New
2380 (Incremental_binary::do_find_incremental_inputs_section): Add
2381 strtab_shndx parameter.
2382 (Incremental_binary::do_check_inputs): New pure virtual method.
2383 (Sized_incremental_binary::do_check_inputs): Declare.
2384 (Incremental_checker::Incremental_checker): Add incremental_inputs
2385 parameter, use it to initialize incremental_inputs_.
2386 (Incremental_checker::incremental_inputs_): New field.
2387 (Incremental_checker::command_line): New method.
2388 (Incremental_checker::inputs): New method.
2389 (Incremental_checker::command_line_): New field.
2391 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2393 * incremental.cc: Include <cstdarg> and "target-select.h".
2394 (vexplain_no_incremental): New function.
2395 (explain_no_incremental): New function.
2396 (Incremental_binary::error): New method.
2397 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2399 (make_sized_incremental_binary): New function.
2400 (open_incremental_binary): New function.
2401 (can_incrementally_link_file): Add checks if output is ELF and has
2403 * incremental.h: Include "elfcpp_file.h" and "output.h".
2404 (Incremental_binary): New class.
2405 (Sized_incremental_binary): New class.
2406 (open_incremental_binary): Declare.
2407 * object.cc (is_elf_object): Use
2408 elfcpp::Elf_recognizer::is_elf_file.
2409 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2410 * output.h (Output_file::filesize): New method.
2412 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2414 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2416 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2417 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2419 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2421 (Arm_relocate_functions::movw_abs_nc): New function.
2422 (Arm_relocate_functions::movt_abs): New function.
2423 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2424 (Arm_relocate_functions::thm_movt_abs): New function.
2425 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2426 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2427 (Scan::global): Likewise.
2428 (Relocate::relocate): Likewise.
2429 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2431 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2433 * arm.cc (Arm_relocate_functions::got_prel) New function.
2434 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2435 (Relocate::relocate): Likewise.
2436 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2438 2009-10-06 Ian Lance Taylor <iant@google.com>
2440 * options.h (class General_options): Define
2441 split_stack_adjust_size parameter.
2442 * object.h (class Object): Add uses_split_stack_ and
2443 has_no_split_stack_ fields. Add uses_split_stack and
2444 has_no_split_stack accessor functions. Declare
2445 handle_split_stack_section.
2446 (class Reloc_symbol_changes): Define.
2447 (class Sized_relobj): Define Function_offsets. Declare
2448 split_stack_adjust, split_stack_adjust_reltype, and
2450 * object.cc (Object::handle_split_stack_section): New function.
2451 (Sized_relobj::do_layout): Call handle_split_stack_section.
2452 * dynobj.cc (Sized_dynobj::do_layout): Call
2453 handle_split_stack_section.
2454 * reloc.cc (Sized_relobj::relocate_sections): Call
2455 split_stack_adjust for executable sections in split_stack
2456 objects. Pass reloc_map to relocate_section.
2457 (Sized_relobj::split_stack_adjust): New function.
2458 (Sized_relobj::split_stack_adjust_reltype): New function.
2459 (Sized_relobj::find_functions): New function.
2460 * target-reloc.h: Include "object.h".
2461 (relocate_section): Add reloc_symbol_changes parameter. Change
2463 * target.h (class Target): Add calls_non_split method. Declare
2464 do_calls_non_split virtual method. Declare match_view and
2466 * target.cc: Include "elfcpp.h".
2467 (Target::do_calls_non_split): New function.
2468 (Target::match_view): New function.
2469 (Target::set_view_to_nop): New function.
2470 * gold.cc (queue_middle_tasks): Give an error if mixing
2471 split-stack and non-split-stack objects with -r.
2472 * i386.cc (Target_i386::relocate_section): Add
2473 reloc_symbol_changes parameter.
2474 (Target_i386::do_calls_non_split): New function.
2475 * x86_64.cc (Target_x86_64::relocate_section): Add
2476 reloc_symbol_changes parameter.
2477 (Target_x86_64::do_calls_non_split): New function.
2478 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2480 * powerpc.cc (Target_powerpc::relocate_section): Add
2481 reloc_symbol_changes parameter.
2482 * sparc.cc (Target_sparc::relocate_section): Add
2483 reloc_symbol_changes parameter.
2484 * configure.ac: Call AM_CONDITIONAL for the default target.
2485 * configure: Rebuild.
2486 * testsuite/Makefile.am (TEST_AS): New variable.
2487 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2488 (check_DATA): Add split_i386 and split_x86_64 files.
2489 (SPLIT_DEFSYMS): Define.
2490 (split_i386_[1234n].o): New targets.
2491 (split_i386_[124]): New targets.
2492 (split_i386_[1234r].stdout): New targets.
2493 (split_x86_64_[1234n].o): New targets.
2494 (split_x86_64_[124]): New targets.
2495 (split_x86_64_[1234r].stdout): New targets.
2496 (MOSTLYCLEANFILES): Add new executables.
2497 * testsuite/split_i386.sh: New file.
2498 * testsuite/split_x86_64.sh: New file.
2499 * testsuite/split_i386_1.s: New file.
2500 * testsuite/split_i386_2.s: New file.
2501 * testsuite/split_i386_3.s: New file.
2502 * testsuite/split_i386_4.s: New file.
2503 * testsuite/split_i386_n.s: New file.
2504 * testsuite/split_x86_64_1.s: New file.
2505 * testsuite/split_x86_64_2.s: New file.
2506 * testsuite/split_x86_64_3.s: New file.
2507 * testsuite/split_x86_64_4.s: New file.
2508 * testsuite/split_x86_64_n.s: New file.
2509 * testsuite/testfile.cc (Target_test): Update relocation_section
2511 * testsuite/Makefile.in: Rebuild.
2513 2009-10-06 Ian Lance Taylor <iant@google.com>
2515 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2516 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2517 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2518 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2519 the address on ldo_addrs_.
2520 (Target_i386::Relocate::fix_up_ldo): New function.
2522 2009-10-06 Rafael Espindola <espindola@google.com>
2524 * plugin.cc (add_input_library): New.
2525 (Plugin::load): Add add_input_library to tv.
2526 (Plugin_manager::add_input_file): Add the is_lib argument.
2527 (add_input_file): Update call to Plugin_manager::add_input_file.
2528 (add_input_library): New.
2529 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2531 2009-09-30 Doug Kwan <dougkwan@google.com>
2533 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2534 symbol and call Symbol::may_need_copy_reloc to determine if
2535 a copy reloc is needed.
2536 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2537 nocopyreloc is given in command line.
2538 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2539 given in command line.
2540 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2541 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2542 of the removed Target_i386::may_need_copy_reloc.
2543 * options.h (copyreloc): New option with default value false.
2544 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2545 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2546 instead of the removed Target_powerpc::may_need_copy_reloc.
2547 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2548 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2549 instead of the removed Target_sparc::may_need_copy_reloc.
2550 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2551 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2552 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2553 instead of the removed Target_x86_64::may_need_copy_reloc.
2555 2009-09-30 Ian Lance Taylor <iant@google.com>
2557 * object.h (class Object): Remove target_ field, and target,
2558 sized_target, and set_target methods.
2559 (Object::sized_target): Remove.
2560 (class Sized_relobj): Update declarations. Remove sized_target.
2561 * object.cc (Sized_relobj::setup): Remove target parameter.
2563 (Input_objects::add_object): Don't do anything with the target.
2564 (make_elf_sized_object): Add punconfigured parameter. Change all
2565 callers. Set or test parameter target.
2566 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2568 * parameters.cc (Parameters::set_target): Change parameter type to
2570 (Parameters::default_target): Remove.
2571 (set_parameters_target): Change parameter type to be non-const.
2572 (parameters_force_valid_target): New function.
2573 (parameters_clear_target): New function.
2574 * parameters.h (class Parameters): Update declarations. Remove
2575 default_target method. Add sized_target and clear_target
2576 methods. Change target_ to be non-const.
2577 (set_parameters_target): Update declaration.
2578 (parameters_force_valid_target): Declare.
2579 (parameters_clear_target): Declare.
2580 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2581 as NULL if we aren't searching.
2582 (Add_symbols::run): Don't check for compatible target.
2583 * fileread.cc (Input_file::open_binary): Call
2584 parameters_force_valid_target.
2585 * gold.cc (queue_middle_tasks): Likewise.
2586 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
2587 set_target on object.
2588 * dynobj.h (class Sized_dynobj): Update declarations.
2589 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2590 make_elf_object returns NULL.
2591 (Archive::include_member): Don't check whether object target is
2593 * output.cc (Output_section::add_input_section): Get target from
2595 (Output_section::relax_input_section): Likewise.
2596 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2598 (Sized_relobj::do_scan_relocs): Likewise.
2599 (Sized_relobj::relocate_sections): Likewise.
2600 * resolve.cc (Symbol_table::resolve): Likewise.
2601 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2602 parameter. Change all callers.
2603 (Symbol_table::add_from_object): Get target from parameters.
2604 (Symbol_table::add_from_relobj): Don't check object target.
2605 (Symbol_table::add_from_dynobj): Likewise.
2606 (Symbol_table::define_special_symbol): Get target from
2608 * symtab.h (class Symbol_table): Update declaration.
2609 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2610 parameter. Change all callers. Clear parameter target.
2611 (Binary_test): Test target here.
2612 * testsuite/object_unittest.cc (gold_testsuite): Remove
2613 target_test_pointer parameter. Change all callers.
2614 (Object_test): Test target here.
2616 2009-09-26 Ian Lance Taylor <iant@google.com>
2618 * testsuite/initpri1.c: Don't try to use constructor priorities if
2619 compiling with gcc before 4.3.
2621 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2623 * testsuite/retain_symbols_file_test.sh (check_present): Change
2624 output file name to retain_symbols_file_test.stdout.
2625 (check_absent): Likewise.
2627 2009-09-18 Craig Silverstein <csilvers@google.com>
2629 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2630 * options.cc: Include <cerrno> and <fstream>.
2631 (General_options::finalize): Parse -retain-symbols-file tag.
2632 * options.h: New flag.
2633 (General_options): New method should_retain_symbol, new
2634 variable symbols_to_retain.
2635 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2636 should_retain_symbol map.
2637 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2638 * testsuite/Makefile.in: Regenerate.
2639 * testsuite/retain_symbols_file_test.sh: New file.
2641 2009-09-18 Nick Clifton <nickc@redhat.com>
2643 * po/es.po: Updated Spanish translation.
2645 2009-09-17 Doug Kwan <dougkwan@google.com>
2647 * debug.h (DEBUG_RELAXATION): New constant.
2648 (DEBUG_ALL): Add DEBUG_RELAXATION.
2649 (debug_string_to_enum): Add relaxation debug option.
2651 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2652 Layout::Relaxation_debug_check::read_sections,
2653 Layout::Relaxation_debug_check::read_sections): New method definitions.
2654 (Layout::Layout): Initialize data members
2655 record_output_section_data_from_scrips_,
2656 script_output_section_data_list_ and relaxation_debug_check_.
2657 (Layout::save_segments, Layout::restore_segments,
2658 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2659 Layout::relaxation_loop_body): New method definitions.
2660 (Layout::finalize): Support relaxation. Move section layout code to
2661 Layout::relaxation_loop_body.
2662 (Layout::set_asection_address_from_script): Move code for orphan
2663 section placement out.
2664 (Layout::place_orphan_sections_in_script): New method definition.
2665 * layout.h (Output_segment_headers, Output_file_header):
2666 New forward class declarations.
2667 (Layout::~Layout): Define.
2668 (Layout::new_output_section_data_from_script): New method definition.
2669 (Layout::place_orphan_sections_in_script): New method declaration.
2670 (Layout::Segment_states): New type declaration.
2671 (Layout::save_segments, Layout::restore_segments,
2672 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2673 Layout::relaxation_loop_body): New method declarations.
2674 (Layout::Output_section_data_list): New type declaration.
2675 (Layout::Relaxation_debug_check): New class definition.
2676 (Layout::record_output_section_data_from_script_,
2677 Layout::script_output_section_data_list_, Layout::segment_states_,
2678 Layout::relaxation_debug_check_): New data members.
2679 * output.cc: (Output_section_headers::do_size): New method definition.
2680 (Output_section_headers::Output_section_headers): Move size
2681 computation to Output_section_headers::do_size.
2682 (Output_segment_headers::do_size): New method definition.
2683 (Output_file_header::Output_file_header): Move size computation to
2684 Output_file_header::do_size and call it.
2685 (Output_file_header::do_size): New method definition.
2686 (Output_data_group::Output_data_group): Adjust call to
2687 Output_section_data.
2688 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2689 (Output_symtab_xindex::do_write): Add array bound check.
2690 (Output_section::Input_section::print_to_mapfile): Handle
2691 RELAXED_INPUT_SECTION_CODE.
2692 (Output_section::Output_section): Initialize data member checkpoint_.
2693 (Output_section::~Output_section): Delete checkpoint object pointed
2695 (Output_section::add_input_section): Always add an Input_section if
2697 (Output_section::add_merge_input_section): Add assert.
2698 (Output_section::relax_input_section): New method definition.
2699 (Output_section::set_final_data_size): Set load address to zero for
2700 an unallocated section.
2701 (Output_section::do_address_and_file_offset_have_reset_values):
2702 New method definition.
2703 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2704 Handle relaxed input section.
2705 (Output_section::sort_attached_input_sections): Checkpoint input
2706 section list lazily.
2707 (Output_section::get_input_sections): Change type of input_sections to
2708 list of Simple_input_section pointers. Checkpoint input section list
2709 lazily. Also handle relaxed input sections.
2710 (Output_section::add_input_section_for_script): Take a reference to
2711 a Simple_input_section object instead of Relobj pointer and section
2712 index as parameter. Handle relaxed input sections.
2713 (Output_section::save_states, Output_section::restore_states): New
2715 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2716 (Output_data::is_data_size_fixed): New method definition.
2717 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2719 (Output_data::address_and_file_offset_have_reset_values): New method
2721 (Output_data::do_address_and_file_offset_have_reset_values): New method
2723 (Output_data::set_data_size): Check that data size is not fixed.
2724 (Output_data::fix_data_size): New method definition.
2725 (Output_data::is_data_size_fixed_): New data member.
2726 (Output_section_headers::set_final_data_size): New method definition.
2727 (Output_section_headers::do_size): New method declaration.
2728 (Output_segment_headers::set_final_data_size): New method definition.
2729 (Output_segment_headers::do_size): New method declaration.
2730 (Output_file_header::set_final_data_size)::New method definition.
2731 (Output_file_header::do_size)::New method declaration.
2732 (Output_section_data::Output_section_data): Add new parameter
2733 is_data_size_fixed and use it to fix data size.
2734 (Output_data_const::Output_data_const): Adjust call to base class
2735 constructor and fix data size.
2736 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2737 base class constructor and fix data size.
2738 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2739 base class constructor and fix data size.
2740 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2741 class constructor and fix data size.
2742 (Output_data_group::set_final_data_size): New method definition.
2743 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2744 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2745 class constructor and fix data size.
2746 (Output_relaxed_input_section): New class definition.
2747 (Output_section::Simple_input_section): New class definition.
2748 (Output_section::get_input_sections): Adjust parameter list.
2749 (Output_section::add_input_section_for_script): Same.
2750 (Output_section::save_states, Output_section::restore_states,
2751 Output_section::do_address_and_file_offset_have_reset_values,
2752 (Output_section::Input_section::Input_section): Handle
2753 RELAXED_INPUT_SECTION_CODE. Add new overload for
2754 Output_relaxed_input_section.
2755 (Output_section::Input_section::is_input_section,
2756 Output_section::Input_section::set_output_section): Handle relaxed
2758 (Output_section::Input_section::is_relaxed_input_section,
2759 Output_section::Input_section::output_section_data,
2760 Output_section::Input_section::relaxed_input_section): New method
2762 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2764 (Output_section::Input_section::u1_): Update comments.
2765 (Output_section::Input_section::u2_): Add new union member poris.
2766 (Output_section::Checkpoint_output_section): New classs definition.
2767 (Output_section::relax_input_section): New method declaration.
2768 (Output_section::checkpoint_): New data member.
2769 (Output_segment): Update comments.
2770 (Output_segment::Output_segment): Un-privatize copy constructor.
2771 (Output_segment::operator=): Un-privatize.
2772 * script-sections.cc (Output_section_element::Input_section_list):
2773 Change element type to Output_section::Simple_input_section.
2774 (Output_section_element_dot_assignment::set_section_addresses):
2775 Register output section data for relaxation clean up.
2776 (Output_data_exression::Output_data_expression): Adjust call to base
2777 constructor to fix data size.
2778 (Output_section_element_data::set_section_addresses): Register
2779 Output_data_expression object for relaxation clean up.
2780 (struct Input_section_info): Replace Relobj pointer and section index
2781 pair with Output_section::Simple_input_section and Convert struct to a
2783 (Input_section_sorter::operator()): Adjust access to
2784 Input_section_info data member to use accessors.
2785 (Output_section_element_input::set_section_addresses): Use layout
2786 parameter. Adjust code to use Output_section::Simple_input_section
2787 and Input_secction_info classes. Register filler for relaxation
2789 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2790 and section index pair with Output_section::Simple_input_section
2791 class. Adjust code accordingly.
2792 (Phdrs_element::release_segment): New method definition.
2793 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2795 (Script_sections::release_segments): New method definition.
2796 * gold/script-sections.h (Script_sections::release_segments): New
2798 * gold/target.h (Target::may_relax, Target::relax,
2799 Target::do_may_relax, Target::do_relax): New method definitions.
2801 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2803 * arm.cc (has_signed_unsigned_overflow): New function.
2804 (Arm_relocate_functions::abs8): New function.
2805 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2806 (Target_arm::Scan::global): Likewise.
2807 (Target_arm::relocate::relocate): Likewise.
2808 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2811 2009-09-16 Cary Coutant <ccoutant@google.com>
2813 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2814 * testsuite/Makefile.in: Regenerate.
2816 2009-09-11 Nick Clifton <nickc@redhat.com>
2818 * po/gold.pot: Updated by the Translation project.
2820 2009-09-08 Cary Coutant <ccoutant@google.com>
2822 * output.cc (Output_file::open): Add execute permission to empty file.
2823 * testsuite/Makefile.am (permission_test): New test.
2824 * testsuite/Makefile.in: Regenerate.
2826 2009-09-02 Ian Lance Taylor <iant@google.com>
2828 * output.cc (Output_file::resize): Call map_no_anonymous rather
2831 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2833 * gold.cc: Include "incremental.h".
2834 (queue_initial_tasks): Call Incremental_checker methods.
2835 * incremental.cc: Include "output.h".
2836 (Incremental_checker::can_incrementally_link_output_file): New
2838 * incremental.h (Incremental_checker): New class.
2840 * output.cc (Output_file::open_for_modification): New method.
2841 (Output_file::map_anonymous): Changed return type to bool. Record
2843 (Output_file::map_no_anonymous): New method, broken out of map.
2844 (Output_file::map): Use map_no_anonymous and map_anonymous.
2845 * output.h (class Output_file): Update declarations.
2847 2009-08-24 Cary Coutant <ccoutant@google.com>
2849 * options.h (Command_line::Pre_options): New class.
2850 (Command_line::pre_options): New member.
2851 * options.cc (gold::options::ready_to_register): New variable.
2852 (One_option::register_option): Do nothing if not registering options.
2853 Assert if same short option registered twice.
2854 (General_options::General_options): Turn off option registration when
2856 (Command_line::Pre_options::Pre_options): New constructor.
2858 2009-08-24 Cary Coutant <ccoutant@google.com>
2860 * options.h (General_options::no_keep_memory): Remove incorrect
2863 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2865 * Makefile.am (am__skiplex, am__skipyacc): New.
2866 * Makefile.in: Regenerate.
2868 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2870 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2871 (INCLUDES): ... this.
2872 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2873 (AM_CPPFLAGS): Renamed from ...
2874 (INCLUDE): ... this.
2875 * Makefile.in, testsuite/Makefile.in: Regenerate.
2877 * Makefile.in: Regenerate.
2878 * aclocal.m4: Likewise.
2879 * config.in: Likewise.
2880 * configure: Likewise.
2881 * testsuite/Makefile.in: Likewise.
2883 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2884 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2885 * Makefile.in: Regenerate.
2886 * testsuite/Makefile.in: Regenerate.
2888 2009-08-19 Cary Coutant <ccoutant@google.com>
2890 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2891 symbols in shared libraries overridden by hidden or internal symbols
2892 in the main program.
2894 2009-08-19 Chris Demetriou <cgd@google.com>
2896 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2897 checking source file names in error messages.
2899 2009-08-18 Doug Kwan <dougkwan@google.com>
2901 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2902 an elcpp::Ehdr as parameter. Adjust call to set_target.
2903 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2904 an elfcpp::Ehdr as parameter.
2905 * object.cc (Object::set_target): Remove the version that looks up
2906 a target and sets it.
2907 (Sized_relobj::setup): Take a Target object instead of
2908 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2909 (make_elf_sized_object): Find target and ask target to
2911 * object.h: (Object::set_target): Remove the version that looks up
2912 a target and sets it.
2913 (Sized_relobj::setup): Take a Target object instead of
2914 an elfcpp:Ehdr as parameter.
2915 * target.cc: Include dynobj.h.
2916 (Target::do_make_elf_object_implementation): New.
2917 (Target::do_make_elf_object): New.
2918 * target.h (Target::make_elf_object): New template declaration.
2919 (Target::do_make_elf_object): New method declarations.
2920 (Target::do_make_elf_object_implementation): New template declaration.
2922 2009-08-14 Ian Lance Taylor <iant@google.com>
2924 * gold.h (FUNCTION_NAME): Define.
2925 (gold_unreachable): Use FUNCTION_NAME.
2927 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2929 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2930 symbol in the --keep-unique list is not found.
2932 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2934 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2935 been maked as --keep-unique.
2936 (Icf::unfold_section): New function.
2937 * icf.h (Icf::unfold_section): New function.
2938 * options.h (General_options::keep_unique): New option.
2939 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2940 * testsuite/Makefile.in: Regenerate.
2941 * testsuite/icf_keep_unique_test.sh: New file.
2942 * testsuite/icf_keep_unique_test.cc: New file.
2944 2009-08-12 Cary Coutant <ccoutant@google.com>
2947 * resolve.cc (Symbol_table::resolve): Check for references from
2948 dynamic objects to hidden and internal symbols.
2949 * testsuite/Makefile.am (hidden_test.sh): New test.
2950 * testsuite/Makefile.in: Regenerate.
2951 * testsuite/hidden_test.sh: New script.
2952 * testsuite/hidden_test_1.c: New test source.
2953 * testsuite/hidden_test_main.c: New test source.
2955 2009-08-11 Doug Kwan <dougkwan@google.com>
2957 * arm.cc: Update comments.
2958 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2959 segment to locate the .ARM.exidx section if present.
2961 2009-08-09 Doug Kwan <dougkwan@google.com>
2963 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2966 2009-08-07 Sriraman Tallam <tmsriram@google.com>
2967 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2970 2009-08-06 Sriraman Tallam <tmsriram@google.com>
2972 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2973 valid tls_segment only for non-debug-section relocations.
2974 * testsuite/Makefile.am: Add gc_tls_test.
2975 * testsuite/Makefile.in: Regenerate.
2976 * testsuite/gc_tls_test.cc: New file.
2977 * testsuite/gc_tls_test.sh: New file.
2979 2009-08-05 Sriraman Tallam <tmsriram@google.com>
2983 * Makefile.am (CCFILES): Add icf.cc.
2985 * Makefile.in: Regenerate.
2986 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2987 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2988 section, symbol and addend information for the relocs.
2989 * gold.cc (queue_middle_tasks): Call identical code folding.
2990 * gold.h: Add defines for multimap.
2991 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2992 to the call of finalize_local_symbols.
2993 * main.cc (main): Create object of class Icf.
2994 * object.cc (Sized_relobj::do_layout): Allow this function to be
2995 called twice during icf.
2996 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2997 to sections marked as identical by icf.
2998 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
3000 (Sized_relobj::do_section_entsize): New function.
3001 * object.h (Object::section_entsize): New function.
3002 (Object::do_section_entsize): New pure virtual function.
3003 (Relobj::finalize_local_symbols): Add new parameter.
3004 (Relobj::do_section_entsize): New function.
3005 * options.h (General_options::icf): New option.
3006 (General_options::icf_iterations): New option.
3007 (General_options::print_icf_sections): New option.
3008 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
3009 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
3010 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
3012 * symtab.cc (Symbol_table::is_section_folded): New function.
3013 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
3014 to sections marked as identical by icf.
3015 * symtab.h (Symbol_table::set_icf): New function.
3016 (Symbol_table::icf): New function.
3017 (Symbol_table::is_section_folded): New function.
3018 (Symbol_table::icf_): New data member.
3019 * target-reloc.h (relocate_section): Ignore sections folded by icf.
3020 * testsuite/Makefile.am: Add commands to build icf_test.
3021 * testsuite/Makefile.in: Regenerate.
3022 * testsuite/icf_test.sh: New file.
3023 * testsuite/icf_test.cc: New file.
3025 2009-07-24 Chris Demetriou <cgd@google.com>
3027 * layout.cc (is_compressible_debug_section): Fix incorrect
3028 comment about compressed section names.
3030 2009-07-20 Ian Lance Taylor <ian@airs.com>
3033 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
3035 2009-07-16 Ian Lance Taylor <iant@google.com>
3038 * layout.h: #include <map>.
3039 (class Kept_section): Change from struct to class. Add accessors
3040 and setters. Add section size to Comdat_group mapping. Change
3041 Comdat_group to std::map. Add is_comdat_ field. Add
3042 linkonce_size field in union.
3043 (class Layout): Update declaration of find_or_add_kept_section.
3044 Don't declare find_kept_object.
3045 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
3046 parameter. Add object, shndx, is_comdat, and is_group_name
3047 parameters. Change all callers. Adjust for new Kept_section.
3048 (Layout::find_kept_object): Remove.
3049 * object.cc (Sized_relobj::include_section_group): Update use of
3050 Kept_section. Rename secnum to shndx. Only record
3051 Kept_comdat_section if sections are the same size.
3052 (Sized_relobj::include_linkonce_section): Update use of
3053 Kept_section. Only record Kept_comdat_section if sections are the
3054 same size. Set size of linkonce section.
3055 (Sized_relobj::map_to_kept_section): Update call to
3056 get_kept_comdat_section.
3057 * object.h (class Sized_relobj): Rename fields in
3058 Kept_comdat_section to drop trailing underscores; change object
3059 field to Relobj*. Change Kept_comdat_section_table to store
3060 struct rather than pointer.
3061 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
3062 Add kept_object and kept_shndx parameters. Change all callers.
3063 (Sized_relobj::get_kept_comdat_section): Change return type to
3064 bool. Add kept_object and kept_shndx parameters. Change all
3066 * plugin.cc (Pluginobj::include_comdat_group): Update call to
3067 Layout::find_or_add_kept_section.
3069 2009-07-09 Ian Lance Taylor <iant@google.com>
3071 * merge.cc (Object_merge_map::initialize_input_to_output_map):
3072 Reserve space in the hash table.
3074 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
3076 * fileread.cc (File_read::get_mtime): New method.
3077 * fileread.h (Timespec): New structure.
3078 (File_read::get_mtime): New method.
3079 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
3080 Renamed from timestamp_nsec.
3081 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
3083 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
3085 (Incremental_inputs::report_archive): Save mtime; style fix.
3086 (Incremental_inputs::report_obejct): Save mtime; style fix.
3087 (Incremental_inputs::report_script): Save mtime; style fix.
3088 (Incremental_inputs::finalize_inputs): Style fix.
3089 (Incremental_inputs::finalize): Style fix.
3090 (Incremental_inputs::create_input_section_data): Store inputs
3092 * incremental.h (Incremental_inputs::report_script): Add mtime
3094 (Incremental_inputs::Input_info::Input_info): Intialize only one
3096 (Incremental_inputs::Input_info::archive): Move to nameless
3098 (Incremental_inputs::Input_info::obejct): Move to nameless union.
3099 (Incremental_inputs::Input_info::script): Move to nameless union.
3100 (Incremental_inputs::mtime): New field.
3101 * script.cc (read_input_script): Pass file mtime to
3103 * script.h (Script_info::inputs): Style fix.
3105 2009-07-01 Ian Lance Taylor <ian@airs.com>
3107 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
3110 2009-06-24 Ian Lance Taylor <iant@google.com>
3113 * layout.cc (Layout::choose_output_section): If we find an
3114 existing section, update the flags.
3115 (Layout::create_notes): New function, broken out of
3117 (Layout::finalize): Don't create note sections.
3118 (Layout::create_note): Don't crash if linker script discards
3120 (Layout::create_gold_note): Likewise.
3121 (Layout::create_build_id): Likewise. Don't set
3122 after_input_sections on the section.
3123 (Layout::create_executable_stack_info): Remove target parameter.
3125 * layout.h (class Layout): Declare create_notes. Update
3126 declaration of create_executable_stack_info.
3127 * gold.cc (queue_middle_tasks): Call create_notes.
3128 * output.cc (Output_section::update_flags_for_input_section): Move
3129 here from output.h. If SHF_ALLOC flag is newly set, mark address
3131 * output.h (Output_data::mark_address_invalid): New function.
3132 (class Output_section): Only declare, not define,
3133 update_flags_for_input_section. Remove set_flags.
3135 2009-06-24 Ian Lance Taylor <iant@google.com>
3137 * script-sections.cc (Output_section_definition::
3138 set_section_addresses): Rename shadowing local load_address to
3141 2009-06-24 Ian Lance Taylor <iant@google.com>
3144 * reloc.cc (relocate_sections): Skip empty relocation sections.
3146 2009-06-23 Ian Lance Taylor <iant@google.com>
3149 * layout.cc (Layout::create_note): Use choose_output_section
3150 rather than make_output_section.
3152 2009-06-23 Ian Lance Taylor <iant@google.com>
3155 * options.cc (General_options::parse_V): Set printed_version_.
3156 (General_options::General_options): Initialize printed_version_.
3157 * options.h (class General_options): Add printed_version_ field.
3158 * gold.cc (queue_initial_tasks): If there are no input files,
3159 don't give a fatal error if we printed the version information.
3160 (queue_middle_tasks): If using -r with a shared object, give a
3161 fatal error rather than an ordinary error.
3163 2009-06-23 Ian Lance Taylor <iant@google.com>
3166 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
3167 (Layout::make_output_section): Set have_stabstr_section_ if we see
3168 a .stab*str section.
3169 (Layout::finalize): Call link_stabs_sections.
3170 (Layout::link_stabs_sections): New file.
3171 * layout.h (class Layout): Add have_stabstr_section_ field.
3172 Declare link_stabs_sections.
3174 2009-06-23 Doug Kwan <dougkwan@google.com>
3176 * Makefile.am (libgold_a_LIBADD): New.
3177 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
3178 * Makefile.in: Regenerate.
3179 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
3180 * configure: Regenerate.
3181 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
3182 * fileread.cc: Include sys/state.h
3183 * gold.h: Declare memmem and strndup if found missing.
3184 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
3186 2009-06-23 Ian Lance Taylor <iant@google.com>
3188 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
3189 * configure: Rebuild.
3191 2009-06-23 Ian Lance Taylor <iant@google.com>
3194 * object.cc (Object::section_contents): Don't try to get a view if
3195 the section has length zero.
3196 (Object::handle_gnu_warning_section): If the section is empty, use
3197 the name of the section as the warning.
3199 2009-06-23 Ian Lance Taylor <iant@google.com>
3202 * stringpool.h (class Stringpool_template): Add optimize_ field.
3203 (Stringpool_template::set_optimize): New function.
3204 * stringpool.cc (Stringpool_template::Stringpool_template):
3205 Initialize optimize_ field.
3206 (Stringpool_template::set_string_offsets): Test local optimize
3207 fild rather than parameter.
3208 * layout.cc (Layout::Layout): Call set_optimize on the section
3211 2009-06-22 Ian Lance Taylor <iant@google.com>
3214 * yyscript.y: Parse TARGET.
3215 * script.cc (script_set_target): New function.
3216 * script-c.h (script_set_target): Declare.
3217 * options.cc (General_options::string_to_object_format): Rename
3218 from string_to_object_format in anonymous namespace. Change
3220 * options.h (class General_options): Declare
3221 string_to_object_format.
3223 2009-06-22 Ian Lance Taylor <iant@google.com>
3225 * script-sections.cc (Script_sections::create_segments): Don't put
3226 program headers in a PT_LOAD segment if -n or -N.
3228 2009-06-22 Ian Lance Taylor <iant@google.com>
3231 * options.h (class General_options): Add -z lazy and -z now. Sort
3232 -z options into alphabetical order.
3233 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3235 2009-06-21 Ian Lance Taylor <iant@google.com>
3237 * layout.cc (Layout::make_output_section): Call
3238 Target::new_output_section.
3239 (Layout::attach_allocated_section_to_segment): Put large section
3240 sections in a separate load segment with the large segment flag
3242 (Layout::segment_precedes): Sort large data segments after other
3244 (align_file_offset): New static function.
3245 (Layout::set_segment_offsets): Use align_file_offset.
3246 * output.h (class Output_section): Add is_small_section_ and
3247 is_large_section_ fields.
3248 (Output_section::is_small_section): New function.
3249 (Output_section::set_is_small_section): New function.
3250 (Output_section::is_large_section): New function.
3251 (Output_section::set_is_large_section): New function.
3252 (Output_section::is_large_data_section): New function.
3253 (class Output_segment): Add is_large_data_segment_ field.
3254 (Output_segment::is_large_data_segment): New function.
3255 (Output_segment::set_is_large_data_segment): New function.
3256 * output.cc (Output_section::Output_section): Initialize new
3258 (Output_segment::Output_segment): Likewise.
3259 (Output_segment::add_output_section): Add assertion that large
3260 data sections always go in large data segments. Force small data
3261 sections to the end of the list of data sections. Force small BSS
3262 sections to the start of the list of BSS sections. For large BSS
3263 sections to the end of the list of BSS sections.
3264 * symtab.h (class Symbol): Declare is_common_shndx.
3265 (Symbol::is_defined): Check Symbol::is_common_shndx.
3266 (Symbol::is_common): Likewise.
3267 (class Symbol_table): Define enum Commons_section_type. Update
3268 declarations. Add small_commons_ and large_commons_ fields.
3269 * symtab.cc (Symbol::is_common_shndx): New function.
3270 (Symbol_table::Symbol_table): Initialize new fields.
3271 (Symbol_table::add_from_object): Put small and large common
3272 symbols in the right list.
3273 (Symbol_table::sized_finalized_symbol): Check
3274 Symbol::is_common_shndx.
3275 (Symbol_table::sized_write_globals): Likewise.
3276 * common.cc (Symbol_table::do_allocate_commons): Allocate new
3277 common symbol lists. Don't call do_allocate_commons_list if the
3279 (Symbol_table::do_allocate_commons_list): Remove is_tls
3280 parameter. Add comons_section_type parameter. Change all
3281 callers. Handle small and large common symbols.
3282 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3283 Symbol::is_common_shndx.
3284 * resolve.cc (symbol_to_bits): Likewise.
3285 * target.h (Target::small_common_shndx): New function.
3286 (Target::small_common_section_flags): New function.
3287 (Target::large_common_shndx): New function.
3288 (Target::large_common_section_flags): New function.
3289 (Target::new_output_section): New function.
3290 (Target::Target_info): Add small_common_shndx, large_common_shndx,
3291 small_common_section_flags, and large_common_section_flags
3293 (Target::do_new_output_section): New virtual function.
3294 * arm.cc (Target_arm::arm_info): Initialize new fields.
3295 * i386.cc (Target_i386::i386_info): Likewise.
3296 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3298 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3299 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3300 (Target_x86_64::do_new_output_section): New function.
3301 * configure.ac: Define conditional MCMODEL_MEDIUM.
3302 * testsuite/Makefile.am (check_PROGRAMS): Add large.
3303 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3304 (large_LDFLAGS): Define.
3305 * testsuite/large.c: New file.
3306 * testsuite/testfile.cc (Target_test::test_target_info):
3307 Initialize new fields.
3308 * configure, testsuite/Makefile.in: Rebuild.
3310 2009-06-05 Doug Kwan <dougkwan@google.com>
3312 * Makefile.am (CCFILES): Add target.cc.
3313 * Makefile.in: Regenerate.
3314 * i386.cc (class Target_i386): Define new virtual method to
3315 override do_is_local_label_name in parent.
3316 * object.cc (Sized_relobj::do_count_local_symbols): Discard
3317 local symbols if --discard-locals or -X is given.
3318 * options.h (class General_options): Declare new options
3319 '--discard-locals' and '-X' for discarding locals.
3320 * target.h (class Target): Define new methods is_local_label_name.
3321 Declare new virtual method do_is_local_label_name.
3322 * target.cc: New file.
3323 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3324 (check_SCRIPTS): Add discard_locals_test.sh.
3325 (check_DATA): Add discard_local_tests.syms.
3326 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3327 (discard_local_tests.syms, discard_locals_test.o): New make rules.
3328 * testsuite/Makefile.in: Regenerate.
3329 * testsuite/discard_locals_test.c: New file.
3330 * testsuite/discard_locals_test.sh: Same.
3332 2009-06-05 Doug Kwan <dougkwan@google.com>
3334 * object.cc (Sized_relobj::Sized_relobj): Initialize
3335 discarded_eh_frame_shndx_ to -1U.
3336 (Sized_relobj::do_layout): Record index of a discard .eh_frame
3338 (Sized_relobj::do_count_local_symbols): Skip local symbols in
3339 a discarded .eh_frame section.
3340 (Sized_relobj::do_finalize_local_symbols): Ditto.
3341 * object.h (class Sized_relobj): Declare new member
3342 discarded_eh_frame_shndx_.
3343 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3344 (local_labels_test.o, local_labels_test): New rules.
3345 * testsuite/Makefile.in: Regenerate.
3347 2009-06-04 Doug Kwan <dougkwan@google.com>
3349 * layout.cc (Layout::section_name_mapping): Add mapping for
3350 special ARM sections.
3352 2009-06-03 Doug Kwan <dougkwan@google.com>
3354 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3355 (utils::has_overflow): Same.
3357 2009-06-03 Ian Lance Taylor <iant@google.com>
3359 * layout.cc (Layout::section_name_mapping): New array, replacing
3360 Layout::linkonce_mapping.
3361 (Layout::section_name_mapping_count): New variable, replacing
3362 Layout::linkonce_mapping_count.
3363 (Layout::linkonce_output_name): Remove.
3364 (Layout::output_section_name): Rewrite.
3365 * layout.h (class Layout): Rename Linkonce_mapping to
3366 Section_name_mapping, linkonce_mapping to section_name_mapping,
3367 linkonce_mapping_count to section_name_mapping_count. Don't
3368 declare linkonce_output_name.
3370 2009-06-03 Doug Kwan <dougkwan@google.com>
3372 * gold/arm.cc (namespace utils): New.
3373 (Target_arm::reloc_is_non_pic): Define new method.
3374 (class Arm_relocate_functions): New.
3375 (Target_arm::Relocate::relocate): Handle relocation types used by
3378 2009-06-03 Ian Lance Taylor <iant@google.com>
3380 * arm.cc (Target_arm::scan::global): Use || instead of |.
3382 2009-06-02 Doug Kwan <dougkwan@google.com>
3384 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3385 issued_non_pic_error_.
3386 (class Target_arm::Scan): Declare new method check_non_pic.
3387 Define new method symbol_needs_plt_entry.
3388 Declare new data member issued_non_pic_error_.
3389 (class Target_arm::Relocate): Declare new method
3390 should_apply_static_reloc.
3391 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3392 (Target_arm::Scan::check_non_pic): Define new method.
3393 (Target_arm::Scan::local): Handle a small subset of reloc types used
3395 (Target_arm::Scan::local): Same.
3396 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3398 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3400 * incremental.cc (Incremental_inputs::report_command_line): Filter
3401 out --incremental-* options.
3403 2009-05-29 Doug Kwan <dougkwan@google.com>
3405 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3407 (class Target_arm): Update comment.
3408 (Target_arm::Target_arm): Initialize new data members GOT_,
3409 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3410 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3411 and Target_arm::rel_dyn_section.
3412 Declare new_enum Target_arm::Got_type.
3413 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3415 Update commments for member do_dynsym_value.
3416 (Target_arm::got_size, Target_arm::plt_section,
3417 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3418 new methods inside class defintion.
3419 (Target_arm::got_section): Define new method.
3420 (Target_arm::rel_dyn_section): Same.
3421 (Output_data_plt_arm): New template class.
3422 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3423 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3424 (Output_data_plt_arm::add_entry): Same.
3425 (Output_data_plt_arm::first_plt_entry): Define new
3426 static data member for PLT instruction template.
3427 (Output_data_plt_arm::plt_entry): Same.
3428 (Output_data_plt_arm::do_write): Define new method.
3429 (Target_arm::make_plt_entry): Same.
3430 (Target_arm::do_finalize_sections): Same.
3431 (Target_arm::do_dynsym_value): Same.
3433 2009-05-28 Doug Kwan <dougkwan@google.com>
3435 * Makefile.am (TARGETSOURCES): Add arm.cc.
3436 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3437 * Makefile.in: Regenerate.
3439 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3441 2009-05-26 Doug Kwan <dougkwan@google.com>
3443 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3444 (General_options::check_excluded_libs): Strip off directories in
3445 archive name before matching like GNU ld does.
3446 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3447 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3448 (exclude_libs_test_LDFLAGS): Add linker option
3449 -Wl,--exclude-libs,libexclude_libs_test_3
3450 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3451 an explicit archive without using -l.
3452 (alt/libexclude_libs_test_3.a): New make rule.
3453 * testsuite/Makefile.in: Regenerate.
3454 * testsuite/exclude_libs_test.c : Declare lib3_default().
3456 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3457 * exclude_libs_test_3.c: New file.
3459 2009-05-26 Nick Clifton <nickc@redhat.com>
3461 * po/id.po: New Indonesian translation.
3462 * po/gold.pot: Updated template file.
3464 2009-05-22 Sriraman Tallam <tmsriram@google.com>
3466 * testsuite/Makefile.am: Add -ffunction-sections to compile
3467 gc_comdat_test files. Add -Wl,--gc-sections to build
3469 * testsuite/Makefile.in: Regenerate.
3470 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3472 2009-05-21 Sriraman Tallam <tmsriram@google.com>
3474 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3475 kept comdat section was garbage collected.
3476 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3477 * testsuite/Makefile.in: Regenerate.
3478 * testsuite/gc_comdat_test.sh: New file.
3479 * testsuite/gc_comdat_test_1.cc: New file.
3480 * testsuite/gc_comdat_test_2.cc: New file.
3482 2009-05-19 Doug Kwan <dougkwan@google.com>
3484 * archive.cc (Archive::Archive): Move constructor from archive.h
3485 to here. Initialize no_export_.
3486 (Archive::get_elf_object_for_member): Set no_export flag of object.
3487 * archive.h (Archive::Archive): Move constructor body to
3489 (Archive::no_export): New method.
3490 (Archive::no_export_): New field.
3491 * object.h (Object::Object): Initialize no_export_ to false.
3492 (Object::no_export, Object::set_no_export): New methods.
3493 (Object::no_export_): New field.
3494 * options.cc (General_options::parse_exclude_libs): New method.
3495 (General_options::check_excluded_libs) Same.
3496 * options.h (exclude_libs): New option.
3497 (General_options::check_excluded_libs): New method declaration.
3498 (General_options::excluded_libs_): New field.
3499 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3500 default or protected visibility if an object has no-export flag set.
3501 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3502 (check_SCRIPTS): Add exclude_libs_test.sh.
3503 (check_DATA): Add exclude_libs_test.syms.
3504 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3505 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3506 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3507 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3508 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3509 libexclude_libs_test_2.a): New rules.
3510 * testsuite/Makefile.in: Regenerate.
3511 * testsuite/exclude_libs_test.c: New file.
3512 * testsuite/exclude_libs_test.sh: Ditto.
3513 * testsuite/exclude_libs_test_1.c: Ditto.
3514 * testsuite/exclude_libs_test_2.c: Ditto.
3516 2009-05-15 Ian Lance Taylor <iant@google.com>
3518 * configure.ac: Check for declarations for cases where libiberty.h
3519 checks HAVE_DECL_xxx.
3520 * configure, config.in: Rebuild.
3522 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3524 * gold.h (Incremental_argument_list): Remove (invalid) forward
3526 * incremental.cc (Incremental_inputs::report_achive): New method.
3527 (Incremental_inputs::report_object): New method.
3528 (Incremental_inputs::report_script): New method.
3529 (Incremental_inputs::finalize_inputs): New method.
3530 (Incremental_inputs::finalize): Call finalize_inputs().
3531 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3532 Create inputs entries.
3533 * incremental.h (Incremental_input_type): New enum.
3534 (Incremental_inputs::Incremental_input): Initialize new fields.
3535 (Incremental_inputs::report_inputs): New method.
3536 (Incremental_inputs::report_achive): New method.
3537 (Incremental_inputs::report_object): New method.
3538 (Incremental_inputs::report_script): New method.
3539 (Incremental_inputs::finalize_inputs): New method.
3540 (Incremental_inputs::Input_info): New struct.
3541 (Incremental_inputs::Input_info_map): New typedef.
3542 (Incremental_inputs::lock_): New field.
3543 (Incremental_inputs::Inputs_): New field.
3544 (Incremental_inputs::Inputs_map): New field.
3545 * main.cc (main): Call Incremental_input::report_inputs.
3546 * options.h (Input_argument_list): Typedef moved from
3548 (Input_file_group::Files): Remove, use ::Input_argument_list.
3549 (Input_file_group::Input_argument_list): Remove, use
3550 ::Input_argument_list.
3551 * plugin.cc (Plugin_manager::add_input_file): Add error in
3553 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3555 * script.cc (read_input_script): Call
3556 Incremental_input::report_script.
3557 * script.h (Script_info): New class.
3559 2009-04-27 Ian Lance Taylor <iant@google.com>
3561 * x86_64.cc (do_adjust_output_section): Set entsize to
3564 2009-04-23 Elliott Hughes <enh@google.com>
3566 * output.cc (Output_file::close): After short writes, continue
3567 writing from the correct offset in the buffer being written.
3569 2009-04-23 Chris Demetriou <cgd@google.com>
3571 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3572 * configure: Regenerate.
3573 * config.in: Regenerate.
3574 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3575 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3577 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
3579 * incremental.cc (Incremental_inputs_header_data): Renamed from
3580 Incremental_input_header_data.
3581 (Incremental_inputs_header_data::data_size): New field.
3582 (Incremental_inputs_header_data::put_input_file_count): Renamed
3583 from input_file_count.
3584 (Incremental_inputs_header_data::put_command_line_offset): Renamed
3585 from command_line_offset.
3586 (Incremental_inputs_header_data::put_reserved): Renamed from
3588 (Incremental_inputs_entry_data): Renamed from
3589 Incremental_input_entry_data.
3590 (Incremental_inputs_entry_data::data_size): New field.
3591 (Incremental_inputs::report_command_line): New method.
3592 (Incremental_inputs::finalize): New method.
3593 (Incremental_inputs::create_incremental_inputs_data): New method.
3594 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3595 * incremental.h: New file.
3596 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3597 (Layout::finalize): Create incremental inputs section in
3599 (Layout::create_incremental_info_sections): New method.
3600 * layout.h (Layout::incremental_inputs): New method.
3601 (Layout::create_incremental_info_sections): New method.
3602 (Layout::incremental_inputs_): New field.
3603 * main.cc (main): Notify Incremental_input of the command line.
3605 2009-04-01 Ian Lance Taylor <iant@google.com>
3606 Mikolaj Zalewski <mikolajz@google.com>
3608 * gold.h (reserve_unordered_map): Define, three versions, one for
3609 each version of Unordered_map.
3610 * layout.cc (Layout::Layout): Remove options parameter. Add
3611 number_of_input_files parameter. Don't initialize options_.
3612 Initialize number_of_input_files_ and resized_signatures_. Move
3613 sections_are_attached_.
3614 (Layout::layout_group): Reserve space for group_signatures_.
3615 (Layout::find_or_add_kept_section): Change name parameter to be a
3616 reference. Resize signatures_ map when it gets large enough.
3617 (Layout::layout_eh_frame): Use parameters->options() instead of
3619 (Layout::make_output_section): Likewise.
3620 (Layout::attach_allocated_section_to_segment): Likewise.
3621 (Layout::finalize, Layout::create_executable_stack): Likewise.
3622 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3623 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3624 * layout.h (class Layout): Update declarations. Remove options_
3625 field. Add number_of_input_files_ and resized_signatures_
3626 fields. Move sections_are_attached_ field.
3627 * main.cc (main): Pass number of input files to Layout
3628 constructor. Don't pass options.
3630 2009-03-30 Ian Lance Taylor <iant@google.com>
3632 * ffsll.c (ffsll): Correct implementation.
3634 2009-03-27 Ian Lance Taylor <iant@google.com>
3636 * ffsll.c: New file.
3637 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3638 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3639 * ftruncate.c (ftruncate): Declare before definition.
3640 * mremap.c (mremap): Likewise.
3641 * pread.c (pread): Likewise.
3642 * configure, Makefile.in, config.in: Rebuild.
3644 * mremap.c: New file.
3645 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3646 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3647 (mremap): Declare if HAVE_MREMAP is not defined.
3648 * configure, Makefile.in, config.in: Rebuild.
3650 2009-03-27 Cary Coutant <ccoutant@google.com>
3652 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3653 position independent.
3654 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3655 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3657 2009-03-24 Cary Coutant <ccoutant@google.com>
3659 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3661 (needs_dynamic_reloc): Likewise.
3663 2009-03-24 Ian Lance Taylor <iant@google.com>
3665 * yyscript.y (file_cmd): Recognize EXTERN.
3666 (extern_name_list, extern_name_list_body): New nonterminals.
3667 * script.cc (script_add_extern): Define.
3668 * script-c.h (script_add_extern): Declare.
3670 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
3672 * object.cc (is_elf_object): Define.
3673 * object.h (is_elf_object): Declare.
3674 * archive.cc (Archive::get_elf_object_for_member): Call
3676 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3678 2009-03-24 Elliott Hughes <enh@google.com>
3680 * output.cc (Output_file::map_anonymous): Define.
3681 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3682 try an anonymous one. Report the size if the mmap fails.
3683 * output.h (class Output_file): Declare map_anonymous.
3685 2009-03-24 Ian Lance Taylor <iant@google.com>
3687 * target-select.cc (instantiate_target): Don't acquire the lock if
3688 the instantiated_target_ field has already been set.
3690 2009-03-23 Ian Lance Taylor <iant@google.com>
3692 * gold-threads.h (class Initialize_lock): Define.
3693 * gold-threads.cc (class Initialize_lock_once): Define.
3694 (initialize_lock_control): New static variable.
3695 (initialize_lock_pointer): New static variable.
3696 (initialize_lock_once): New static function.
3697 (Initialize_lock::Initialize_lock): Define.
3698 (Initialize_lock::initialize): Define.
3699 * target-select.h: Include "gold-threads.h".
3700 (class Target_selector): Add lock_ and initialize_lock_ fields.
3701 Don't define instantiate_target, just declare it.
3702 * target-select.cc (Target_selector::Target_selector): Initialize
3704 (Target_selector::instantiate_target): Define.
3705 * descriptors.h: Include "gold-threads.h".
3706 (class Descriptors): Add initialize_lock_ field.
3707 * descriptors.cc (Descriptors::Descriptors): Initialize new
3709 (Descriptors::open): Use initialize_lock_ field
3710 * errors.h (class Errors): Add initialize_lock_ field.
3711 * errors.cc (Errors::Errors): Initialize new field.
3712 (Errors::initialize_lock): Use initialize_lock_ field.
3713 * powerpc.cc (class Target_selector_powerpc): Remove
3714 instantiated_target_ field. In do_recognize call
3715 instantiate_target rather than do_instantiate_target. In
3716 do_instantiate_target just allocate a new target.
3717 * sparc.cc (class Target_selector_sparc): Likewise.
3719 * freebsd.h: New file.
3720 * i386.cc: Include "freebsd.h".
3721 (Target_i386): Derive from Target_freebsd rather than
3723 (Target_selector_i386): Derive from Target_selector_freebsd rather
3724 than Target_selector.
3725 * x86_64.cc: Include "freebsd.h".
3726 (Target_x86_64): Derive from Target_freebsd rather than
3728 (Target_selector_x86_64): Derive from Target_selector_freebsd
3729 rather than Target_selector.
3730 * target.h (class Target): Add adjust_elf_header and
3731 do_adjust_elf_header.
3732 * output.cc (Output_file_header:: do_sized_write): Call target
3733 adjust_elf_header routine.
3734 * configure.tgt: Set targ_osabi.
3735 * configure.ac: Define GOLD_DEFAULT_OSABI.
3736 * parameters.cc (Parameters::default_target): Pass
3737 GOLD_DEFAULT_OSABI to select_target.
3738 * target-select.h (class Target_selector): Make instantiate_target
3739 protected rather than private.
3740 * Makefile.am (HFILES): Add freebsd.h.
3741 * configure, Makefile.in, config.in: Rebuild.
3743 * merge.cc (do_add_input_section): Correct pend value. Change
3744 message about last entry not being null terminated from error to
3747 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3749 * incremental.cc: New file.
3750 * Makefile.am (CCFILES): Add incremental.cc.
3751 * Makefile.in: Rebuild.
3753 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3755 * layout.cc (Layout::output_section_name): Preserve names
3756 of '.note.' sections.
3758 2009-03-19 Ian Lance Taylor <iant@google.com>
3760 * descriptors.cc (Descriptors::open): Check that the options are
3761 valid before using them.
3763 2009-03-18 Ian Lance Taylor <iant@google.com>
3765 * script-sections.h: Include <list>.
3766 (class Script_sections): Change Sections_elements from std::vector
3767 to std::list. Typedef public Elements_iterator. Add
3768 orphan_section_placement_, data_segment_align_start_, and
3769 saw_data_segment_align_ fields. Remove data_segment_align_index_
3771 * script-sections.cc (class Orphan_section_placement): New class.
3772 (class Sections_element): Add virtual functions is_relro and
3773 orphan_section_init. Remove virtual function place_orphan_here.
3774 (class Output_section_definition): Add is_relro and
3775 orphan_section_init. Remove place_orphan_here.
3776 (class Orphan_output_section): Likewise.
3777 (Script_sections::Script_sections): Update for field changes.
3778 (Script_sections::data_segment_align): Set saw_data_segment_align_
3779 and data_segment_align_start_, not data_segment_align_index.
3780 (Script_sections::data_segment_relro_end): Check
3781 saw_data_segment_align_. Use data_segment_align_start_ rather
3782 than data_segment_align_index_.
3783 (Script_sections::place_orphan): Rewrite to use
3784 Orphan_section_placement.
3786 2009-03-17 Ian Lance Taylor <iant@google.com>
3788 * archive.cc (Archive::add_symbols): Check for a version attached
3789 to the symbol name in the archive map.
3790 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3791 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3792 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3793 (ver_test_11.a): New target.
3794 * testsuite/Makefile.in: Rebuild.
3796 * configure.ac: Check for chsize and posix_fallocate. Replace
3798 * ftruncate.c: New file, from gnulib.
3799 * output.cc (posix_fallocate): Define dummy version if not
3800 HAVE_POSIX_FALLOCATE.
3801 (Output_file::map): Call posix_fallocate rather than lseek and
3803 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3804 * configure, Makefile.in, config.in: Rebuild.
3806 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3808 * layout.h (Layout::create_note): Add section_name parameter.
3809 * layout.cc (Layout::create_note): Likewise.
3810 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3812 2009-03-17 Ian Lance Taylor <iant@google.com>
3814 * descriptors.cc: Include "options.h".
3815 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3816 (Descriptors::open): Always use O_CLOEXEC when opening a new
3817 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3818 then set FD_CLOEXEC.
3820 * sparc.cc (class Target_sparc): Add has_got_section.
3821 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3822 make sure we have a GOT section.
3824 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3825 (Target_sparc::Scan::local): Likewise.
3826 (Target_sparc::Scan::global): Likewise.
3827 (Target_sparc::Relocate::relocate): Likewise.
3828 (Target_sparc::Relocate::relocate_tls): Likewise.
3830 * symtab.cc (Symbol_table::define_default_version): New function,
3831 broken out of add_from_object.
3832 (Symbol_table::add_from_object): Call define_default_version.
3833 (Symbol_table::define_special_symbol): Add resolve_oldsym
3834 parameter. Change all callers. If the version for a symbol comes
3835 from a version script, resolve it with the symbol with the same
3836 name with no version. Also add the symbol without a version if
3838 (do_define_in_output_data): If resolving with oldsym, don't delete
3840 (do_define_in_output_segment): Likewise.
3841 (do_define_as_constant): Likewise.
3842 * symtab.h (class Symbol_table): Update declarations.
3844 2009-03-13 Ian Lance Taylor <iant@google.com>
3846 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3847 (Read_symbols::requeue): New function.
3848 (Read_symbols::do_read_symbols): If make_elf_object fails because
3849 the target type is not configured, and the file was searched for,
3850 issue a warning and retry with the next directory.
3851 (Add_symbols::run): If the file has an incompatible format, and
3852 it was searched for, requeue the Read_symbols task. On error,
3854 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3855 dirindex parameter to constructor. Change all callers. Declare
3856 incompatible_warning and requeue.
3857 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3858 input_argument_ and input_group_ fields. Add them to
3859 constructor. Change all callers.
3860 (class Read_script): Add dirindex_ field. Add it to constructor.
3862 * archive.cc (Archive::setup): Remove input_objects parameter.
3864 (Archive::get_file_and_offset): Likewise.
3865 (Archive::read_all_symbols): Likewise.
3866 (Archive::read_symbols): Likewise.
3867 (Archive::get_elf_object_for_member): Remove input_objects
3868 parameter. Add punconfigured parameter. Change all callers.
3869 (Archive::add_symbols): Change return type to bool. Check return
3870 value of include_member.
3871 (Archive::include_all_members): Likewise.
3872 (Archive::include_member): Change return type to bool. Return
3873 false if first included object has incompatible target. Set
3874 included_member_ field.
3875 (Add_archive_symbols::run): If add_symbols returns false, requeue
3877 * archive.h (class Archive): Add included_member_ field.
3878 Initialize it in constructor. Add input_file and searched_for
3879 methods. Update declarations.
3880 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3881 input_argument_ fields. Add them to constructor. Change all
3883 * script.cc: Include "target-select.h".
3884 (class Parser_closure): Add skip_on_incompatible_target_ and
3885 found_incompatible_target_ fields. Add
3886 skip_on_incompatible_target parameter to constructor. Change all
3887 callers. Add methods skip_on_incompatible_target,
3888 clear_skip_on_incompatible_target, found_incompatible_target, and
3889 set_found_incompatible_target.
3890 (read_input_script): Add dirindex parameter. Change all callers.
3891 If parser finds an incompatible target, requeue Read_symbols
3893 (script_set_symbol): Clear skip_on_incompatible_target in
3895 (script_add_assertion, script_parse_option): Likewise.
3896 (script_start_sections, script_add_phdr): Likewise.
3897 (script_check_output_format): New function.
3898 * script.h (read_input_script): Update declaration.
3899 * script-c.h (script_check_output_format): Declare.
3900 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3901 (ignore_cmd): Remove OUTPUT_FORMAT.
3902 * fileread.cc (Input_file::Input_file): Add explicit this.
3903 (Input_file::will_search_for): New function.
3904 (Input_file::open): Add pindex parameter. Change all callers.
3905 * fileread.h (class Input_file): Add input_file_argument method.
3906 Declare will_search_for. Update declarations.
3907 * object.cc (make_elf_object): Add punconfigured parameter.
3909 * object.h (class Object): Make input_file public. Add
3910 searched_for method.
3911 (make_elf_object): Update declaration.
3912 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3914 * dirsearch.h (class Dirsearch): Update declaration.
3915 * options.h (class General_options): Add --warn-search-mismatch.
3916 * parameters.cc (Parameters::is_compatible_target): New function.
3917 * parameters.h (class Parameters): Declare is_compatible_target.
3918 * workqueue.cc (Workqueue::add_blocker): New function.
3919 * workqueue.h (class Workqueue): Declare add_blocker.
3921 * fileread.cc (Input_file::open): Remove options parameter.
3923 (Input_file::open_binary): Likewise.
3924 * script.cc (read_input_script): Likewise.
3925 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3926 options parameter from constructor. Change all callers.
3927 (class Read_script): Likewise.
3928 * fileread.h (class Input_file): Update declarations.
3929 * script.h (read_input_script): Update declaration.
3931 2009-03-10 Nick Clifton <nickc@redhat.com>
3933 * po/es.po: New Spanish translation.
3935 2009-03-06 Cary Coutant <ccoutant@google.com>
3937 * options.cc (parse_short_option): Keep dash_z from registering itself.
3939 2009-03-03 Ian Lance Taylor <iant@google.com>
3942 * target-reloc.h (relocate_section): Pass output_section to
3944 * i386.cc (Target_i386::should_apply_static_reloc): Add
3945 output_section parameter. Change all callers.
3946 (Target_i386::Relocate::relocate): Add output_section parameter.
3947 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3948 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3949 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3950 * testsuite/two_file_shared.sh: New script.
3951 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3952 (check_DATA): Add two_file_shared.dbg.
3953 (two_file_shared.dbg): New target.
3954 * testsuite/Makefile.in: Rebuild.
3956 2009-03-01 Ian Lance Taylor <iant@google.com>
3958 * configure.ac: Check for byteswap.h.
3959 * configure: Rebuild.
3960 * config.in: Rebuild.
3962 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3964 * layout.cc (Layout::find_or_add_kept_section): New function.
3965 (Layout::add_comdat): Removed.
3966 * layout.h (struct Kept_section): Move out of class Layout.
3967 Remove trailing underscores from field names. Add group_sections
3968 field. Rename group_ field to is_group. Change all uses.
3969 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3970 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3971 comdat_groups_ field.
3972 (Sized_relobj::include_section_group): Use
3973 find_or_add_kept_section and Kept_section::group_sections.
3974 (Sized_relobj::include_linkonce_section): Likewise.
3975 * object.cc (class Sized_relobj): Don't define Comdat_group or
3976 Comdat_group_table. Remove find_comdat_group and
3977 add_comdat_group. Remove comdat_groups_ field.
3978 * plugin.cc (include_comdat_group): Use
3979 Layout::find_or_add_kept_section.
3981 2009-02-28 Ian Lance Taylor <iant@google.com>
3983 * README: --gc-sections and map files are now supported. Document
3984 some build requirements.
3987 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3988 relocatable link set the value of the section symbol to zero.
3989 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3990 relocatable link don't include the section address in the local
3993 2009-02-27 Ian Lance Taylor <iant@google.com>
3996 * options.h (class Search_directory): Add is_system_directory.
3997 (class General_options): Declare is_in_system_directory.
3998 * options.cc (get_relative_sysroot): Make static.
3999 (get_default_sysroot): Make static.
4000 (General_optoins::is_in_system_directory): New function.
4001 * fileread.cc (Input_file::is_in_system_directory): New function.
4002 * fileread.h (class Input_file): Declare is_in_system_directory.
4003 * object.h (class Object): Add is_in_system_directory.
4004 (class Input_objects): Remove system_library_directory_ field.
4005 * object.cc (Input_objects::add_object): Don't set
4006 system_library_directory_.
4007 (input_objects::found_in_system_library_directory): Remove.
4008 * symtab.cc (Symbol_table::write_globals): Remove input_objects
4009 parameter. Change all callers.
4010 (Symbol_table::sized_write_globals): Likewise.
4011 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
4012 Call Object::is_in_system_directory.
4013 * symtab.h (class Symbol_table): Update declarations.
4016 * descriptors.h (Open_descriptor): Add is_on_stack field.
4017 * descriptors.cc (Descriptors::open): If the descriptor is on the
4018 top of the stack, remove it. Initialize is_on_stack field.
4019 (Descriptors::release): Only add pod to stack if it is not on the
4021 (Descriptors::close_some_descriptor): Clear stack_next and
4025 * output.cc (Output_section::find_starting_output_address): Rename
4026 from starting_output_address; add PADDR parameter; change return
4028 * output.h (class Output_section): Declare
4029 find_starting_output_address instead of starting_output_address.
4030 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
4031 section symbol for which we can't find a merge section.
4034 * symtab.cc (Symbol_table::add_from_object): If the visibility is
4035 hidden or internal, force the symbol to be local.
4036 * resolve.cc (Symbol::override_visibility): Define.
4037 (Symbol::override_base): Use override_visibility.
4038 (Symbol_table::resolve): Likewise.
4039 (Symbol::override_base_with_special): Likewise.
4040 (Symbol_table::override_with_special): If the visibility is hidden
4041 or internal, force the symbol to be local.
4042 * symtab.h (class Symbol): Add set_visibility and
4043 override_visibility.
4044 * testsuite/ver_test_1.sh: New file.
4045 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
4046 (check_DATA): Add ver_test_1.syms.
4047 (ver_test_1.syms): New target.
4048 * testsuite/Makefile.in: Rebuild.
4050 2009-02-25 Cary Coutant <ccoutant@google.com>
4052 * layout.cc (Layout::choose_output_section): Don't rename sections
4053 when using a linker script that has a SECTIONS clause.
4054 * Makefile.in: Regenerate.
4056 * testsuite/Makefile.am (script_test_5.sh): New test case.
4057 * testsuite/Makefile.in: Regenerate.
4058 * testsuite/script_test_5.cc: New file.
4059 * testsuite/script_test_5.sh: New file.
4060 * testsuite/script_test_5.t: New file.
4062 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
4064 * archive.cc (Archive::include_member): Update calls to add_symbols.
4065 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
4066 the Layout argument.
4067 * dynobj.h (do_add_symbols): Add the Layout argument.
4068 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
4070 * object.h (Object::add_symbols): Add the Layout argument.
4071 (Object::do_add_symbols): Add the Layout argument.
4072 (Sized_relobj::do_add_symbols): Add the Layout argument.
4073 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
4074 Unify the two versions.
4075 (Add_plugin_symbols): Remove.
4076 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
4077 (Sized_pluginobj::do_add_symbols): Unify the two versions.
4078 (Add_plugin_symbols): Remove.
4079 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
4080 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
4081 (Add_symbols::run): Make it work with Pulginobj.
4083 2009-02-06 Ian Lance Taylor <iant@google.com>
4085 * object.cc (Sized_relobj::do_layout): Make info message start
4086 with lower case letter.
4088 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
4090 * binary.cc: Fix file comment.
4092 * options.h (enum Incremental_disposition): Define.
4093 (class General_options): Add new options: --incremental,
4094 --incremental_changed, --incremental_unchanged,
4095 --incremental_unknown. Add incremental_disposition_ and
4096 implicit_incremental_ fields.
4097 (General_options::incremental_disposition): New function.
4098 (class Position_dependent_options): Add incremental_disposition
4100 (Position_dependent_options::copy_from_options): Set incremental
4102 * options.cc (General_options::parse_incremental_changed): New
4104 (General_options::parse_incremental_unchanged): New function.
4105 (General_options::parse_incremental_unknown): New function.
4106 (General_options::General_options): Initialize new fields
4107 incremental_disposition_ and implicit_incremental_.
4108 (General_options::finalize): Check for uasge of --incremental-*
4109 without --incremental.
4111 2009-02-06 Chris Demetriou <cgd@google.com>
4113 * gold.h (gold_undefined_symbol): Change to take only a Symbol
4114 pointer and to report location as the file name associated with
4116 (gold_undefined_symbol_at_location): New function to replace the
4117 old gold_undefined_symbol functionality.
4118 * target-reloc.h (relocate_section): Update to use
4119 gold_undefined_symbol_at_location.
4120 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4121 Call gold_undefined_symbol function rather than gold_error.
4122 * errors.h (Errors::undefined_symbol): Take location as a
4123 string, rather than calculating it from a relocation.
4124 * errors.cc (Errors::fatal): Print "fatal error:" before the
4126 (Errors::error, Errors::error_at_location): Print "error: "
4127 before the formatted message.
4128 (Errors::undefined_symbol): Take location as a string, rather
4129 than calculating it from a relocation.
4130 (gold_undefined_symbol_at_location): New function akin to
4131 old gold_undefined_symbol, calculates location from relocation.
4132 (gold_undefined_symbol): Change to take only a Symbol pointer
4133 and to report location as the file name associated with the symbol.
4134 * testsuite/debug_msg.sh: Update for changed error messages.
4135 * testsuite/undef_symbol.sh: Likewise.
4137 2009-02-04 Duncan Sands <baldrick@free.fr>
4140 * reduced_debug_output.h
4141 (Output_reduced_debug_abbrev_section::failed): Use format for
4143 (Output_reduced_debug_info_section::faild): Likewise.
4145 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
4147 * script.cc (Lazy_demangler): New class.
4148 (Version_script_info::get_symbol_version_helper): Demangle a
4151 2009-01-29 Cary Coutant <ccoutant@google.com>
4153 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
4155 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4157 2009-01-28 Ian Lance Taylor <iant@google.com>
4159 * version.cc (version_string): Bump to 1.9.
4161 * gold.h: Include <cstring> and <stdint.h>.
4162 * version.cc: Include <cstdio>.
4163 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
4165 * reduced_debug_output.cc (insert_into_vector): Rename from
4166 Insert_into_vector; change all callers. Use Swap_unaligned to
4167 avoid aliasing issue; remove union since it is unnecessary.
4169 2009-01-27 Sriraman Tallam <tmsriram@google.com>
4171 * Makefile.am (CCFILES): Add gc.cc.
4173 * Makefile.in: Regenerate.
4174 * gold.cc (Gc_runner): New class.
4175 (queue_initial_tasks): Call garbage collection related tasks
4176 when corresponding options are invoked.
4177 (queue_middle_gc_tasks): New function.
4178 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
4179 processed early before laying out sections during garbage collection.
4180 * gold.h (queue_middle_gc_tasks): New function.
4181 (is_prefix_of): Move from "layout.cc".
4182 * i386.cc (Target_i386::gc_process_relocs): New function.
4183 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
4184 * main.cc (main): Create object of class "Garbage_collection".
4185 * object.cc (Relobj::copy_symbols_data): New function.
4186 (Relobj::is_section_name_included): New function.
4187 (Sized_relobj::do_layout): Allow this function to be called twice
4188 during garbage collection and defer layout of section during the
4190 * object.h (Relobj::get_symbols_data): New function.
4191 (Relobj::is_section_name_included): New function.
4192 (Relobj::copy_symbols_data): New function.
4193 (Relobj::set_symbols_data): New function.
4194 (Relobj::get_relocs_data): New function.
4195 (Relobj::set_relocs_data): New function.
4196 (Relobj::is_output_section_offset_invalid): New pure virtual function.
4197 (Relobj::gc_process_relocs): New function.
4198 (Relobj::do_gc_process_relocs): New pure virtual function.
4199 (Relobj::sd_): New data member.
4200 (Sized_relobj::is_output_section_offset_invalid): New function.
4201 (Sized_relobj::do_gc_process_relocs): New function.
4202 * options.h (General_options::gc_sections): Modify to not be a no-op.
4203 (General_options::print_gc_sections): New option.
4204 * plugin.cc (Plugin_finish::run): Remove function call to
4205 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
4206 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4207 * reloc.cc (Read_relocs::run): Add task to process relocs and
4208 determine unreferenced sections when doing garbage collection.
4209 (Gc_process_relocs): New class.
4210 (Sized_relobj::do_gc_process_relocs): New function.
4211 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4212 sections that are garbage collected.
4213 * reloc.h (Gc_process_relocs): New class.
4214 * sparc.cc (Target_sparc::gc_process_relocs): New function.
4215 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4216 symbols whose corresponding sections are garbage collected.
4217 (Symbol_table::Symbol_table): Add new parameter for the garbage
4219 (Symbol_table::gc_mark_undef_symbols): New function.
4220 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4221 (Symbol_table::gc_mark_dyn_syms): New function.
4222 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4224 (Symbol_table::add_from_object): Likewise.
4225 (Symbol_table::add_from_relobj): When building shared objects, do not
4226 treat externally visible symbols as garbage.
4227 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4228 table information for static and relocatable links.
4229 * symtab.h (Symbol_table::set_gc): New function.
4230 (Symbol_table::gc): New function.
4231 (Symbol_table::gc_mark_undef_symbols): New function.
4232 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4233 (Symbol_table::gc_mark_dyn_syms): New function.
4234 (Symbol_table::gc_): New data member.
4235 * target.h (Sized_target::gc_process_relocs): New pure virtual
4237 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4238 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4240 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
4242 * options.h (General_options::gc_sections): Define as a no-op for now.
4243 (General_options::no_keep_memory): Ditto.
4244 (General_options::Bshareable): Define.
4245 * options.cc (General_options::finalize): Honor -Bshareable.
4247 2009-01-20 Andreas Schwab <schwab@suse.de>
4249 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4250 read the value in the contents, since we don't use it. Use the
4251 template endianness when writing.
4252 (Relocate::relocate): Use it for R_PPC_REL16_HA.
4254 2009-01-19 Andreas Schwab <schwab@suse.de>
4256 * configure.tgt (powerpc64-*): Fix targ_obj.
4258 2009-01-15 Ian Lance Taylor <iant@google.com>
4260 * object.cc (Sized_relobj::write_local_symbols): Don't write out
4261 local symbols when stripping all symbols.
4263 2009-01-14 Cary Coutant <ccoutant@google.com>
4265 * output.cc (Output_reloc): Add explicit instantiations.
4267 2009-01-14 Cary Coutant <ccoutant@google.com>
4269 * archive.cc (Archive::get_elf_object_for_member): Remove call
4270 to File_read::claim_for_plugin.
4271 * descriptors.cc (Descriptors::open): Remove reference to
4273 (Descriptors::claim_for_plugin): Remove.
4274 * descriptors.h (Descriptors::claim_for_plugin): Remove.
4275 (Descriptors::is_claimed): Remove.
4276 (claim_descriptor_for_plugin): Remove.
4277 * fileread.cc (File_read::claim_for_plugin): Remove.
4278 * fileread.h (File_read::claim_for_plugin): Remove.
4279 (File_read::descriptor): Reopen descriptor if necessary.
4280 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
4281 (Plugin_manager::all_symbols_read): Add task parameter. Change
4283 (Plugin_manager::get_input_file): New function.
4284 (Plugin_manager::release_input_file): New function.
4285 (Pluginobj::Pluginobj): Add filesize parameter and initialize
4286 corresponding data member.
4287 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4288 and pass to base constructor. Change all callers.
4289 (get_input_file, release_input_file): New functions.
4290 (make_sized_plugin_object): Add filesize parameter. Change all callers.
4291 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4292 (Plugin_manager::all_symbols_read): Add task parameter.
4293 (Plugin_manager::get_input_file): New function.
4294 (Plugin_manager::release_input_file): New function.
4295 (Plugin_manager::task_): New data member.
4296 (Pluginobj::Pluginobj): Add filesize parameter.
4297 (Pluginobj::filename): New function.
4298 (Pluginobj::descriptor): New function.
4299 (Pluginobj::filesize): New function.
4300 (Pluginobj::filesize_): New data member.
4301 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4302 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4303 File_read::claim_for_plugin; use Object::unlock to unlock the file.
4305 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4306 with archive libraries.
4307 * testsuite/Makefile.in: Regenerate.
4308 * testsuite/plugin_test.c (struct sym_info): New type.
4309 (get_input_file, release_input_file): New static variables.
4310 (onload): Capture new transfer vector entries.
4311 (claim_file_hook): Stop reading at end of file according to filesize.
4312 Factor out parsing of readelf output into separate function.
4313 (all_symbols_read_hook): Exercise get_input_file and release_input_file
4314 APIs and get the source file name from the symbol table. Convert
4315 source file name to corresponding object file name. Print info
4316 message when adding new input files.
4317 (parse_readelf_line): New function.
4318 * testsuite/plugin_test_1.sh: Add checks for new info messages.
4319 * testsuite/plugin_test_2.sh: Likewise.
4320 * testsuite/plugin_test_3.sh: Likewise.
4321 * testsuite/plugin_test_4.sh: New test case.
4323 2009-01-07 Ian Lance Taylor <iant@google.com>
4325 * version.cc (version_string): Bump to 1.8.
4327 2008-12-23 Cary Coutant <ccoutant@google.com>
4329 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4330 * plugin.cc (Plugin_manager::finish): Rename as
4331 layout_deferred_objects. Move cleanup to separate function.
4332 (Plugin_manager::cleanup): New function.
4333 (Plugin_finish::run): Call layout_deferred_objects and cleanup
4335 * plugin.h (Plugin_manager::finish): Rename as
4336 layout_deferred_objects.
4337 (Plugin_manager::cleanup): New function.
4338 (Plugin_manager::cleanup_done): New field.
4340 2008-12-23 Cary Coutant <ccoutant@google.com>
4342 * plugin.cc (is_visible_from_outside): New function.
4343 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4344 so we don't return "IR only" status for exported symbols or -r links.
4346 * testsuite/Makefile.am (plugin_test_3): New test case.
4347 * testsuite/Makefile.in: Regenerate.
4348 * testsuite/plugin_test_3.sh: New file.
4350 2008-12-22 Cary Coutant <ccoutant@google.com>
4352 * object.cc (Sized_relobj::layout_section): New function.
4353 (Sized_relobj::do_layout): Defer layout of input sections until after
4354 plugin has provided replacement files.
4355 (Sized_relobj::do_layout_deferred_sections): New function.
4356 * object.h (Relobj::set_section_offset): Remove virtual keyword.
4357 (Relobj::layout_deferred_sections): New function.
4358 (Relobj::do_layout_deferred_sections): New function.
4359 (Sized_relobj::do_layout_deferred_sections): New function.
4360 (Sized_relobj::layout_section): New function.
4361 (Sized_relobj::Deferred_layout): New structure.
4362 (Sized_relobj::deferred_layout_): New field.
4363 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4364 Change all callers. Layout deferred sections.
4365 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4367 (Plugin_hook::run): Move code from do_plugin_hook inline.
4368 (Plugin_hook::do_plugin_hook): Remove.
4369 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4370 (Plugin_manager::finish): Renamed, was cleanup.
4371 (Plugin_manager::should_defer_layout): New function.
4372 (Plugin_manager::add_deferred_layout_object): New function.
4373 (Plugin_manager::Deferred_layout_list): New type.
4374 (Plugin_manager::deferred_layout_objects_): New field.
4375 (Plugin_hook::do_plugin_hook): Remove.
4377 2008-12-17 Ian Lance Taylor <iant@google.com>
4379 * options.h (class General_options): Add --no case for
4382 2008-12-16 Cary Coutant <ccoutant@google.com>
4384 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4386 (Plugin_manager::claim_file): Create plugin object even if
4387 plugin did not call the add_symbols callback.
4388 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4389 asking for more symbols than were added.
4390 * testsuite/Makefile.am (plugin_test_1): Add test case with
4392 (empty.syms): New target.
4393 * testsuite/Makefile.in: Regenerate.
4394 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4395 message. Don't call add_symbols if no globals.
4396 (all_symbols_read_hook): Don't provide replacement for empty
4399 2008-12-12 Ian Lance Taylor <iant@google.com>
4401 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4402 r_type == 0 for a local symbol with r_sym == 0.
4403 (scan_relocatable_relocs): Pass r_sym to
4404 local_non_section_strategy.
4405 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4408 * configure.ac: Update test for TLS descriptors: they are
4409 supported as of glibc 2.9.
4410 * configure: Rebuild.
4412 2008-12-11 Ian Lance Taylor <iant@google.com>
4415 * target-reloc.h (Default_scan_relocatable_relocs): For each
4416 function, map r_type == 0 to RELOC_DISCARD.
4418 2008-12-10 Cary Coutant <ccoutant@google.com>
4420 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4421 object to override a kept COMDAT group from a plugin object.
4423 2008-12-09 Ian Lance Taylor <iant@google.com>
4426 * yyscript.y (file_cmd): Handle INPUT.
4428 * testsuite/initpri1.c: Change all declarations to be full
4429 prototypes by adding void, to avoid compiler warnings.
4431 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
4433 * options.cc (General_options::parse_plugin_opt): New.
4434 (General_options::add_plugin): The argument now is just the filename.
4435 (General_options::add_plugin_option): New.
4436 * options.h (plugin_opt): New.
4437 (add_plugin): Change argument name.
4438 (add_plugin_option): New.
4439 * plugin.cc (Plugin::load): Don't parse the plugin option.
4440 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4441 (Plugin::add_option): New.
4442 (Plugin::args_): Change type.
4443 (Plugin::filename_): New.
4444 (Plugin_manager::add_plugin_option): New.
4445 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4446 * testsuite/Makefile.in: Regenerate.
4448 2008-12-05 Cary Coutant <ccoutant@google.com>
4450 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4451 Handle --strip-lto-sections option.
4452 * options.h (strip_lto_sections): New option.
4454 2008-12-01 Cary Coutant <ccoutant@google.com>
4456 * plugin.cc (ld_plugin_message): Change format parameter to const.
4457 Fix mismatch between new[] and delete.
4459 2008-11-14 Cary Coutant <ccoutant@google.com>
4461 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4464 2008-11-05 Craig Silverstein <csilvers@google.com>
4466 * options.cc (General_options::parse_dynamic_list): New function.
4467 * options.h (General_options): New flags dynamic_list,
4468 dynamic_list_data, dynamic_list_cpp_new, and
4469 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4470 (General_options::in_dynamic_list): New function.
4471 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4472 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4473 (Lex::can_continue_name): Likewise.
4475 (read_script_file): New parameter script_options.
4476 (read_dynamic_list): New function.
4477 (Script_options::define_dynamic_list): New function.
4478 (dynamic_list_keyword_parsecodes): New variable.
4479 (dynamic_list_keywords): New variable.
4480 * script.h (Script_options::define_dynamic_list): New function
4482 (read_dynamic_list): New function prototype.
4483 * symtab.cc (strprefix): New macro.
4484 (Symbol::should_add_dynsym_entry): Support dynamic_list,
4485 dynamic_list_data, dynamic_list_cpp_new, and
4486 dynamic_list_cpp_typeinfo.
4487 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4488 (dynamic_list_expr): New rule.
4489 (dynamic_list_nodes): Likewise.
4490 (dynamic_list_node): Likewise.
4491 * testsuite/Makefile.am (dynamic_list): New test.
4492 * testsuite/Makefile.in: Regenerated.
4493 * testsuite/dynamic_list.t: New file.
4494 * testsuite/dynamic_list.sh: New file.
4496 2008-11-05 Craig Silverstein <csilvers@google.com>
4498 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4499 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4500 (t11_last): Likewise.
4501 * testsuite/ver_test_6.c (main): Likewise.
4503 2008-10-07 Cary Coutant <ccoutant@google.com>
4505 * options.c (General_options::finalize): Add check for -static and
4507 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4510 2008-10-02 Cary Coutant <ccoutant@google.com>
4512 * plugin.cc (make_sized_plugin_object): Fix conditional
4513 compilation to work when not all targets are enabled.
4515 2008-09-29 Cary Coutant <ccoutant@google.com>
4517 * archive.cc (Archive::get_file_and_offset): Use filename instead
4518 of name to get library path.
4519 (Archive::include_member): Unlock external member of a thin archive.
4521 * testsuite/Makefile.am (TEST_AR): New variable.
4522 (thin_archive_test_1): New test.
4523 (thin_archive_test_2): New test.
4524 * testsuite/Makefile.in: Regenerate.
4525 * testsuite/thin_archive_main.cc: New file.
4526 * testsuite/thin_archive_test_1.cc: New file.
4527 * testsuite/thin_archive_test_2.cc: New file.
4528 * testsuite/thin_archive_test_3.cc: New file.
4529 * testsuite/thin_archive_test_4.cc: New file.
4531 2008-09-29 Cary Coutant <ccoutant@google.com>
4533 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4534 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4536 (Sized_relobj::do_finalize_local_symbols): Likewise.
4537 (Sized_relobj::map_to_kept_section): Likewise.
4538 * object.h (Sized_relobj::invalid_address): New constant.
4539 (Sized_relobj::do_output_section_offset): Check for invalid_address
4541 * output.cc (Output_reloc::local_section_offset): Use constant
4542 invalid_address instead of -1U.
4543 (Output_reloc::get_address): Likewise.
4544 (Output_section::output_address): Change -1U to -1ULL.
4545 * output.h (Output_reloc::invalid_address): New constant.
4546 * reloc.cc (Sized_relobj::write_sections): Use constant
4547 invalid_address instead of -1U.
4548 (Sized_relobj::relocate_sections): Likewise.
4549 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4550 values for merge sections.
4551 * target-reloc.h (relocate_for_relocatable): Use constant
4552 invalid_address instead of -1U.
4554 2008-09-19 Cary Coutant <ccoutant@google.com>
4556 Add plugin functionality for link-time optimization (LTO).
4557 * configure.ac (plugins): Add --enable-plugins option.
4558 * configure: Regenerate.
4559 * config.in: Regenerate.
4560 * Makefile.am (LIBDL): New variable.
4561 (CCFILES): Add plugin.cc.
4562 (HFILES): Add plugin.h.
4563 (ldadd_var): Add LIBDL.
4564 * Makefile.in: Regenerate.
4566 * archive.cc: Include "plugin.h".
4567 (Archive::setup): Don't preread archive symbols when using a plugin.
4568 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
4569 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4571 (Archive::include_member): Add symbols from plugin objects.
4572 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4573 * descriptors.cc (Descriptors::open): Check for file descriptors
4574 abandoned by plugins.
4575 (Descriptors::claim_for_plugin): New function.
4576 * descriptors.h (Descriptors::claim_for_plugin): New function.
4577 (Open_descriptor::is_claimed): New field.
4578 (claim_descriptor_for_plugin): New function.
4579 * fileread.cc (File_read::claim_for_plugin): New function.
4580 * fileread.h (File_read::claim_for_plugin): New function.
4581 (File_read::descriptor): New function.
4582 * gold.cc: Include "plugin.h".
4583 (queue_initial_tasks): Add task to call plugin hooks for generating
4585 * main.cc: Include "plugin.h".
4586 (main): Load plugin libraries.
4587 * object.h (Pluginobj): Declare.
4588 (Object::pluginobj): New function.
4589 (Object::do_pluginobj): New function.
4590 (Object::set_target): New function.
4591 * options.cc: Include "plugin.h".
4592 (General_options::parse_plugin): New function.
4593 (General_options::General_options): Initialize plugins_ field.
4594 (General_options::add_plugin): New function.
4595 * options.h (Plugin_manager): Declare.
4596 (General_options): Add --plugin option.
4597 (General_options::has_plugins): New function.
4598 (General_options::plugins): New function.
4599 (General_options::add_plugin): New function.
4600 (General_options::plugins_): New field.
4601 * plugin.cc: New file.
4602 * plugin.h: New file.
4603 * readsyms.cc: Include "plugin.h".
4604 (Read_symbols::do_read_symbols): Check for archive before checking
4605 for ELF file. Call plugin hooks to claim files.
4606 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4607 from a real object file; force override when processing replacement
4609 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4610 (Symbol::init_base_object): Likewise.
4611 (Symbol::init_base_output_data): Likewise.
4612 (Symbol::init_base_output_segment): Likewise.
4613 (Symbol::init_base_constant): Likewise.
4614 (Symbol::init_base_undefined): Likewise.
4615 (Symbol::output_section): Assert that object is not a plugin.
4616 (Symbol_table::add_from_pluginobj): New function.
4617 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4619 (Symbol_table::sized_write_globals): Likewise.
4620 (Symbol_table::add_from_pluginobj): Instantiate template.
4621 * symtab.h (Sized_pluginobj): Declare.
4622 (Symbol::in_real_elf): New function.
4623 (Symbol::set_in_real_elf): New function.
4624 (Symbol::in_real_elf_): New field.
4625 (Symbol_table::add_from_pluginobj): New function.
4627 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4628 (LIBDL): New variable.
4630 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4631 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4632 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4633 (MOSTLYCLEANFILES): Likewise.
4634 * testsuite/Makefile.in: Regenerate.
4635 * testsuite/plugin_test.c: New file.
4636 * testsuite/plugin_test_1.sh: New file.
4637 * testsuite/plugin_test_2.sh: New file.
4639 2008-09-16 Ian Lance Taylor <iant@google.com>
4641 * target-reloc.h (relocate_section): Check whether a symbol is
4642 defined by the ABI before reporting an undefined symbol error.
4643 * target.h (Target::is_defined_by_abi): Make parameter const.
4644 (Target::do_is_defined_by_abi): Likewise.
4645 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4646 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4647 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4648 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4649 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4650 * testsuite/Makefile.in: Rebuild.
4652 * fileread.cc (make_view): Add casts to avoid warning.
4654 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4656 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4657 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4659 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4661 * options.h (General_options::output_is_executable): New.
4662 (General_options::output_is_pie): New.
4663 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4664 for shared libraries.
4665 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4667 2008-09-11 Chris Demetriou <cgd@google.com>
4669 * options.h (origin): New -z option.
4670 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4671 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4674 2008-09-05 Cary Coutant <ccoutant@google.com>
4676 * fileread.cc (File_read::make_view): Add check for attempt to map
4679 2008-09-05 Cary Coutant <ccoutant@google.com>
4681 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4682 explicit instantiations.
4684 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4687 * options.cc (General_options::finalize): Allow undefined symbols
4688 in shlibs if linking -shared.
4691 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4692 symbols as not needing a dynsym entry.
4694 2008-08-20 Craig Silverstein <csilvers@google.com>
4696 * fileread.cc (File_read::open): Do not lock the file unless it
4697 was successfully opened.
4699 2008-08-14 Cary Coutant <ccoutant@google.com>
4701 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4702 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4703 * testsuite/tls_test.cc (struct int128): 128-bit struct
4704 for testing TLS relocs with non-zero addend.
4705 (v12): New TLS variable.
4707 (t_last): Add check for v12.
4708 * testsuite/tls_test.h (t12): New function.
4709 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4711 2008-08-13 Ian Lance Taylor <iant@google.com>
4713 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4714 set tls_segment_ or relro_segment_.
4715 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4717 * output.h (Output_section::clear_is_relro): New function.
4718 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4719 sections specially even when output_data_ is empty.
4720 (Output_segment::maximum_alignment): When first section is relro,
4721 only force alignment for PT_LOAD segments.
4722 * script.cc (script_data_segment_align): New function.
4723 (script_data_segment_relro_end): New function.
4724 * script-c.h (script_data_segment_align): Declare.
4725 (script_data_segment_relro_end): Declare.
4726 * script-sections.h (class Script_sections): Declare
4727 data_segment_align and data_segment_relro_end. Add fields
4728 segment_align_index_ and saw_relro_end_.
4729 * script-sections.cc (class Sections_element): Add set_is_relro
4730 virtual function. Add new bool* parameter to place_orphan_here.
4731 Add get_output_section virtual function.
4732 (class Output_section_definition): Add set_is_relro. Add new
4733 bool* parameter to place_orphan_here. Add get_output_section.
4734 Add is_relro_ field.
4735 (Output_section_definition::Output_section_definition): Initialize
4736 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4737 and is_relro_ fields.
4738 (Output_section_definition::place_orphan_here): Add is_relro
4740 (Output_section_definition::set_section_addresses): Set relro for
4742 (Output_section_definition::alternate_constraint): Likewise.
4743 (class Orphan_output_section): Add new bool* parameter to
4744 place_orphan_here. Add get_output_section.
4745 (Orphan_output_section::place_orphan_here): Add is_relro
4747 (Script_sections::Script_sections): Initialize
4748 data_segment_align_index_ and saw_relro_end_.
4749 (Script_sections::data_segment_align): New function.
4750 (Script_sections::data_segment_relro_end): New function.
4751 (Script_sections::place_orphan): Set or clear is_relro.
4752 (Script_sections::set_section_addresses): Force alignment of first
4754 * yyscript.y (exp): Call script_data_segment_align and
4755 script_data_segment_relro_end.
4756 * testsuite/relro_script_test.t: New file.
4757 * testsuite/relro_test.cc (using_script): Declare.
4758 (t1, t2): Test using_script.
4759 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4760 (relro_script_test_SOURCES): Define.
4761 (relro_script_test_DEPENDENCIES): Define.
4762 (relro_script_test_LDFLAGS): Define.
4763 (relro_script_test_LDADD): Define.
4764 (relro_script_test.so): New target.
4765 * testsuite/Makefile.in: Rebuild.
4767 2008-08-06 Cary Coutant <ccoutant@google.com>
4769 * archive.cc (Archive::total_archives, Archive::total_members)
4770 (Archive::total_members_loaded): New variables.
4771 (Archive::setup): Add parameter. Add option to preread
4773 (Archive::read_armap): Add counter.
4774 (Archive::get_file_and_offset): New function.
4775 (Archive::get_elf_object_for_member): New function.
4776 (Archive::read_all_symbols): New function.
4777 (Archive::read_symbols): New function.
4778 (Archive::add_symbols): Add counters.
4779 (Archive::include_all_members): Use armap to find members if it's
4781 (Archive::include_member): Skip reading symbols if already read.
4782 Factored code into Archive::get_file_and_offset and
4783 Archive::get_elf_object_for_member. Changed call to
4784 Mapfile::report_include_archive_member.
4785 (Archive::print_stats): New function.
4786 * archive.h: Declare Object and Read_symbols_data classes.
4787 (Archive::Archive): Add initializers for new members.
4788 (Archive::setup): Add parameter.
4789 (Archive::print_stats): New function.
4790 (Archive::total_archives, Archive::total_members)
4791 (Archive::total_members_loaded): New variables.
4792 (Archive::get_file_and_offset): New function.
4793 (Archive::get_elf_object_for_member): New function.
4794 (Archive::read_all_symbols): New function.
4795 (Archive::read_symbols): New function.
4796 (Archive::Archive_member): New class.
4797 (Archive::members_): New member.
4798 (Archive::num_members_): New member.
4799 * main.cc: Include archive.h.
4800 (main): Call Archive::print_stats.
4801 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4802 archive parameter; member_name is now the fully-decorated name.
4803 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4804 * options.h: (General_options): Add --preread-archive-symbols option.
4805 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4808 2008-08-04 Ian Lance Taylor <iant@google.com>
4810 * symtab.h (Symbol::use_plt_offset): New function.
4811 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4812 * powerpc.cc (Relocate::relocate): Likewise.
4813 * sparc.cc (Relocate::relocate): Likewise.
4814 * x86_64.cc (Relocate::relocate): Likewise.
4815 * testsuite/weak_plt.sh: New test.
4816 * testsuite/weak_plt_main.cc: New test.
4817 * testsuite/weak_plt_shared.cc: New test.
4818 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4819 (check_PROGRAMS): Add weak_plt.
4820 (check_DATA): Add weak_plt_shared.so.
4821 (weak_plt_main_pic.o, weak_plt): New targets.
4822 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4823 * testsuite/Makefile.in: Rebuild.
4825 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4827 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4828 * testsuite/Makefile.in: Rebuild.
4830 2008-08-04 Alan Modra <amodra@bigpond.net.au>
4832 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4833 * Makefile.in: Regenerate.
4834 * po/POTFILES.in: Regenerate.
4836 2008-07-29 Ian Lance Taylor <iant@google.com>
4838 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4839 symbols before other symbols.
4840 * testsuite/script_test_2.cc (test_addr): Declare.
4841 (test_addr_alias): Declare.
4842 (main): Check that test_addr and test_addr_alias have the right
4844 * testsuite/script_test_2.t: Define test_addr_alias and
4847 2008-07-24 Ian Lance Taylor <iant@google.com>
4850 * descriptors.cc: New file.
4851 * descriptors.h: New file.
4852 * gold-threads.h (class Hold_optional_lock): New class.
4853 * fileread.cc: Include "descriptors.h".
4854 (File_read::~File_read): Release descriptor rather than closing
4856 (File_read::open) [file]: Call open_descriptor rather than open.
4857 Set is_descriptor_opened_.
4858 (File_read::open) [memory]: Assert that descriptor is not open.
4859 (File_read::reopen_descriptor): New function.
4860 (File_read::release): Release descriptor.
4861 (File_read::do_read): Make non-const. Reopen descriptor.
4862 (File_read::read): Make non-const.
4863 (File_read::make_view): Reopen descriptor.
4864 (File_read::do_readv): Likewise.
4865 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4866 Update declarations.
4867 * layout.cc: Include "descriptors.h".
4868 (Layout::create_build_id): Use open_descriptor rather than open.
4869 * output.cc: Include "descriptors.h".
4870 (Output_file::open): Use open_descriptor rather than open.
4871 * archive.cc (Archive::const_iterator): Change Archive to be
4873 (Archive::begin, Archive::end): Make non-const.
4874 (Archive::count_members): Likewise.
4875 * archive.h (class Archive): Update declarations.
4876 * object.h (Object::read): Make non-const.
4877 * Makefile.am (CCFILES): Add descriptors.cc.
4878 (HFILES): Add descriptors.h.
4879 * Makefile.in: Rebuild.
4882 * gold.h: Always include <clocale>. Add Solaris workarounds
4883 following code in binutils/sysdep.h.
4886 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4887 this->eh_frame_hdr_ is NULL before using it.
4889 * dynobj.cc (Versions::Versions): Update comment.
4891 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4892 the base version name.
4894 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4895 array size plus one.
4896 (Stringpool_template::set_string_offsets): Subtract one from key
4897 before using it as an array index.
4898 (Stringpool_template::get_offset_with_length): Likewise.
4899 (Stringpool_template::write_to_buffer): Likewise.
4900 * stringpool.h (Stringpool_template::get_offset_from_key):
4903 2008-07-23 Ian Lance Taylor <iant@google.com>
4906 * object.h (Merged_symbol_value::value): Do our best to handle a
4910 * script.cc (Version_script_info::get_versions): Don't add empty
4911 version tag to return value.
4912 (Version_script_info::get_symbol_version_helper): Change return
4913 type to bool. Add pversion parameter. Change all callers.
4914 (script_register_vers_node): Don't require a non-NULL tag.
4915 * script.h (class Version_script_info): Update declarations.
4916 (Version_script_info::get_symbol_version): Change return type to
4917 bool. Add version parameter. Change all callers.
4918 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4919 handling. Handle an empty version from a version script.
4920 (Symbol_table::define_special_symbol): Likewise.
4921 * testsuite/ver_test_10.script: New file.
4922 * testsuite/ver_test_10.sh: New file.
4923 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4924 (check_DATA): Add ver_test_10.syms.
4925 (ver_test_10.syms, ver_test_10.so): New target.
4926 * testsuite/Makefile.in: Rebuild.
4928 2008-07-23 Simon Baldwin <simonb@google.com>
4930 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4931 to zero for undefined symbols from dynamic libraries.
4933 2008-07-23 Ian Lance Taylor <iant@google.com>
4935 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4937 * symtab.h (class Symbol_table): Update declaration.
4938 * testsuite/ver_test_9.cc: New file.
4939 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4940 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4941 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4942 (ver_test_9.so, ver_test_9.o): New targets.
4943 * testsuite/Makefile.in: Rebuild.
4945 2008-07-22 Ian Lance Taylor <iant@google.com>
4947 * options.h (class General_options): Define --check-sections.
4948 * layout.cc (Layout::set_segment_offsets): Handle
4951 * options.h (class General_options): Define -n/--nmagic and
4953 * options.cc (General_options::finalize): For -n/--nmagic or
4954 -N/--omagic, set -static.
4955 * layout.cc (Layout::attach_allocated_section_to_segment): If
4956 -N/--omagic, don't put read-only and read-write sections in
4958 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4959 finding a read-only segment.
4960 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4961 don't set the minimum segment alignment to the common page size,
4962 and don't set the file offset to the address modulo the page size.
4963 * script-sections.cc (Script_sections::create_segments): If
4964 -n/--omagic, don't put read-only and read-write sections in
4967 * cref.cc: New file.
4969 * options.h (class General_options): Add --print-symbol-counts.
4970 * main.cc (main): Issue defined symbol report if requested.
4971 * archive.cc (Archive::interpret_header): Make into a const member
4973 (Archive::add_symbols): Call Input_objects::archive_start and
4975 (Archive::const_iterator): Define new class.
4976 (Archive::begin, Archive::end): New functions.
4977 (Archive::include_all_members): Rewrite to use iterator.
4978 (Archive::count_members): New function.
4979 * archive.h (class Archive): Update declarations.
4980 (Archive::filename): New function.
4981 * object.cc: Include "cref.h".
4982 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4983 (Sized_relobj::do_get_global_symbol_counts): New function.
4984 (Input_objects::add_object): Add object to cross-referencer.
4985 (Input_objects::archive_start): New function.
4986 (Input_objects::archive_stop): New function.
4987 (Input_objects::print_symbol_counts): New function.
4988 * object.h: Declare Cref and Archive.
4989 (Object::get_global_symbol_counts): New function.
4990 (Object::do_get_global_symbol_counts): New pure virtual function.
4991 (class Sized_relobj): Add defined_count_ field. Update
4993 (class Input_objects): Add cref_ field. Update constructor.
4994 Update declarations.
4995 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4997 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4999 (Sized_dynobj::do_get_global_symbol_counts): New function.
5000 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
5001 defined_count_. Update declarations. Define Symbols typedef.
5002 * symtab.cc (Symbol_table::add_from_relobj): Add defined
5003 parameter. Change all callers.
5004 (Symbol_table::add_from_dynobj): Add sympointers and defined
5005 parameters. Change all callers.
5006 * symtab.h (class Symbol_table): Update declarations.
5007 * Makefile.am (CCFILES): Add cref.cc.
5008 (HFILES): Add cref.h.
5009 * Makefile.in: Rebuild.
5011 2008-07-22 Simon Baldwin <simonb@google.com>
5013 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
5014 to zero when writing undefined symbols.
5016 2008-07-22 Ian Lance Taylor <iant@google.com>
5018 * output.cc (Output_section::add_input_section): Don't try to
5019 merge empty merge sections.
5021 2008-07-21 Craig Silverstein <csilvers@google.com>
5023 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5024 Include symbol version in error message.
5026 2008-07-20 Chris Demetriou <cgd@google.com>
5028 * configure.ac (gold_cv_c_random_seed): New configured variable.
5029 (RANDOM_SEED_CFLAGS): New substituted variable.
5030 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
5031 * configure: Rebuild.
5032 * Makefile.in: Likewise.
5033 * testsuite/Makefile.in: Likewise.
5035 2008-07-18 Ian Lance Taylor <iant@google.com>
5037 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
5038 where we see NAME/NULL and NAME/VERSION as separate symbols.
5039 * testsuite/ver_test_main.cc (main): Call t4.
5040 (t4, t4_2a): Define.
5041 * testsuite/ver_test_2.cc (t4_2): Define.
5042 * testsuite/ver_test_2.script: Put t4_2a in VER2.
5043 * testsuite/ver_test_4.cc (t4_2a): Define.
5044 * testsuite/ver_test_4.script: Put t4_2a in VER2.
5045 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
5047 2008-07-17 Ian Lance Taylor <iant@google.com>
5049 * dynobj.cc (Versions::add_def): If we give an error about a
5050 missing version, go ahead and create the version anyhow.
5052 2008-07-10 Ian Lance Taylor <iant@google.com>
5054 Handle output sections with more than 0x7fffffff bytes.
5055 * object.h (class Relobj): Change map_to_output_ to
5056 output_sections_, and just keep a section pointer. Change all
5057 uses. Move comdat group support to Sized_relobj.
5058 (Relobj::is_section_specially_mapped): Remove.
5059 (Relobj::output_section): Remove poff parameter. Change all
5061 (Relobj::output_section_offset): New function.
5062 (Relobj::set_section_offset): Rewrite.
5063 (Relobj::map_to_output): Remove.
5064 (Relobj::output_sections): New function.
5065 (Relobj::do_output_section_offset): New pure virtual function.
5066 (Relobj::do_set_section_offset): Likewise.
5067 (class Sized_relobj): Add section_offsets_ field. Add comdat
5068 group support from Relobj. Update declarations.
5069 (Sized_relobj::get_output_section_offset): New function.
5070 (Sized_relobj::do_output_section_offset): New function.
5071 (Sized_relobj::do_set_section_offset): New function.
5072 * object.cc (Relobj::output_section_address): Remove.
5073 (Sized_relobj::Sized_relobj): Initialize new fields.
5074 (Sized_relobj::include_section_group): Cast find_kept_object to
5076 (Sized_relobj::include_linkonce_section): Likewise.
5077 (Sized_relobj::do_layout): Use separate arrays for output section
5079 (Sized_relobj::do_count_local_symbols): Change map_to_output to
5081 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
5082 output_sections and section_offsets.
5083 (Sized_relobj::write_local_symbols): Likewise.
5084 (map_to_kept_section): Compute output address directly.
5085 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
5086 output_sections and section_offsets.
5087 (Sized_relobj::write_sections): Likewise.
5088 (Sized_relobj::relocate_sections): Likewise.
5089 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
5090 * output.h (class Output_reloc): Update declarations. Change
5091 u2_.relobj to Sized_relobj*.
5092 (class Output_data_reloc): Change add functions to use
5094 * output.cc (Output_reloc::Output_reloc): Change relobj to
5096 (Output_reloc::local_section_offset): Change return type to
5097 Elf_Addr. Use get_output_section_offset.
5098 (Output_reloc::get_address): Likewise.
5099 (Output_section::is_input_address_mapped): Don't call
5100 is_section_specially_mapped.
5101 (Output_section::output_offset): Likewise.
5102 (Output_section::output_address): Likewise.
5103 (Output_section::starting_output_address): Likewise.
5104 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
5105 parameter to Sized_relobj*.
5106 (Copy_relocs::need_copy_reloc): Likewise.
5107 (Copy_relocs::save): Likewise.
5108 * copy-relocs.h (class Copy_relocs): Update declarations.
5109 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
5110 Sized_relobj*. Change relobj_ field to Sized_relobj*.
5111 * target-reloc.h (relocate_for_relocatable): Change
5112 offset_in_output_section type to Elf_Addr. Change code that uses
5114 * layout.cc (Layout::layout): Always set *off.
5115 * mapfile.cc (Mapfile::print_input_section): Use
5116 output_section_offset.
5117 * i386.cc (Target_i386::copy_reloc): Change object parameter to
5119 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
5120 * sparc.cc (Target_sparc::copy_reloc): Likewise.
5121 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
5123 2008-07-03 Ian Lance Taylor <iant@google.com>
5125 * layout.cc (Layout::include_section): Do not discard unrecognized
5126 SHT_STRTAB sections.
5128 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
5130 * script.cc (Lex::can_continue_name): Make '?' allowable in
5131 version-script names.
5132 * testsuite/version_script.map: Change glob pattern to use '?'
5134 2008-06-30 Manish Singh <yosh@gimp.org>
5137 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
5140 2008-06-30 Ian Lance Taylor <iant@google.com>
5144 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
5145 versions]: Don't try to read the value in the contents, since we
5146 don't use it. Use the template endianness when writing.
5148 2008-06-25 Cary Coutant <ccoutant@google.com>
5150 * fileread.cc (File_read::make_view): Assert on zero-length view.
5151 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
5152 symbol table when there are no symbols to read.
5154 2008-06-23 Craig Silverstein <csilvers@google.com>
5156 * version.cc (version_string): Bump to 1.7
5158 2008-06-18 Craig Silverstein <csilvers@google.com>
5160 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
5161 constant 0xFFFF to type Valtype.
5162 (Powerpc_relocate_functions::rel16_ha): Likewise.
5164 2008-06-17 Ian Lance Taylor <iant@google.com>
5166 * output.h (Output_section::Input_section): Initialize p2align_ to
5167 zero for Output_section_data constructors.
5168 (Output_section::Input_section::addralign): If not an input
5169 section, return the alignment of the Output_section_data.
5170 * testsuite/copy_test.cc: New file.
5171 * testsuite/copy_test_1.cc: New file.
5172 * testsuite/copy_test_2.cc: New file.
5173 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
5174 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
5175 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
5176 (copy_test_1_pic.o, copy_test_1.so): New targets.
5177 (copy_test_2_pic.o, copy_test_2.so): New targets.
5178 * testsuite/Makefile.in: Rebuild.
5180 * script-sections.cc (Script_sections::place_orphan): Initialize
5181 local variable exact.
5183 2008-06-13 David Edelsohn <edelsohn@gnu.org>
5185 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5187 2008-06-12 David Edelsohn <edelsohn@gnu.org>
5188 David S. Miller <davem@davemloft.net>
5190 * powerpc.cc: New file.
5191 * Makefile.am (TARGETSOURCES): Add powerpc.cc
5192 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
5193 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
5194 * Makefile.in: Rebuild.
5196 2008-06-09 Ian Lance Taylor <iant@google.com>
5198 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
5200 (throwing, orig_terminate): New static variables.
5201 (terminate_handler): New static function.
5202 (t2): Set terminate handler.
5204 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
5207 * binary.cc (Binary_to_elf::sized_convert): Fix .data
5210 2008-05-30 Cary Coutant <ccoutant@google.com>
5212 * archive.cc (Archive::include_all_members) Correct to step
5213 over symbol table and extended name table in thin archives.
5215 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
5218 * target-reloc.h (relocate_for_relocatable): Fix new_offset
5221 2008-05-28 Caleb Howe <cshowe@google.com>
5223 * reduced_debug_output.cc: New file.
5224 * reduced_debug_output.h: New file.
5225 * options.h (class General_options): Add --strip-debug-non-line.
5226 * options.cc (General_options::finalize): Add strip_debug_non_line
5227 to the strip heirarchy.
5228 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5230 * layout.cc: Include "reduced_debug_output.h".
5231 (Layout::Layout): Initialize new fields.
5232 (line_only_debug_sections): New static array.
5233 (is_lines_only_debug_sections): New static inline function.
5234 (Layout::include_section): Handle --strip-debug-non-line.
5235 (Layout::make_output_section): If --strip-debug-non-line, build
5236 new output sections for .debug_abbrev and .debug_info.
5237 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5238 gold. Warn about possible overflow.
5239 (read_signed_LEB_128): Likewise.
5240 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5241 (read_signed_LEB_128): Declare.
5242 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5243 (HFILES): Add reduced_debug_output.h.
5244 * Makefile.in: Rebuild.
5246 2008-05-21 Ian Lance Taylor <iant@google.com>
5248 * mapfile.cc: New file.
5249 * mapfile.h: New file.
5250 * options.h (class General_options): Add -M/--print-map and -Map.
5251 * options.cc (General_options::finalize): Make -M equivalent to
5253 * main.cc: Include <cstdio> and "mapfile.h".
5254 (main): Open mapfile if requested.
5255 * gold.cc (class Middle_runner): Add mapfile_ field. Update
5256 constructor. Change caller.
5257 (queue_initial_tasks): Add mapfile parameter. Change caller.
5258 (queue_middle_tasks): Likewise.
5259 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5261 * archive.cc: Include "mapfile.h".
5262 (Archive::add_symbols): Add mapfile parameter. Change all
5263 callers. Pass mapfile, symbol, and reason to include_member.
5264 (Archive::include_all_members): Add mapfile parameter. Change all
5266 (Archive::include_member): Add mapfile, sym, and why parameters.
5267 Change all callers. Report inclusion to map file.
5268 * archive.h: Include "fileread.h".
5269 (class Archive): Update declarations.
5270 (Archive::file): New const method.
5271 (class Add_archive_symbols): Add mapfile_ field. Update
5272 constructor. Change all callers.
5273 * readsyms.h (class Read_symbols): Likewise.
5274 (class Finish_group): Likewise.
5275 (class Read_script): Likewise.
5276 * common.cc: Include "mapfile.h".
5277 (Symbol_table::allocate_commons): Add mapfile parameter. Change
5279 (Symbol_table::do_allocate_commons): Likewise.
5280 (Symbol_table::do_allocate_commons_list): Likewise. Report common
5281 symbol allocation to mapfile.
5282 * common.h (class Allocate_commons_task): Add mapfile_ field.
5283 Update constructor. Change all callers.
5284 * symtab.h (class Symbol_table): Update declarations.
5285 * layout.cc: Include "mapfile.h".
5286 (Layout_task_runner::run): Print information to mapfile.
5287 (Layout::create_gold_note): Change Output_data_fixed_space to
5288 Output_data_zero_fill.
5289 (Layout::create_build_id): Likewise.
5290 (Layout::print_to_mapfile): New function.
5291 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
5292 constructor. Change caller.
5293 (class Layout): Declare print_to_mapfile.
5294 * output.cc (Output_section::Input_section::print_to_mapfile): New
5296 (Output_section::add_input_section): If producing a map, always
5297 add to input_sections_ list.
5298 (Output_section::do_print_to_mapfile): New function.
5299 (Output_segment::print_sections_to_mapfile): New function.
5300 (Output_segment::print_section_list_to_mapfile): New function.
5301 * output.h: Include "mapfile.h".
5302 (Output_data::print_to_mapfile): New function.
5303 (Output_data::do_print_to_mapfile): New virtual function.
5304 (Output_segment_headers::do_print_to_mapfile): New function.
5305 (Output_file_header::do_print_to_mapfile): New function.
5306 (Output_data_const::do_print_to_mapfile): New function.
5307 (class Output_data_const_buffer): Add map_name_ field. Update
5308 constructor. Change all callers. Add do_print_to_mapfile
5310 (class Output_data_fixed_space): Likewise.
5311 (class Output_data_space): Likewise.
5312 (class Output_data_zero_fill): New class.
5313 (Output_data_strtab::do_print_to_mapfile): New function.
5314 (Output_data_reloc_base::do_print_to_mapfile): New function.
5315 (Output_relocatable_relocs::do_print_to_mapfile): New function.
5316 (Output_data_group::do_print_to_mapfile): New function.
5317 (Output_data_got::do_print_to_mapfile): New function.
5318 (Output_data_dynamic::do_print_to_mapfile): New function.
5319 (Output_symtab_xindex::do_print_to_mapfile): New function.
5320 (class Output_section): Declare do_print_to_mapflie. Declare
5321 print_to_mapfile in Input_section.
5322 (class Output_segment): Declare new functions.
5323 * object.h (Sized_relobj::symbol_count): New function.
5324 * script-sections.cc
5325 (Output_section_element_dot_assignment::set_section_addresses):
5326 Change Output_data_fixed_space to Output_data_zero_fill.
5327 (Output_data_expression::do_print_to_mapfile): New function.
5328 * script.cc (read_input_script): Add mapfile parameter. Change
5330 * script.h (read_input_script): Update declaration.
5331 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5332 (Eh_frame::do_print_to_mapfile): New function.
5333 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5334 (Output_merge_string::do_print_to_mapfile): New function.
5335 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5337 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5339 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5341 * Makefile.am (CCFILES): Add mapfile.cc.
5342 (HFILES): Add mapfile.h.
5343 * Makefile.in: Rebuild.
5345 2008-05-19 Ian Lance Taylor <iant@google.com>
5347 * options.h (class General_options): Add -z relro.
5348 * layout.cc (Layout::Layout): Initialize relro_segment_.
5349 (Layout::add_output_section_data): Return the output section.
5350 (Layout::make_output_section): Rcognize relro sections and mark
5352 (Layout::attach_allocated_section_to_segment): Put relro sections
5353 in a PT_GNU_RELRO segment.
5354 (Layout::create_initial_dynamic_sections): Mark the .dynamic
5356 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5358 (Layout::linkonce_mapping): Map d.rel.ro.local to
5360 (Layout::output_section_name): Us .data.rel.ro.local for any
5361 section which begins with that.
5362 * layout.h (class Layout): Update add_output_section_data
5363 declaration. Add relro_segment_ field.
5364 * output.cc (Output_section::Output_section): Initialize is_relro_
5365 and is_relro_local_ fields.
5366 (Output_segment::add_output_section): Group relro sections.
5367 (Output_segment::is_first_section_relro): New function.
5368 (Output_segment::maximum_alignment): If there is a relro section,
5369 align the segment to the common page size.
5370 (Output_segment::set_section_addresses): Track whether we are
5371 looking at relro sections. If the last section is a relro
5372 section, align to the common page size.
5373 (Output_segment::set_section_list_addresses): Add in_relro
5374 parameter. Change all callers. Align to the page size when
5375 moving from relro to non-relro section.
5376 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5378 * output.h (class Output_section): Add is_relro_ and
5379 is_relro_local_ fields.
5380 (Output_section::is_relro): New function.
5381 (Output_section::set_is_relro): New function.
5382 (Output_section::is_relro_local): New function.
5383 (Output_section::set_is_relro_local): New function.
5384 (class Output_segment): Update declarations.
5385 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5386 * sparc.cc (Target_sparc::got_section): Likewise.
5387 * x86_64.cc (Target_x86_64::got_section): Likewise.
5388 * testsuite/relro_test_main.cc: New file.
5389 * testsuite/relro_test.cc: New file.
5390 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5391 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5392 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5393 (relro_test.so, relro_test_pic.o): New targets.
5394 * testsuite/Makefile.in: Rebuild.
5396 2008-05-16 Ian Lance Taylor <iant@google.com>
5398 * output.cc (Output_segment::add_output_section): Remove front
5400 * output.h (class Output_segment): Remove
5401 add_initial_output_section and overloaded add_output_section.
5402 Update declaration of remaining add_output_section.
5403 * layout.cc (Layout::create_interp): Call add_output_section
5404 rather than add_initial_output_section.
5405 (Layout::finish_dynamic_section): Likewise.
5407 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5408 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5409 know the dynamic type.
5410 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5411 field. Initialize it in constructor.
5412 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5413 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5414 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5417 * output.cc (Output_reloc::get_address): Change return type to
5419 * output.h (class Output_reloc): Update get_address declaration.
5420 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5421 for section addresses.
5423 2008-05-09 Ian Lance Taylor <iant@google.com>
5426 * gold.cc (gold_nomem): Use return value of write.
5428 2008-05-08 Ian Lance Taylor <iant@google.com>
5430 * symtab.c (Symbol::init_base_output_data): Add version
5431 parameter. Change all callers.
5432 (Symbol::init_base_output_segment): Likewise.
5433 (Symbol::init_base_constant): Likewise.
5434 (Symbol::init_base_undefined): Likewise.
5435 (Sized_symbol::init_output_data): Likewise.
5436 (Sized_symbol::init_output_segment): Likewise.
5437 (Sized_symbol::init_constant): Likewise.
5438 (Sized_symbol::init_undefined): Likewise.
5439 (Symbol_table::do_define_in_output_data): If the new symbol has a
5440 version, mark it as the default.
5441 (Symbol_table::do_define_in_output_segment): Likewise.
5442 (Symbol_table::do_define_as_constant): Likewise.
5443 * symtab.h (class Symbol): Update declarations.
5444 (class Sized_symbol): Likewise.
5445 * resolve.cc (Symbol::override_version): New function.
5446 (Symbol::override_base): Call override_version.
5447 (Symbol::override_base_with_special): Likewise.
5448 * testsuite/ver_script_8.script: New file.
5449 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5450 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5451 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5452 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5454 2008-05-06 Ian Lance Taylor <iant@google.com>
5457 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5459 (class General_options): Remove existing --undefined, and add
5460 --no-undefined instead. Add new --undefined as synonym for -u.
5461 * archive.cc (Archive::add_symbols): Check whether symbol was
5463 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5464 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5465 all uses. Add IS_UNDEFINED. Update declarations to split
5466 different versions of init_base. Declare init_base_undefined.
5467 (Symbol::is_defined): Handle IS_UNDEFINED.
5468 (Symbol::is_undefined): Likewise.
5469 (Symbol::is_weak_undefined): Call is_undefined.
5470 (Symbol::is_absolute): Handle IS_CONSTANT.
5471 (class Sized_symbol): Update declarations to split different
5472 versions of init. Declare init_undefined.
5473 (class Symbol_table): Declare new functions.
5474 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5476 (Symbol::init_base_output_data): Likewise.
5477 (Symbol::init_base_output_segment): Likewise.
5478 (Symbol::init_base_constant): Likewise.
5479 (Symbol::init_base_undefined): New function.
5480 (Sized_symbol::init_object): Rename from init. Change all
5482 (Sized_symbol::init_output_data): Likewise.
5483 (Sized_symbol::init_output_segment): Likewise.
5484 (Sized_symbol::init_constant): Likewise.
5485 (Sized_symbol::init_undefined): New function.
5486 (Symbol_table::add_undefined_symbols_from_command_line): New
5488 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5490 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5491 (Symbol::output_section): Likewise.
5492 (Symbol::set_output_section): Likewise.
5493 (Symbol_table::sized_finalize_symbol): Likewise.
5494 (Symbol_table::sized_write_globals): Likewise.
5495 * resolve.cc (Symbol_table::should_override): Likewise.
5496 (Symbol::override_base_with_special): Likewise.
5498 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5499 symbol, change it to have default visibility.
5500 * testsuite/protected_1.cc: New file.
5501 * testsuite/protected_2.cc: New file.
5502 * testsuite/protected_3.cc: New file.
5503 * testsuite/protected_main_1.cc: New file.
5504 * testsuite/protected_main_2.cc: New file.
5505 * testsuite/protected_main_3.cc: New file.
5506 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5507 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5508 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5509 (protected_1.so): New target.
5510 (protected_1_pic.o, protected_2_pic.o): New targets.
5511 (protected_3_pic.o): New target.
5512 (check_PROGRAMS): Add protected_2.
5513 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5514 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5515 * testsuite/Makefile.in: Rebuild.
5517 * options.h (DEFINE_var): Add set_user_set_##varname__.
5518 (DEFINE_bool_alias): New macro.
5519 (class General_options): Define -Bstatic using DEFINE_bool_alias
5520 rather than DEFINE_special. Add --undefined as an alias for -z
5522 * options.cc (General_options::parse_Bstatic): Remove.
5524 * options.h (class General_options): Add --fatal-warnings.
5525 * main.cc (main): Implement --fatal-warnings.
5526 * errors.h (Errors::warning_count): New function.
5528 * options.h (class General_options): Add -Bsymbolic-functions.
5529 * symtab.h (Symbol::is_preemptible): Check for
5530 -Bsymbolic-functions.
5532 2008-05-05 Ian Lance Taylor <iant@google.com>
5534 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5535 as noVARNAME rather than no-VARNAME.
5536 (class General_options): Add option -z combreloc.
5537 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5539 (Output_reloc::sort_before) [SHT_REL]: New function.
5540 (Output_reloc::sort_before) [SHT_RELA]: New function.
5541 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5542 Sort_relocs_comparison.
5543 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5544 parameter. Change all callers.
5545 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5546 sort_relocs parameter. Change all callers.
5547 * output.cc (Output_reloc::get_address): New function, broken out
5549 (Output_reloc::write_rel): Call it.
5550 (Output_reloc::compare): New function.
5551 (Output_data_reloc_base::do_write): Optionally sort relocs.
5553 * configure.ac: If targ_extra_obj is set, link it in.
5554 * configure.tgt: Initialize all variables.
5555 (x86_64*): Set targ_extra_obj and targ_extra_size.
5556 * configure: Rebuild.
5558 * object.cc (Sized_relobj::include_section_group): Adjust section
5559 indexes read from group data. Build vector to pass to
5561 * layout.cc (Layout::layout_group): Add flags and shndxes
5562 parameters. Remove contents parameter. Change caller. Update
5563 explicit instantiations.
5564 * layout.h (class Layout): Update layout_group declaration.
5565 * output.cc (Output_data_group::Output_data_group): Add flags and
5566 input_shndxes parameters. Remove contents parameter. Change
5568 (Output_data_group::do_write): Change input_sections_ to
5570 * output.h (class Output_data_group): Update constructor
5571 declaration. Rename input_sections_ to input_shndxes_.
5572 * testsuite/many_sections_test.cc: Add template.
5574 2008-04-30 Cary Coutant <ccoutant@google.com>
5576 * target-reloc.h (relocate_section): Fix dead-pointer bug.
5578 * layout.cc (Layout::include_section): Refactored check for debug
5580 (Layout::add_comdat): Add new parameters. Change type
5581 of signature parameter. Add object and shndx to signatures table.
5582 (Layout::find_kept_object): New function.
5583 * layout.h: Include <cstring>.
5584 (Layout::is_debug_info_section): New function.
5585 (Layout::add_comdat): Add new parameters.
5586 (Layout::find_kept_object): New function.
5587 (Layout::Kept_section): New struct.
5588 (Layout::Signatures): Change type of map range.
5589 * object.cc (Relobj::output_section_address): New function.
5590 (Sized_relobj::include_section_group): Add new parameters. Change
5591 calls to Layout::add_comdat. Change to build table of kept comdat
5592 groups and table mapping discarded sections to kept sections.
5593 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5594 (Sized_relobj::do_layout): Change calls to include_section_group and
5595 include_linkonce_section.
5596 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5597 value to zero when section is discarded.
5598 (Sized_relobj::map_to_kept_section): New function.
5599 * object.h (Relobj::output_section_address): New function.
5600 (Relobj::Comdat_group): New type.
5601 (Relobj::find_comdat_group): New function.
5602 (Relobj::Comdat_group_table): New type.
5603 (Relobj::Kept_comdat_section): New type.
5604 (Relobj::Kept_comdat_section_table): New type.
5605 (Relobj::add_comdat_group): New function.
5606 (Relobj::set_kept_comdat_section): New function.
5607 (Relobj::get_kept_comdat_section): New function.
5608 (Relobj::comdat_groups_): New field.
5609 (Relobj::kept_comdat_sections_): New field.
5610 (Symbol_value::input_value): Update comment.
5611 (Sized_relobj::map_to_kept_section) New function.
5612 (Sized_relobj::include_linkonce_section): Add new parameter.
5613 * target-reloc.h (Comdat_behavior): New type.
5614 (get_comdat_behavior): New function.
5615 (relocate_section): Add code to map a discarded section to the
5616 corresponding kept section when applying a relocation.
5618 2008-04-30 Craig Silverstein <csilvers@google.com>
5620 * dwarf_reader.cc (next_generation_count): New static var.
5621 (Addr2line_cache_entry): New struct.
5622 (addr2line_cache): New static var.
5623 (Dwarf_line_info::one_addr2line): Added caching.
5624 (Dwarf_line_info::clear_addr2line_cache): New function.
5625 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5626 cache-size parameter.
5627 (Dwarf_line_info::one_addr2line_cache): New function.
5628 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5629 new cache-size argument to one_addr2line(), and clear cache.
5631 2008-04-28 Cary Coutant <ccoutant@google.com>
5633 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5634 R_386_PC8 relocations.
5636 2008-04-23 Ian Lance Taylor <iant@google.com>
5638 * object.cc (Sized_relobj::include_section_group): Check for
5639 invalid section group.
5641 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5644 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5645 than read for file header.
5646 * archive.cc (Archive::include_member): Likewise.
5648 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
5650 * aclocal.m4: Regenerate.
5651 * configure: Regenerate.
5653 2008-04-19 Ian Lance Taylor <iant@google.com>
5655 * version.cc (version_string): Bump to 1.6.
5657 * testsuite/Makefile.am (many_sections_r_test): New target.
5658 (many_sections_r_test_SOURCES): Remove.
5659 (many_sections_r_test_DEPENDENCIES): Remove.
5660 (many_sections_r_test_LDFLAGS): Remove.
5661 (many_sections_r_test_LDADD): Remove.
5663 * object.cc (Sized_relobj::do_add_symbols): Always pass
5664 local_symbol_count_ to add_from_relobj.
5666 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5667 every thousand variables.
5668 * testsuite/Makefile.in: Rebuild.
5670 * object.cc (Xindex::initialize_symtab_xindex): New function.
5671 (Xindex::read_symtab_xindex): New function.
5672 (Xindex::sym_xindex_to_shndx): New function.
5673 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5675 (Sized_relobj::do_initialize_xindex): New function.
5676 (Sized_relobj::do_read_symbols): Adjust section links.
5677 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5678 parameter. Change all callers.
5679 (Sized_relobj::include_section_group): Adjust section links and
5680 symbol section indexes.
5681 (Sized_relobj::do_layout): Adjust section links.
5682 (Sized_relobj::do_count_local_symbols): Adjust section links and
5683 symbol section indexes.
5684 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5685 ordinary and special symbols.
5686 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5687 dynsym_xindex parameters. Change all callers. Adjust section
5688 links. Use SHN_XINDEX when needed.
5689 (Sized_relobj::get_symbol_location_info): Adjust section links.
5690 Don't get fooled by special symbols.
5691 * object.h (class Xindex): Define.
5692 (class Object): Add xindex_ parameter. Declare virtual functoin
5693 do_initialize_xindex.
5694 (Object::adjust_sym_shndx): New function.
5695 (Object::set_xindex): New protected function.
5696 (class Symbol_value): Add is_ordinary_shndx_ field.
5697 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5698 (Symbol_value::value): Assert ordinary section.
5699 (Symbol_value::initialize_input_to_output_map): Likewise.
5700 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5702 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5704 (class Sized_relobj): Update declarations.
5705 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5706 parameter. Change all callers.
5707 (Sized_relobj::adjust_shndx): New function.
5708 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5710 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5711 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5712 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5713 (Sized_dynobj::read_dynsym_section): Adjust section links.
5714 (Sized_dynobj::read_dynamic): Likewise.
5715 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5717 (Sized_dynobj::do_initialize_xindex): New function.
5718 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5719 do_initialize_xindex.
5720 (Sized_dynobj::adjust_shndx): New function.
5721 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5722 dynsym_xindex_ fields.
5723 (Layout::finalize): Add a call to set_section_indexes before
5724 creating the symtab sections.
5725 (Layout::set_section_indexes): Don't do anything if the section
5726 already has a section index.
5727 (Layout::create_symtab_sections): Add shnum parameter. Change
5728 caller. Create .symtab_shndx section if needed.
5729 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5731 (Layout::allocated_output_section_count): New function.
5732 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5734 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5735 fields. Update declarations.
5736 (Layout::symtab_xindex): New function.
5737 (Layout::dynsym_xindex): New function.
5738 (class Write_symbols_task): Add layout_ field.
5739 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5741 * output.cc (Output_section_headers::Output_section_headers): Add
5742 shstrtab_section parameter. Change all callers.
5743 (Output_section_headers::do_sized_write): Store overflow values
5744 for section count and section string table section index in
5745 section header zero.
5746 (Output_file_header::do_sized_write): Check for overflow of
5747 section count and section string table section index.
5748 (Output_symtab_xindex::do_write): New function.
5749 (Output_symtab_xindex::endian_do_write): New function.
5750 * output.h (class Output_section_headers): Add shstrtab_section_.
5751 Update declarations.
5752 (class Output_symtab_xindex): Define.
5753 (Output_section::has_out_shndx): New function.
5754 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5756 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5758 (Sized_symbol::init): Likewise.
5759 (Symbol::output_section): Check for ordinary symbol.
5760 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5761 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5763 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5764 Change all callers. Simplify handling of symbols from sections
5765 not included in the link.
5766 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5768 (Weak_alias_sorter::operator()): Assert that symbols are
5770 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5772 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5773 parameters. Change all callers.
5774 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5775 symbol distinction. Use SHN_XINDEX when needed.
5776 (Symbol_table::write_section_symbol): Add symtab_xindex
5777 parameter. Change all callers.
5778 (Symbol_table::sized_write_section_symbol): Likewise. Use
5779 SHN_XINDEX when needed.
5780 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5782 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5783 (Symbol::is_defined): Check is_ordinary.
5784 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5785 (Symbol::is_absolute, Symbol::is_common): Likewise.
5786 (class Sized_symbol): Update declarations.
5787 (class Symbol_table): Update declarations.
5788 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5789 parameters. Change all callers.
5790 (Sized_symbol::override): Likewise.
5791 (Symbol_table::override): Likewise.
5792 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5793 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5794 is_ordinary, and orig_st_shndx parameters. Change all callers.
5795 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5796 to be in an ordinary section.
5797 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5798 object and is_ordinary parameters. Change all callers.
5799 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5800 Change all callers. Don't add undefined or non-ordinary symbols
5802 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5804 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5806 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5807 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5808 (Sized_relobj::relocate_sections): Likewise.
5809 * target-reloc.h (scan_relocs): Adjust section symbol index.
5810 (scan_relocatable_relocs): Likewise.
5811 * i386.cc (Scan::local): Check for ordinary symbols.
5812 * sparc.cc (Scan::local): Likewise.
5813 * x86_64.cc (Scan::local): Likewise.
5814 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5815 to symbol_section_and_value.
5816 * testsuite/many_sections_test.cc: New file.
5817 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5818 (check_PROGRAMS): Add many_sections_test.
5819 (many_sections_test_SOURCES): Define.
5820 (many_sections_test_DEPENDENCIES): Define.
5821 (many_sections_test_LDFLAGS): Define.
5822 (BUILT_SOURCES): Add many_sections_define.h.
5823 (many_sections_define.h): New target.
5824 (BUILT_SOURCES): Add many_sections_check.h.
5825 (many_sections_check.h): New target.
5826 (check_PROGRAMS): Add many_sections_r_test.
5827 (many_sections_r_test_SOURCES): Define.
5828 (many_sections_r_test_DEPENDENCIES): Define.
5829 (many_sections_r_test_LDFLAGS): Define.
5830 (many_sections_r_test_LDADD): Define.
5831 (many_sections_r_test.o): New target.
5832 * testsuite/Makefile.in: Rebuild.
5834 2008-04-17 Cary Coutant <ccoutant@google.com>
5836 * errors.cc (Errors::info): New function.
5837 (gold_info): New function.
5838 * errors.h (Errors::info): New function.
5839 * gold.h (gold_info): New function.
5840 * object.cc (Input_objects::add_object): Print trace output.
5841 * options.cc (options::parse_set): New function.
5842 (General_options::parse_wrap): Deleted.
5843 (General_options::General_options): Deleted initializer.
5844 * options.h (options::String_set): New typedef.
5845 (options::parse_set): New function.
5846 (DEFINE_set): New macro.
5847 (General_options::wrap): Changed to use DEFINE_set. Changed
5848 callers of any_wrap_symbols and is_wrap_symbol.
5849 (General_options::trace, General_options::trace_symbol):
5851 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5852 (General_options::wrap_symbols_): Deleted.
5853 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5855 2008-04-17 David S. Miller <davem@davemloft.net>
5857 * options.cc (General_options::parse_V): New function.
5858 * options.h: Add entries for -V and -Qy.
5860 2008-04-17 Ian Lance Taylor <iant@google.com>
5862 * common.cc (Symbol_table::allocate_commons): Remove options
5863 parameter. Change caller.
5864 (Symbol_table::do_allocate_commons): Remove options parameter.
5865 Change caller. Just call do_allocate_commons_list twice.
5866 (Symbol_table::do_allocate_commons_list): New function, broken out
5867 of do_allocate_commons.
5868 * common.h (class Allocate_commons_task): Remove options_ field.
5870 * symtab.cc (Symbol_table::Symbol_table): Initialize
5872 (Symbol_table::add_from_object): Put TLS common symbols on
5874 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5875 which are IN_OUTPUT_DATA.
5876 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5877 allocate_commons and do_allocate_commons declarations. Declare
5878 do_allocate_commons_list.
5879 * gold.cc (queue_middle_tasks): Update creation of
5880 Allocate_commons_task to not pass options.
5881 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5882 (TLS_TEST_C_FLAGS): New variable.
5883 (tls_test_c_pic.o): New target.
5884 (tls_test_shared.so): Link in tls_test_c_pic.o.
5885 (tls_test_c_pic_ie.o): New target.
5886 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5887 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5888 (tls_test_c.o): New target.
5889 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5890 (tls_pic_test_LDADD): Likewise.
5891 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5892 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5893 (tls_test_c_gnu2.o): New target.
5894 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5896 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5897 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5898 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5899 * testsuite/tls_test.cc: Include "config.h".
5900 (t_last): Call t11_last.
5901 * testsuite/tls_test.h (t11, t11_last): Declare.
5902 * testsuite/tls_test_c.c: New file.
5903 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5904 * configure.ac: Check for OpenMP support.
5905 * configure, config.in, Makefile.in: Rebuild.
5906 * testsuite/Makefile.in: Rebuild.
5908 2008-04-16 Cary Coutant <ccoutant@google.com>
5910 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5911 (Target_i386::tls_base_symbol_defined_): New field.
5912 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5913 (Target_i386::Scan::global): Likewise.
5914 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5915 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5916 (Target_x86_64::tls_base_symbol_defined_): New field.
5917 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5918 (Target_x86_64::Scan::global): Likewise.
5920 2008-04-16 Cary Coutant <ccoutant@google.com>
5922 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5923 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5924 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5925 building shared libraries.
5926 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5927 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5928 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5929 * testsuite/Makefile.in: Rebuild.
5930 * testsuite/weak_undef.h: New file.
5931 * testsuite/weak_undef_file1.cc: Add extra test cases.
5932 * testsuite/weak_undef_file2.cc: Likewise.
5933 * testsuite/weak_undef_test.cc: Likewise.
5935 2008-04-16 David S. Miller <davem@davemloft.net>
5937 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5938 Add issued_non_pic_error_ field. Declare check_non_pic.
5939 (Target_sparc::Scan::check_non_pic): New function.
5940 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5941 (Target_sparc::Scan::global): Likewise.
5943 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5944 * configure: Rebuild.
5946 * options.h (DEFINE_enable): New macro.
5947 (new_dtags): New enable option.
5948 (initfirst, interpose, loadfltr, nodefaultlib,
5949 nodelete, nodlopen, nodump): New -z options.
5950 * layout.cc (Layout:finish_dynamic_section): If new
5951 dtags enabled, emit DT_RUNPATH. Also, emit a
5952 DT_FLAGS_1 containing any specified -z flags.
5954 2008-04-16 Ian Lance Taylor <iant@google.com>
5956 * copy-relocs.cc: New file.
5957 * copy-relocs.h: New file.
5958 * reloc.cc: Remove Copy_relocs code.
5959 * reloc.h: Likewise.
5960 * reloc-types.h (struct Reloc_types) [both versions]: Add
5961 get_reloc_addend_noerror.
5962 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5963 variants of add_global which take an addend which must be zero.
5964 * i386.cc: Include "copy-relocs.h".
5965 (class Target_i386): Change type of copy_relocs_ to variable,
5967 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5969 (Target_i386::do_finalize_sections): Change handling of
5971 * sparc.cc: Include "copy-relocs.h".
5972 (class Target_sparc): Change type of copy_relocs_ to variable,
5974 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5976 (Target_sparc::do_finalize_sections): Change handling of
5978 * x86_64.cc: Include "copy-relocs.h".
5979 (class Target_x86_64): Change type of copy_relocs_ to variable,
5981 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5982 class. Change all callers.
5983 (Target_x86_64::do_finalize_sections): Change handling of
5985 * Makefile.am (CCFILES): Add copy-relocs.cc.
5986 (HFILES): Add copy-relocs.h.
5988 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5990 * testsuite/script_test_4.sh: Permit leading zeroes.
5992 2008-04-15 Ian Lance Taylor <iant@google.com>
5994 * script-sections.cc (Script_sections::create_segments): Use
5995 header_size_adjustment even when there is enough room for the
5997 * testsuite/script_test_4.sh: New file.
5998 * testsuite/script_test_4.t: New file.
5999 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
6000 (check_DATA): Add script_test_4.stdout.
6001 (MOSTLYCLEANFILES): Likewise.
6002 (script_test_4): New target.
6003 (script_test_4.stdout): New target.
6004 * testsuite/Makefile.in: Rebuild.
6006 * sparc.cc: Add definitions for Output_data_plt_sparc class
6009 2008-04-14 David S. Miller <davem@davemloft.net>
6011 * sparc.cc: New file.
6012 * Makefile.am (TARGETSOURCES): Add sparc.cc
6013 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
6014 * configure.tgt: Document targ_extra_size and
6015 targ_extra_big_endian. Add entries for sparc-* and
6017 * configure.ac: Handle targ_extra_size and
6018 targ_extra_big_endian.
6019 * Makefile.in: Rebuild.
6020 * configure: Likewise.
6021 * po/POTFILES.in: Likewise.
6022 * po/gold.pot: Likewise.
6024 2008-04-14 Ian Lance Taylor <iant@google.com>
6026 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
6027 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
6028 in the name/type/flags to section mapping. Don't call
6029 allocate_output_section.
6030 (Layout::choose_output_section): Change parameter from adjust_name
6031 to is_input_section. Don't permit input sections after sections
6032 are attached to segments. Don't call allocate_output_section.
6033 (Layout::layout_eh_frame): Call update_flags_for_input_section,
6034 not write_enable_output_section.
6035 (Layout::make_output_section): Don't push to
6036 unattached_section_list_ nor call attach_to_segment. Call
6037 attach_section_to_segment if sections are attached.
6038 (Layout::attach_sections_to_segments): New function.
6039 (Layout::attach_section_to_segment): New function.
6040 (Layout::attach_allocated_section_to_segment): Rename from
6041 attach_to_segment. Remove flags parameter.
6042 (Layout::allocate_output_section): Remove function.
6043 (Layout::write_enable_output_section): Remove function.
6044 * layout.h (class Layout): Update for above changes. Add new
6045 field sections_are_attached_.
6046 * output.h (Output_section::update_flags_for_input_section): New
6048 * output.cc (Output_section::add_input_section): Call
6049 update_flags_for_input_section.
6050 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
6052 2008-04-11 Cary Coutant <ccoutant@google.com>
6054 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
6055 thought unnecessary.
6056 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
6058 2008-04-11 Ian Lance Taylor <iant@google.com>
6060 * output.h (class Output_section_data): Remove inline definition
6062 * output.cc (Output_section_data::set_addralign): New function.
6064 2008-04-11 Cary Coutant <ccoutant@google.com>
6066 Add support for TLS descriptors for i386 and x86_64.
6067 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
6068 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
6069 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
6071 (Target_i386::got_mod_index_entry): Remove unnecessary code.
6072 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
6073 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
6075 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
6076 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
6077 Fix problem with initial-exec relocations.
6078 (Target_i386::Relocate::relocate_tls): Likewise.
6079 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
6081 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
6082 support for section-plus-offset dynamic table entries.
6083 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
6084 (Output_data_dynamic::Dynamic_entry): Add support for
6085 section-plus-offset dynamic table entries.
6086 (Output_data_dynamic::Classification): Likewise.
6087 (Output_data_dynamic::classification_): Renamed offset_.
6088 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
6089 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
6090 (Target_x86_64::make_plt_section): New function.
6091 (Target_x86_64::reserve_tlsdesc_entries): New function.
6092 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
6093 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
6094 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
6095 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
6096 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
6097 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
6098 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
6099 add extra PLT entry for TLS descriptors.
6100 (Output_data_plt_x86_64::got_): New field.
6101 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
6102 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
6104 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
6106 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
6107 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
6108 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
6109 R_386_TLS_DESC_CALL relocations.
6110 (Target_x86_64::Scan::global): Likewise.
6111 (Target_x86_64::do_finalize_sections): Add dynamic table entries
6112 for TLS descriptors.
6113 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
6114 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
6115 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
6116 GD-to-IE relaxation.
6117 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
6118 and TLS_DESCRIPTORS.
6119 * Makefile.in: Rebuild.
6120 * configure: Rebuild.
6121 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
6122 (tls_test_shared2.so): New target.
6123 (tls_shared_gd_to_ie_test_SOURCES): New variable.
6124 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
6125 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
6126 (tls_shared_gd_to_ie_test_LDADD): New variable.
6127 (tls_shared_gnu2_gd_to_ie_test): New target.
6128 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
6130 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
6131 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
6132 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
6133 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
6134 (tls_shared_gnu2_test): New target.
6135 (tls_test_gnu2_shared.so): New target.
6136 (tls_shared_gnu2_test_SOURCES): New variable.
6137 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
6138 (tls_shared_gnu2_test_LDFLAGS): New variable.
6139 (tls_shared_gnu2_test_LDADD): New variable.
6140 * testsuite/Makefile.in: Rebuild.
6141 * testsuite/Makefile.
6143 2008-04-11 Ian Lance Taylor <iant@google.com>
6145 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
6147 * testsuite/Makefile.in: Rebuild.
6149 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
6151 * testsuite/script_test_2.cc (main): Adjust test.
6153 2008-04-11 David S. Miller <davem@davemloft.net>
6154 Ian Lance Taylor <iant@google.com>
6156 * options.h (General_options): Add entries for '-Y' and
6158 * options.cc (General_options:finalize): If -Y was used, add those
6159 entries to the library path instead of the default "/lib" and
6162 2008-04-11 David S. Miller <davem@davemloft.net>
6164 * testsuite/justsyms.t: Start at 0x100.
6165 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
6166 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
6168 * testsuite/script_test_2.cc: Adjust string and section length
6171 2008-04-09 Ian Lance Taylor <iant@google.com>
6174 * script-sections.cc (Sections_element::allocate_to_segment): Add
6176 (Output_section_definition::allocate_to_segment): Likewise.
6177 (Orphan_output_section::allocate_to_segment): Likewise.
6178 (Script_sections::attach_sections_using_phdrs_clause): Don't
6179 propagate non-PT_LOAD segments to orphan sections.
6180 * testsuite/Makefile.am (script_test_3.stdout): Generate using
6181 readelf rather than objdump.
6182 * testsuite/script_test_3.sh: Adjust accordingly. Test that
6183 .interp section and PT_INTERP segment are the same size.
6184 * testsuite/Makefile.in: Rebuild.
6186 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
6187 aliases for symbols defined in the same object.
6188 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
6189 (weak_alias_test_SOURCES): New variable.
6190 (weak_alias_test_DEPENDENCIES): New variable.
6191 (weak_alias_test_LDFLAGS): New variable.
6192 (weak_alias_test_LDADD): New variable.
6193 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
6194 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
6195 (weak_alias_test_3.o): New target.
6196 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
6197 * testsuite/weak_alias_test_main.cc: New file.
6198 * testsuite/weak_alias_test_1.cc: New file.
6199 * testsuite/weak_alias_test_2.cc: New file.
6200 * testsuite/weak_alias_test_3.cc: New file.
6202 2008-04-08 Ian Lance Taylor <iant@google.com>
6204 * options.h (class General_options): Add --noinhibit-exec option.
6205 * main.cc (main): Check --noinhibit-exec.
6207 * options.h (class General_options): Define --wrap as a special
6208 option. Add wrap_symbols_ field.
6209 (General_options::any_wrap_symbols): New function.
6210 (General_options::is_wrap_symbol): New function.
6211 * options.cc (General_options::parse_wrap): New function.
6212 (General_options::General_options): Initialize wrap_symbols_.
6213 * symtab.cc (Symbol_table::wrap_symbol): New function.
6214 (Symbol_table::add_from_object): Handle --wrap.
6215 * symtab.h (class Symbol_table): Declare wrap_symbol.
6216 * target.h (Target::wrap_char): New function.
6217 (Target::Target_info): Add wrap_char field.
6218 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6219 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6220 * testsuite/testfile.cc (Target_test::test_target_info):
6223 * errors.cc (Errors::undefined_symbol): Mention symbol version if
6226 * layout.h (class Layout): Add added_eh_frame_data_ field.
6227 * layout.cc (Layout::Layout): Initialize new field.
6228 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6229 output section until we find a section we merged successfully.
6230 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6231 that the size be non-zero.
6233 * merge.cc (Object_merge_map::get_output_offset): Remove inline
6236 2008-04-08 Craig Silverstein <csilvers@google.com>
6238 * configure.ac: Export new conditional variable HAVE_ZLIB.
6239 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6241 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6242 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6244 2008-04-07 Ian Lance Taylor <iant@google.com>
6246 * version.cc (version_string): Set to "1.5".
6248 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6249 Add issued_non_pic_error_ field. Declare check_non_pic.
6250 (Target_x86_64::Scan::check_non_pic): New function.
6251 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6252 (Target_x86_64::Scan::global): Likewise.
6254 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6255 addend parameter. Change caller. Handle merge sections.
6256 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6257 Address to Addend. Don't add in the result of
6258 local_section_offset, pass down the addend and use the returned
6260 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6261 Update declarations of local_section_offset and symbol_value.
6262 * testsuite/two_file_test_1.cc (t18): New function.
6263 * testsuite/two_file_test_2.cc (f18): New function.
6264 * testsuite/two_file_test_main.cc (main): Call t18.
6265 * testsuite/two_file_test.h (t18, f18): Declare.
6267 * configure.ac: Don't test for objdump, c++filt, or readelf.
6268 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6270 (TEST_READELF): New variable.
6271 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6272 (check_PROGRAMS): Add two_file_strip_test.
6273 (two_file_strip_test): New target.
6274 (check_PROGRAMS): Add two_file_same_shared_strip_test.
6275 (two_file_same_shared_strip_test_SOURCES): New variable.
6276 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6277 (two_file_same_shared_strip_test_LDFLAGS): New variable.
6278 (two_file_same_shared_strip_test_LDADD): New variable.
6279 (two_file_shared_strip.so): New target.
6280 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6281 (ver_test_5.syms, ver_test_7.syms): Likewise.
6282 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6283 (strip_test_3.stdout): Use TEST_OBJDUMP.
6284 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6286 2008-04-04 Cary Coutant <ccoutant@google.com>
6288 * symtab.h (Symbol::is_weak_undefined): New function.
6289 (Symbol::is_strong_undefined): New function.
6290 (Symbol::is_absolute): New function.
6291 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6292 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6294 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6295 (weak_undef_test): New target.
6296 * testsuite/Makefile.in: Rebuild.
6297 * testsuite/weak_undef_file1.cc: New file.
6298 * testsuite/weak_undef_file2.cc: New file.
6299 * testsuite/weak_undef_test.cc: New file.
6301 2008-04-03 Craig Silverstein <csilvers@google.com>
6303 * compressed_output.h (class Output_compressed_section): Use
6305 * compressed_output.cc (zlib_compress): Use unsigned buffers,
6307 (zlib_compressed_suffix): Removed.
6308 (Output_compressed_section::set_final_data_size): Use unsigned
6310 * testsuite/Makefile.am (flagstest_compress_debug_sections):
6311 Fix linker invocation.
6312 (flagstest_o_specialfile_and_compress_debug_sections):
6314 * testsuite/Makefile.in: Regenerated.
6316 2008-04-02 David S. Miller <davem@davemloft.net>
6318 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6319 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6321 2008-04-02 Craig Silverstein <csilvers@google.com>
6325 2008-04-02 Ian Lance Taylor <iant@google.com>
6327 * fileread.cc (File_read::find_view): Add byteshift and vshifted
6328 parameters. Update for new key type to views_. Change all
6330 (File_read::read): Adjust for byteshift in returned view.
6331 (File_read::add_view): New function, broken out of
6333 (File_read::make_view): New function, broken out of
6335 (File_read::find_or_make_view): Add offset and aligned
6336 parameters. Rewrite accordingly. Change all callers.
6337 (File_read::get_view): Add offset and aligned parameters. Adjust
6338 for byteshift in return value.
6339 (File_read::get_lasting_view): Likewise.
6340 * fileread.h (class File_read): Update declarations.
6341 (class File_read::View): Add byteshift_ field. Add byteshift to
6342 constructor. Add byteshift method.
6343 * archive.h (Archive::clear_uncached_views): New function.
6344 (Archive::get_view): Add aligned parameter. Change all callers.
6345 * object.h (Object::get_view): Add aligned parameter. Change all
6347 (Object::get_lasting_view): Likewise.
6349 * fileread.cc (File_read::release): Don't call clear_views if
6350 there are multiple objects.
6351 * fileread.h (File_read::clear_uncached_views): New function.
6352 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6355 2008-03-31 Cary Coutant <ccoutant@google.com>
6357 Add thin archive support.
6358 * archive.cc (Archive::armagt): New const.
6359 (Archive::setup): Remove task parameter and calls to unlock.
6360 (Archive::unlock_nested_archives): New function.
6361 (Archive::read_header): Add nested_off parameter. Change
6363 (Archive::interpret_header): Likewise.
6364 (Archive::include_all_members): Change to handle thin
6366 (Archive::include_member): Likewise.
6367 * archive.h (Archive::Archive): Add new parameters and
6369 (Archive::armagt): New const.
6370 (Archive::setup): Remove task parameter.
6371 (Archive::unlock_nested_archives): New function.
6372 (Archive::read_header): Add nested_off parameter.
6373 (Archive::interpret_header): Likewise.
6374 (Archive::Nested_archive_table): New typedef.
6375 (Archive::is_thin_archive_): New field.
6376 (Archive::nested_archives_): New field.
6377 (Archive::options_): New field.
6378 (Archive::dirpath_): New field.
6379 (Archive::task_): New field.
6380 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6381 for thin archives. Pass additional parameters to
6382 Archive::Archive. Unlock the archive file after calling
6385 2008-03-29 Ian Lance Taylor <iant@google.com>
6387 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6388 version symbol to be local.
6389 * testsuite/ver_test_4.sh: New file.
6390 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6391 (check_DATA): Add ver_test_4.syms.
6392 (ver_test_4.syms): New target.
6393 * testsuite/Makefile.in: Rebuild.
6396 (Output_section::Input_section_sort_entry::has_priority): New
6398 (Output_section::Input_section_sort_entry::match_file_name): New
6400 (Output_section::Input_section_sort_entry::match_section_name):
6402 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6404 (Output_section::Input_section_sort_entry::match_section_file):
6406 (Output_section::Input_section_sort_compare::operator()): Rewrite
6407 using new Input_section_sort_entry functions. Sort crtbegin and
6408 crtend first. Sort sections with no priority before sections with
6410 * testsuite/initpri1.c (d3): Check j != 4.
6411 (cd5): New constructor/destructor function.
6412 (main): Check j != 2.
6414 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6415 new symbol when resolving, don't call set_is_default.
6416 * testsuite/ver_test_7.cc: New file.
6417 * testsuite/ver_test_7.sh: New file.
6418 * testsuite/Makefile.am (ver_test_7.so): New target.
6419 (ver_test_7.o): New target.
6420 (check_SCRIPTS): Add ver_test_7.sh.
6421 (check_DATA): Add ver_test_7.syms.
6422 (ver_test_7.syms): New target.
6424 2008-03-28 Ian Lance Taylor <iant@google.com>
6426 * layout.cc (Layout::layout): If we see an input section with a
6427 name that needs sorting, set the must_sort flag for the output
6429 (Layout::make_output_section): If the name of the output section
6430 indicates that it might require sorting, set the may_sort flag.
6431 * output.h (Output_section::may_sort_attached_input_sections): New
6433 (Output_section::set_may_sort_attached_input_sections): New
6435 (Output_section::must_sort_attached_input_sections): New
6437 (Output_section::set_must_sort_attached_input_sections): New
6439 (class Output_section): Declare Input_section_sort_entry. Define
6440 Input_section_sort_compare. Declare
6441 sort_attached_input_sections. Add new fields:
6442 may_sort_attached_input_sections_,
6443 must_sort_attached_input_sections_,
6444 attached_input_sections_are_sorted_.
6445 * output.cc (Output_section::Output_section): Initialize new
6447 (Output_section::add_input_section): Add an entry to
6448 input_sections_ if may_sort or must_sort are true.
6449 (Output_section::set_final_data_size): Call
6450 sort_attached_input_sections if necessary.
6451 (Output_section::Input_section_sort_entry): Define new class.
6452 (Output_section::Input_section_sort_compare::operator()): New
6454 (Output_section::sort_attached_input_sections): New function.
6455 * configure.ac: Check whether the compiler supports constructor
6456 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6457 * testsuite/initpri1.c: New file.
6458 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6459 CONSTRUCTOR_PRIORITY.
6460 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6461 (initpri1_LDFLAGS): New variable.
6462 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6464 2008-03-27 Ian Lance Taylor <iant@google.com>
6466 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6467 * testsuite/common_test_1.c: New file.
6468 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6469 (common_test_1_SOURCES): New variable.
6470 (common_test_1_DEPENDENCIES): New variable.
6471 (common_test_1_LDFLAGS): New variable.
6473 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6474 and commons_ correctly when NAME/VERSION does not override
6476 * testsuite/ver_test_6.c: New file.
6477 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6478 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6479 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6481 2008-03-26 Ian Lance Taylor <iant@google.com>
6483 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6484 of an undefined symbol from a version script.
6485 * testsuite/Makefile.am (ver_test_5.so): New target.
6486 (ver_test_5.o): New target.
6487 (check_SCRIPTS): Add ver_test_5.sh.
6488 (check_DATA): Add ver_test_5.syms.
6489 (ver_test_5.syms): New target.
6490 * testsuite/ver_test_5.cc: New file.
6491 * testsuite/ver_test_5.script: New file.
6492 * testsuite/ver_test_5.sh: New file.
6493 * Makefile.in, testsuite/Makefile.in: Rebuild.
6496 Fix problems building gold with gcc 4.3.0.
6497 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6498 (gold_error_at_location, gold_warning_at_location): Use it.
6499 * configure.ac: Check whether we can compile and use a template
6500 function with a printf attribute.
6501 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6502 when jumping over bytes.
6503 * object.cc: Instantiate Object::read_section_data.
6504 * debug.h: Include <cstring>
6505 * dwarf_reader.cc: Include <algorithm>
6506 * main.cc: Include <cstring>.
6507 * options.cc: Include <cstring>.
6508 * output.cc: Include <cstring>.
6509 * script.cc: Include <cstring>.
6510 * script.h: Include <string>.
6511 * symtab.cc: Include <cstring> and <algorithm>.
6512 * target-select.cc: Include <cstring>.
6513 * version.cc: Include <string>.
6514 * testsuite/testmain.cc: Include <cstdlib>.
6515 * configure, config.in: Rebuild.
6517 2008-03-25 Ian Lance Taylor <iant@google.com>
6519 * options.cc: Include "../bfd/bfdver.h".
6520 (options::help): Print bug reporting address.
6522 * version.cc (print_version): Adjust output for current value of
6527 * options.cc (options::help): Print list of supported targets.
6528 * target-select.h: Include <vector>.
6529 (class Target_selector): Make machine_, size_, and is_big_endian_
6530 fields const. Add bfd_name_ and instantiated_target_ fields.
6531 (Target_selector::Target_selector): Add bfd_name parameter.
6532 (Target_selector::recognize): Make non-virtual, call
6534 (Target_selector::recognize_by_name): Make non-virtual, call
6535 do_recognize_by_name.
6536 (Target_selector::supported_names): New function.
6537 (Target_selector::bfd_name): New function.
6538 (Target_selector::do_instantiate_target): New pure virtual
6540 (Target_selector::do_recognize): New virtual function.
6541 (Target_selector::do_recognize_by_name): New virtual function.
6542 (Target_selector::instantiate_target): New private function.
6543 (supported_target_names): Declare.
6544 * target-select.cc (Target_selector::Target_selector): Update for
6545 new parameter and fields.
6546 (select_target_by_name): Check that the name matches before
6547 calling recognize_by_name.
6548 (supported_target_names): New function.
6549 * i386.cc (class Target_selector_i386): Update Target_selector
6550 constructor call. Remove recognize and recognize_by_name. Add
6551 do_instantiate_target.
6552 * x86_64.cc (class Target_selector_x86_64): Likewise.
6553 * testsuite/testfile.cc (class Target_selector_test): Update for
6554 changes to Target_selector.
6556 * README: Rewrite, with some notes on unsupported features.
6558 2008-03-24 Cary Coutant <ccoutant@google.com>
6560 * i386.cc (Target_i386::Got_type): New enum declaration.
6561 (Target_i386::Scan::local): Updated callers of Output_data_got
6563 (Target_i386::Scan::global): Likewise.
6564 (Target_i386::Relocate::relocate): Likewise.
6565 (Target_i386::Relocate::relocate_tls): Likewise.
6566 * object.h (Got_offset_list): New class.
6567 (Sized_relobj::local_has_got_offset): Added got_type parameter.
6568 (Sized_relobj::local_got_offset): Likewise.
6569 (Sized_relobj::set_local_got_offset): Likewise.
6570 (Sized_relobj::local_has_tls_got_offset): Removed.
6571 (Sized_relobj::local_tls_got_offset): Removed.
6572 (Sized_relobj::set_local_tls_got_offset): Removed.
6573 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6574 * output.cc (Output_data_got::add_global): Added got_type parameter.
6575 (Output_data_got::add_global_with_rel): Likewise.
6576 (Output_data_got::add_global_with_rela): Likewise.
6577 (Output_data_got::add_global_pair_with_rel): New function.
6578 (Output_data_got::add_global_pair_with_rela): New function.
6579 (Output_data_got::add_local): Added got_type parameter.
6580 (Output_data_got::add_local_with_rel): Likewise.
6581 (Output_data_got::add_local_with_rela): Likewise.
6582 (Output_data_got::add_local_pair_with_rel): New function.
6583 (Output_data_got::add_local_pair_with_rela): New function.
6584 (Output_data_got::add_global_tls): Removed.
6585 (Output_data_got::add_global_tls_with_rel): Removed.
6586 (Output_data_got::add_global_tls_with_rela): Removed.
6587 (Output_data_got::add_local_tls): Removed.
6588 (Output_data_got::add_local_tls_with_rel): Removed.
6589 (Output_data_got::add_local_tls_with_rela): Removed.
6590 * output.h (Output_data_got::add_global): Added got_type parameter.
6591 (Output_data_got::add_global_with_rel): Likewise.
6592 (Output_data_got::add_global_with_rela): Likewise.
6593 (Output_data_got::add_global_pair_with_rel): New function.
6594 (Output_data_got::add_global_pair_with_rela): New function.
6595 (Output_data_got::add_local): Added got_type parameter.
6596 (Output_data_got::add_local_with_rel): Likewise.
6597 (Output_data_got::add_local_with_rela): Likewise.
6598 (Output_data_got::add_local_pair_with_rel): New function.
6599 (Output_data_got::add_local_pair_with_rela): New function.
6600 (Output_data_got::add_global_tls): Removed.
6601 (Output_data_got::add_global_tls_with_rel): Removed.
6602 (Output_data_got::add_global_tls_with_rela): Removed.
6603 (Output_data_got::add_local_tls): Removed.
6604 (Output_data_got::add_local_tls_with_rel): Removed.
6605 (Output_data_got::add_local_tls_with_rela): Removed.
6606 * resolve.cc (Symbol::override_base_with_special): Removed
6607 reference to has_got_offset_ field.
6608 * symtab.cc (Symbol::init_fields): Replaced initialization
6609 of got_offset_ with got_offsets_. Removed initialization
6611 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6612 (Symbol::got_offset): Likewise.
6613 (Symbol::set_got_offset): Likewise.
6614 (Symbol::has_tls_got_offset): Removed.
6615 (Symbol::tls_got_offset): Removed.
6616 (Symbol::set_tls_got_offset): Removed.
6617 (Symbol::got_offset_): Removed.
6618 (Symbol::tls_mod_got_offset_): Removed.
6619 (Symbol::tls_pair_got_offset_): Removed.
6620 (Symbol::got_offsets_): New field.
6621 (Symbol::has_got_offset): Removed.
6622 (Symbol::has_tls_mod_got_offset): Removed.
6623 (Symbol::has_tls_pair_got_offset): Removed.
6624 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6625 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6627 (Target_x86_64::Scan::global): Likewise.
6628 (Target_x86_64::Relocate::relocate): Likewise.
6629 (Target_x86_64::Relocate::relocate_tls): Likewise.
6631 2008-03-25 Ben Elliston <bje@au.ibm.com>
6633 * yyscript.y: Fix spelling error in comment.
6635 2008-03-24 Ian Lance Taylor <iant@google.com>
6637 * options.h (class General_options): Define build_id option.
6638 * layout.h (class Layout): Declare write_build_id, create_note,
6639 create_build_id. Add build_id_note_ member.
6640 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6641 "libiberty.h", "md5.h", "sha1.h".
6642 (Layout::Layout): Initialize eh_frame_data_,
6643 eh_frame_hdr_section_, and build_id_note_.
6644 (Layout::finalize): Call create_build_id.
6645 (Layout::create_note): New function, broken out of
6646 Layout::create_gold_note.
6647 (Layout::create_gold_note): Call create_note.
6648 (Layout::create_build_id): New function.
6649 (Layout::write_build_id): New function.
6650 (Close_task_runner::run): Call write_build_id.
6652 * x86_64.cc: Correct license to GPLv3.
6654 2008-03-23 Ian Lance Taylor <iant@google.com>
6656 * options.cc: Include "demangle.h".
6657 (parse_optional_string): New function.
6658 (parse_long_option): Handle takes_optional_argument.
6659 (parse_short_option): Update dash_z initializer. Handle
6660 takes_optional_argument.
6661 (General_options::General_options): Initialize do_demangle_.
6662 (General_options::finalize): Set do_demangle_. Handle demangling
6664 * options.h (parse_optional_string): Declare.
6665 (struct One_option): Add optional_arg field. Update constructor.
6666 Update call constructor calls. Add takes_optional_argument
6668 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6669 (DEFINE_optional_string): Define.
6670 (General_options::demangle): Change from DEFINE_bool to
6671 DEFINE_optional_string.
6672 (General_options::no_demangle): New function.
6673 (General_options::do_demangle): New function.
6674 (General_options::set_do_demangle): New function.
6675 (General_options::execstack_status_): Move definition to end of
6677 (General_options::static_): Likewise.
6678 (General_options::do_demangle_): New field.
6679 * object.cc (big_endian>::get_symbol_location_info): Call
6680 Options::do_demangle, not Options::demangle.
6681 * symtab.cc (demangle): Likewise.
6683 2008-03-22 Ian Lance Taylor <iant@google.com>
6685 * gold.h: Include <cstddef> and <sys/types.h>
6686 * options.h: Include <cstring>.
6688 2008-03-21 Ian Lance Taylor <iant@google.com>
6690 * Added source code to GNU binutils.