1 2010-02-02 Doug Kwan <dougkwan@google.com>
3 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4 types of relaxed input section.
6 2010-02-02 Doug Kwan <dougkwan@google.com>
8 * Makefile.am (HFILES): Add arm-reloc-property.h.
10 (TARGETSOURCES): Add arm-reloc-property.cc
11 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
12 (libgold_a_SOURCES): $(DEFFILES)
13 * Makefile.in: Regenerate.
14 * arm-reloc-property.cc: New file.
15 * arm-reloc-property.h: New file.
16 * arm-reloc.def: New file.
17 * arm.cc: Update comments.
18 (arm-reloc-property.h): New included header.
19 (arm_reloc_property_table): New global variable.
20 (Target_arm::do_select_as_default_target): New method definition.
21 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
22 arm-reloc-property to targ_extra_obj.
23 * parameters.cc (set_parameters_target): Call
24 Target::select_as_default_target().
25 * target.h (Target::select_as_default_target): New method definition.
26 (Target::do_select_as_default_target): Same.
28 2010-02-01 Doug Kwan <dougkwan@google.com>
30 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
31 first_output_text_section_.
32 (Arm_exidx_fixup::first_output_text_section): New method definition.
33 (Arm_exidx_fixup::first_output_text_section_): New data member.
34 (Arm_exidx_fixup::process_exidx_section): Record the first text
36 (Arm_output_section::fix_exidx_coverage): Set correct linked section
37 and entsize in output section header.
39 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
41 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
42 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
43 (Arm_relocate_functions::thm_alu11): New Method.
44 (Arm_relocate_functions::thm_pc8): New Method.
45 (Arm_relocate_functions::thm_pc12): New Method.
46 (Target_arm::Scan::local): Handle the relocations.
47 (Target_arm::Scan::global): Likewise.
48 (Target_arm::Relocate::relocate): Likewise.
49 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
51 2010-01-29 Doug Kwan <dougkwan@google.com>
53 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
54 of relocation types as ld.
56 2010-01-29 Doug Kwan <dougkwan@google.com>
58 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
60 (Arm_relocate_functions::thumb_branch_common): Ditto.
61 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
62 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
63 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
64 Arm_relocate_functions::jump24): Remove.
65 (Target_arm::Relocate::relocate): Adjust code to call
66 Arm_relocation_functions::arm_branch_common and
67 Arm_relocation_functions::thumb_branch_common instead of their removed
68 wrappers. Merge switch-cases together to reduce source code size.
70 2010-01-29 Doug Kwan <dougkwan@google.com>
72 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
73 output_local_symbol_count_needs_update_.
74 (Arm_relobj::output_local_symbol_count_needs_update,
75 Arm_relobj::set_output_local_symbol_count_needs_update,
76 Arm_relobj::update_output_local_symbol_count): New methods.
77 (Arm_relobj::output_local_symbol_count_needs_update_): New data
79 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
80 of pointed function as in a R_ARM_PREL31 relocation.
81 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
82 for output local symbol count updating.
83 (Target_arm::do_relax): Update output local symbol counts in objects
85 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
87 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
89 * arm.cc: Added support for the ARM relocations:
90 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
91 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
92 (Arm_relocate_functions::movw_rel_nc): Renamed (was
94 (Arm_relocate_functions::movw_rel): New method.
95 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
96 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
98 (Arm_relocate_functions::thm_movw_rel): New method.
99 (Arm_relocate_functions::thm_movt_rel): Renamed (was
101 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
103 (Target_arm::Scan::global): Likewise.
104 (Target_arm::Relocate::relocate): Likewise.
105 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
108 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
110 * arm.cc: Added support for ARM group relocations.
111 (Target_arm::reloc_needs_sym_origin): New method.
112 (Arm_relocate_functions::calc_grp_kn): New method.
113 (Arm_relocate_functions::calc_grp_residual): New method.
114 (Arm_relocate_functions::calc_grp_gn): New method.
115 (Arm_relocate_functions::arm_grp_alu): New Method.
116 (Arm_relocate_functions::arm_grp_ldr): New Method.
117 (Arm_relocate_functions::arm_grp_ldrs): New Method.
118 (Arm_relocate_functions::arm_grp_ldc): New Method.
119 (Target_arm::Scan::local): Handle the ARM group relocations.
120 (Target_arm::Scan::global): Likewise.
121 (Target_arm::Relocate::relocate): Likewise.
122 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
125 2010-01-26 Doug Kwan <dougkwan@google.com>
127 * arm.cc (set): Include.
128 (class Arm_exidx_fixup): Change type of last_input_section_ to const
130 (Arm_output_section::Text_section_list): New type.
131 (Arm_output_section::append_text_sections_to_list): New method.
132 (Arm_output_section::fix_exidx_coverage): Ditto.
133 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
134 (Arm_relobj::convert_input_section_to_relaxed_section): Use
135 Relobj::set_section_offset() instead of
136 Sized_relobj::invalidate_section_offset().
137 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
138 parameter for section headers. Ignore relocation sections for
139 unallocated sections and EXIDX sections.
140 (Target_arm::fix_exidx_coverage): New method.
141 (Target_arm::output_section_address_less_than): New type.
142 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
143 linked text section instead of the EXIDX section.
144 (Arm_output_section::create_stub_group): Add an assertion to check
145 that this is not an EXIDX output section.
146 (Arm_output_section::append_text_sections_to_list): New method.
147 (Arm_output_section::fix_exidx_coverage): Ditto.
148 (Arm_relobj::scan_sections_for_stubs): Adjust call to
149 Arm_relobj::section_needs_reloc_stub_scanning.
150 (Target_arm::do_relax): Fix EXIDX output section coverage in the
152 (Target_arm::fix_exidx_coverage): New method.
153 * object.h (Relobj::set_output_section): New method.
154 (Sized_relobj::invalidate_section_offset): Remove method.
155 (Sized_relobj::do_invalidate_section_offset): Remove method.
156 (Sized_relobj::do_set_section_offset): Handle offset value -1.
158 2010-01-25 Doug Kwan <dougkwan@google.com>
160 * arm.cc (Arm_exidx_merged_section::do_output_offset):
161 Fix warning due to signed and unsigned comparison on a 32-bit host.
163 2010-01-22 Doug Kwan <dougkwan@google.com>
165 * arm.cc (Target_arm::do_relax): Record an output section for section
166 offset adjustment it contains any stub table that has changed.
167 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
168 offsets in an output section if necessary.
169 * output.cc (Output_section::Output_section): Initialize
170 section_offsets_need_adjustments_.
171 (Output_section::add_input_section_for_script): Renamed to
172 Output_section::add_simple_input_section.
173 (Output_section::save_states): Add a comment.
174 (Output_section::discard_states): New method defintion.
175 (Output_section::adjust_section_offsets): Same.
176 * output.h (Output_section::add_input_section_for_script): Renamed to
177 Output_section::add_simple_input_section.
178 (Output_section::discard_states): New method declaration.
179 (Output_section::adjust_section_offsets): Same.
180 (Output_section::section_offsets_need_adjustment,
181 Output_section::set_section_offsets_need_adjustment): New method
183 (Output_section::section_offsets_need_adjustment_): New data member.
185 (Output_section_element_input::set_section_address): Adjust code for
186 renaming of Output_section::add_input_section_for_script.
187 (Orphan_output_section::set_section_address): Same.
189 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
191 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
192 Fix_v4bx enum values .
193 * gold/options.h (General_options): New option definitions.
194 (General_options::fix_v4bx): New method.
195 (General_options::Fix_v4bx): New enum.
196 * gold/options.cc (General_options::parse_fix_v4bx): New method.
197 (General_options::parse_fix_v4bx_interworking): New method.
199 2010-01-22 Doug Kwan <dougkwan@google.com>
201 * arm.cc (Arm_exidx_fixup): New class.
203 2010-01-21 Doug Kwan <dougkwan@google.com>
205 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
207 (Arm_exidx_section_offset_map): New type.
209 2010-01-21 Doug Kwan <dougkwan@google.com>
211 * arm.cc (Arm_exidx_input_section): New class.
212 (Arm_relobj::exidx_input_section_by_link,
213 Arm_relobj::exidx_input_section_by_shndx,
214 Arm_relobj::make_exidx_input_section): New methods.
215 (read_arm_attributes_section): Remove.
216 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
217 information about them.
218 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
221 2010-01-20 Doug Kwan <dougkwan@google.com>
223 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
224 Input_section_specifier to Section_id.
225 (Target_arm::new_arm_input_section: Adjust code for change of key
227 (Target_arm::find_arm_input_section): Ditto.
228 * gc.h (object.h): Include for Section_id nand Section_id_hash.
229 (Section_id): Remove.
230 (Garbage_collection::Section_id_hash): Remove.
231 * icf.h (object.h): Include for Section_id nand Section_id_hash.
232 (Section_id): Remove.
233 (Icf::Section_id_hash): Remove.
234 * object.h (Section_id, Const_section_id, Section_id_hash,
235 Const_section_id_hash): New type definitions.
236 * output.cc (Output_section::add_relaxed_input_section): Change to
237 use Const_section_id instead of Input_section_specifier as key type.
238 (Output_section::add_merge_input_section): Ditto.
239 (Output_section::build_relaxation_map): Change to use Section_id
240 instead of Input_section_specifier as key type.
241 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
243 (Output_section::convert_input_sections_to_relaxed_sections): Change
244 to use Const_section_id instead of Input_section_specifier as key type.
245 (Output_section::find_merge_section): Ditto.
246 (Output_section::find_relaxed_input_section): Ditto.
247 * output.h (Input_section_specifier): Remove class.
248 (Output_section::Output_section_data_by_input_section_map): Change
249 key type to Const_section_id.
250 (Output_section::Output_relaxed_input_section_by_input_section_map):
252 (Output_section::Relaxation_map): Change key type to Section_id.
254 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
256 * gold/arm.cc: Added support for R_ARM_V4BX relocation
257 (class Arm_v4bx_stub): New class.
258 (DEF_STUBS): Updated definition to support v4_veneer_bx.
259 (Stub_factory::make_arm_v4bx_stub): New method.
260 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
261 (Stub_table::empty): Handle v4bx stubs.
262 (Stub_table::add_arm_v4bx_stub): New method.
263 (Stub_table::find_arm_v4bx_stub): New method.
264 (Arm_relocate_functions::v4bx): New method.
265 (Target_arm::fix_v4bx): New method.
266 (Target_arm::Target_arm): Handle R_ARM_V4BX.
267 (Stub_table::relocate_stubs): Likewise.
268 (Stub_table::do_write): Likewise.
269 (Stub_table::update_data_size_and_addralign): Likewise.
270 (Stub_table::finalize_stubs): Likewise.
271 (Target_arm::Scan::local): Likewise.
272 (Target_arm::Scan::global): Likewise.
273 (Target_arm::do_finalize_sections): Likewise.
274 (Target_arm::Relocate::relocate): Likewise.
275 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
277 (Target_arm::scan_reloc_for_stub): Likewise.
278 (Target_arm::scan_reloc_section_for_stubs): Likewise.
280 2010-01-19 Ian Lance Taylor <iant@google.com>
282 * output.cc (Output_section_headers::do_sized_write): Write large
283 segment count to sh_info field.
284 (Output_file_header::do_sized_write): For large segment count,
285 write PN_XNUM to e_phnum field.
287 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
289 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
290 (Arm_relocate_functions::thm_jump8): New function.
291 (Arm_relocate_functions::thm_jump11): New function.
292 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
294 (Target_arm::Scan::global): Likewise.
295 (Target_arm::Relocate::relocate): Likewise.
296 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
299 2010-01-14 Doug Kwan <dougkwan@google.com>
301 * arm.cc (map, utility): Include headers.
302 (Target_arm::apply_cortex_a8_workaround): New method.
303 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
304 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
305 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
306 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
307 the --[no-]fix-cortex-a8 command line options.
308 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
309 (Target_arm::relocate_stub): Use addend in instruction template.
310 * options.h (DEFINE_bool): Set the user-set flag.
311 (General_options): Add --[no-]-fix-cortex options.
312 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
313 : Update fast look-up map after conversion.
315 2010-01-14 Sriraman Tallam <tmsriram@google.com>
317 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
318 in the first pass of do_layout.
320 2010-01-13 Doug Kwan <dougkwan@google.com>
322 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
323 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
324 apparent compiler problem of not folding static constant integral
325 data members of elfcpp::Elf_sizes<32>.
327 2010-01-13 Doug Kwan <dougkwan@google.com>
329 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
330 Arm_relobj::section_needs_cortex_a8_stub_scanning,
331 Arm_relobj::scan_section_for_cortex_a8_erratum,
332 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
333 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
334 sections to scan for relocation stubs into a new method
335 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
336 relocation and Cortex-A8 stub scanning.
337 (Target_arm::do_relax): Force stubs to be after stubbed sections
338 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
339 the beginning of a new relaxation pass. Update a comment.
340 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
342 2010-01-12 Ian Lance Taylor <iant@google.com>
344 * target-reloc.h (visibility_error): New inline function.
345 (relocate_section): Call visibility_error.
346 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
347 (MOSTLYCLEANFILES): Likewise.
348 (protected_4_pic.o, protected_3.err): New targets.
349 * testsuite/protected_4.cc: New file.
351 2010-01-12 Doug Kwan <dougkwan@google.com>
353 * arm.cc (Cortex_a8_reloc): New class.
354 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
355 and cortex_a8_relocs_info_.
356 (Target_arm::fix_cortex_a8): New method definition.
357 (Target_arm::Cortex_a8_relocs_info): New type.
358 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
359 New data member declarations.
360 (Target_arm::scan_reloc_for_stub): Record information about
361 relocations for THUMB branches that might be exempted from the
362 Cortex-A8 workaround.
363 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
364 at the beginning of a relaxation pass.
366 2010-01-12 Doug Kwan <dougkwan@google.com>
368 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
369 (Arm_relobj::Mapping_symbol_position,
370 Arm_reloj::Mapping_symbol_position_less,
371 Arm_relobj::Mapping_symbols_info): New types.
372 (Target_arm::is_mapping_symbol_name): New method definition.
373 (Arm_relobj::do_count_local_symbols): Save information about mapping
376 2010-01-11 Doug Kwan <dougkwan@google.com>
378 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
379 Arm_relocate_functions::thumb32_branch_upper,
380 Arm_relocate_functions::thumb32_branch_lower,
381 Arm_relocate_functions::thumb32_cond_branch_offset,
382 Arm_relocate_functions::thumb32_cond_branch_upper,
383 Arm_relocate_functions::thumb32_cond_branch_lower,
384 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
385 branch offset encoding.
386 (Arm_relocate_functions::thumb_branch_common): Use new branch
387 offset encoding methods to avoid code duplication.
388 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
389 (Stub_addend_reader::operator()): Use new branch encoding method
390 to avoid code duplication.
392 2010-01-11 Doug Kwan <dougkwan@google.com>
394 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
395 (Target_arm::do_finalize_sections): Define special EXIDX section
396 symbols only if referenced.
397 * gc.h (Garbage_collection::add_reference): New method.
398 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
401 2010-01-11 Ian Lance Taylor <iant@google.com>
403 * script.cc (Version_script_info::build_expression_list_lookup):
404 Change complaing about duplicate wildcard match from error to
407 * script.cc (class Lazy_demangler): Recreate--revert part of patch
409 (Version_script_info::Version_script_info): Initialize globs_,
410 default_version_, default_is_global_, and exact_. Don't
411 initialize globals_ or locals_.
412 (Version_script_info::build_lookup_tables): Build local symbols
414 (Version_script_info::unquote): New function.
415 (Version_script_info::add_exact_match): New function.
416 (Version_script_info::build_expression_list_lookup): Remove lookup
417 parameter. Add is_global parameter. Change all callers. Handle
418 wildcard pattern specially. Unquote pattern. Call
420 (Version_script_info::get_name_to_match): New function.
421 (Version_script_info::get_symbol_version): New function.
422 (Version_script_info::get_symbol_version_helper): Remove.
423 (Version_script_info::check_unmatched_names): Call unquote.
424 * script.h (class Version_script_info): Change get_symbol_version
425 to be non-inline and add is_global parameter; change all callers.
426 Rewrite symbol_is_local. Update declarations. Define struct
427 Version_tree_match, Exact, Globs. Don't define struct Lookup.
428 Remove globals_ and locals_ members. Add exact_, globs_,
429 default_version_, is_global_.
430 (Version_script_info::Glob): Remove pattern, add expression and
431 is_global. Update constructor. Change all callers.
432 * dynobj.cc (Versions::finalize): Mark the version symbol as the
434 (Versions::symbol_section_contents): If a symbol is undefined, or
435 defined in a dynamic object, set the version index to
437 * symtab.cc (Symbol_table::add_from_relobj): Don't call
439 (Symbol_table::add_from_pluginobj): Likewise.
440 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
442 2010-01-11 Doug Kwan <dougkwan@google.com>
444 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
445 (incremental_dump_LDADD): Add linking option for libintl.
446 * Makefile.in: Regenerate.
448 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
451 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
453 * testsuite/Makefile.in: Regenerated.
455 2010-01-10 Doug Kwan <dougkwan@google.com>
457 * options.h (DEFINE_var): Use parentheses around argument varname__
458 in macro body to avoid any unintended subsequent substitutions.
460 2010-01-10 Ian Lance Taylor <iant@google.com>
462 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
463 candidates before doing symbol resolution.
465 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
466 ODR candidates if only one is weak.
468 2010-01-08 Ian Lance Taylor <iant@google.com>
470 * script.cc (Version_script_info::build_expression_list_lookup):
471 Don't warn about ambiguous version, just record the ambiguity.
472 (Version_script_info::get_symbol_version_helper): Give error if
473 version is ambiguous.
475 2010-01-08 Doug Kwan <dougkwan@google.com>
477 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
478 prev_data_size_ and prev_addralign_. Remove initializer for
479 deleted data member has_been_changed_.
480 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
481 to determine if the table is empty.
482 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
484 (Stub_table::add_reloc_stub): Define method in class definition
485 instead of just declaring it there.
486 (Stub_table::add_cortex_a8_stub): New method definition.
487 (Stub_table::update_data_size_and_addralign): Ditto.
488 (Stub_table::finalize_stubs): Ditto.
489 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
490 (Stub_table::do_addralign_): Return address alignment in the
491 (Stub_table::do_reset_address_and_file_offset): Define method in
492 class definition instead of declaring it there. Set current data
493 size to be the data size of the previous pass.
494 (Stub_table::set_final_data_size): Use current data size as the
496 (Stub_table::relocate_stub): Change parameter type of stub from
497 Reloc_stub pointer to Stub pointer.
498 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
499 (Stub_table::Cortex_a8_stub_list): New typedef.
500 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
501 Stub_table::prev_addralign_): New data member.
502 (Arm_relobj::Arm_relobj): Initialize data member
503 section_has_cortex_a8_workaround_.
504 (Arm_relobj::section_has_cortex_a8_workaround,
505 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
507 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
509 (Target_arm::relocate_stub): Change parameter type of stub from
510 Reloc_stub pointer to Stub pointer.
511 (Insn_template::size, Insn_template::alignment): Handle
512 THUMB16_SPECIAL_TYPE.
513 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
514 Stub_table::update_data_size_and_addralign,
515 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
517 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
518 (Stub_table::do_write): Ditto.
519 (Target_arm::do_relax): Adjust code for changes in Stub_table.
521 2010-01-08 Ian Lance Taylor <iant@google.com>
524 * symtab.h (class Symbol): Remove fields is_target_special_ and
525 has_plt_offset_. Add field is_defined_in_discarded_section_.
526 (Symbol::is_defined_in_discarded_section): New function.
527 (Symbol::set_is_defined_in_discarded_section): New function.
528 (Symbol::has_plt_offset): Rewrite.
529 (Symbol::set_plt_offset): Verify that new offset is not -1U.
530 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
531 Don't initialize is_target_special_ or has_plt_offset_.
532 Initialize is_defined_in_discarded_section_.
533 (Symbol_table::add_from_relobj): If appropriate, set
534 is_defined_in_discarded_section.
535 * resolve.cc (Symbol::override_base_with_special): Don't test
536 is_target_special_. Change has_plt_offset_ to has_plt_offset().
537 * target-reloc.h (relocate_section): Do special handling for
538 symbols defined in discarded sections for global symbols as well
541 2010-01-08 Ian Lance Taylor <iant@google.com>
543 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
546 2010-01-08 Ian Lance Taylor <iant@google.com>
548 * object.cc (Sized_relobj::do_layout): Don't get confused if
549 layout_eh_frame returns NULL.
551 2010-01-08 Ian Lance Taylor <iant@google.com>
554 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
555 dynamic symbol table, use the normal symbol table.
556 (Sized_dynobj::do_read_symbols): Remove assertion about type of
559 2010-01-08 Ian Lance Taylor <iant@google.com>
562 * layout.cc (Layout::include_section): Remove .gnu_debuglink
565 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
567 * version.cc (print_version): Change to "Copyright 2010".
569 2010-01-08 Ian Lance Taylor <iant@google.com>
573 * i386.cc (class Target_i386): Change return type of plt_section
575 (class Output_data_plt_i386): Add tls_desc_rel_ field.
576 (Output_data_plt_i386::Output_data_plt_i386): Initialize
578 (Output_data_plt_i386::rel_tls_desc): New function.
579 (Target_i386::rel_tls_desc_section): New function.
580 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
581 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
582 R_386_TLS_DESC reloc in rel_tls_desc_section.
583 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
584 Define struct Tlsdesc_info.
585 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
586 (Target_x86_64::do_reloc_symbol_index): New function.
587 (Target_x86_64::add_tlsdesc_info): New function.
588 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
589 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
591 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
593 (Output_data_plt_x86_64::rela_tlsdesc): New function.
594 (Target_x86_64::rela_tlsdesc_section): New function.
595 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
597 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
598 (Target_x86_64::do_reloc_addend): New function.
599 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
600 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
601 declarations. Define TARGET_CODE. Add arg field to u1_ union.
602 (Output_reloc::type): New function.
603 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
604 (Output_reloc::is_target_specific): New function.
605 (Output_reloc::target_arg): New function.
606 (class Output_reloc) [SHT_RELA]: Add four new constructors for
607 absolute relocs and target specific relocs.
608 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
610 (class Output_data_reloc) [SHT_RELA]: Likewise.
611 * output.cc (Output_reloc::Output_reloc): Add four new versions
612 for absolute relocs and target specific relocs.
613 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
614 (Output_reloc::get_symbol_index): Likewise.
615 (Output_reloc::local_section_offset): Check that local_sym_index_
616 is not TARGET_CODE or 0.
617 (Output_reloc::symbol_value): Likewise.
618 (Output_reloc::write) [SHT_RELA]: Call target for target specific
620 * target.h (class Target): Add reloc_symbol_index and reloc_addend
621 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
623 * layout.cc (add_target_dynamic_tags): Use output section for
624 DT_PLTRELSZ and DT_JMPREL.
626 2010-01-07 Ian Lance Taylor <iant@google.com>
629 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
631 (class Output_data_reloc_generic): Define.
632 (class Output_data_reloc_base): Change base class to
633 Output_data_reloc_generic. Change add() method to call
634 bump_relative_reloc_count for a relative reloc. Remove
636 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
638 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
639 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
641 * layout.h (class Layout): Update declaration.
643 2010-01-07 Ian Lance Taylor <iant@google.com>
645 * output.h (class Output_data): Add const version of
646 output_section and do_output_section.
647 (class Output_section_data): Add const version of
649 (class Output_section): Likewise.
650 * layout.cc (Layout::add_target_dynamic_tags): New function.
651 * layout.h (class Layout): Update declarations.
652 * arm.cc (Target_arm::do_finalize_sections): Use
653 add_target_dynamic_tags.
654 * i386.cc (Target_i386::do_finalize_sections): Likewise.
655 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
656 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
657 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
659 2010-01-07 Ian Lance Taylor <iant@google.com>
662 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
665 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
666 Ian Lance Taylor <iant@google.com>
669 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
670 Xindex::read_symtab_xindex.
672 2010-01-07 Doug Kwan <dougkwan@google.com>
674 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
675 (Insn_template::thumb16_bcond_insn): New method declaration.
676 (Insn_template): Fix spelling.
677 (Stub::thumb16_special): New method declaration.
678 (Stub::do_write): Define virtual method which was previously pure
680 (Stub::do_thumb16_special): New method declaration.
681 (Stub::do_fixed_endian_write): New template member.
682 (Reloc_stub::do_write): Remove.
683 (Reloc_stub::do_fixed_endian_write): Remove.
684 (Cortex_a8_stub): New class definition.
685 (Stub_factory::make_cortex_a8_stub): New method definition.
686 (Stub_factory::Stub_factory): Add missing static storage class
687 qualifier for elf32_arm_stub_a8_veneer_blx.
689 2010-01-07 Ian Lance Taylor <iant@google.com>
692 * options.h (class General_options): Add --warn-unresolved-symbols
693 and --error-unresolved-symbols.
694 * errors.cc (Errors::undefined_symbol): Implement
695 --warn-unresolved-symbols.
697 * options.h (class General_options): Add -z text and -z textoff.
698 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
700 2010-01-06 Sriraman Tallam <tmsriram@google.com>
702 * gc.h (Garbage_collection::Cident_section_map): New typedef.
703 (Garbage_collection::cident_sections): New function.
704 (Garbage_collection::add_cident_section): New function.
705 (Garbage_collection::cident_sections_): New member.
706 (gc_process_relocs): Add references to sections whose names are C
708 * gold.h (cident_section_start_prefix): New constant.
709 (cident_section_stop_prefix): New constant.
710 (is_cident): New function.
711 * layout.cc (Layout::define_section_symbols): Replace string constants
712 with the newly defined constants.
713 * object.cc (Sized_relobj::do_layout): Track sections whose names are
715 * testsuite/Makefile.am: Add gc_orphan_section_test.
716 * testsuite/Makefile.in: Regenerate.
717 * testsuite/gc_orphan_section_test.cc: New file.
718 * testsuite/gc_orphan_section_test.sh: New file.
720 2010-01-06 Ian Lance Taylor <iant@google.com>
723 * options.h (class General_options): Add --warn-shared-textrel.
724 * layout.cc (Layout::finish_dynamic_section): Implement
725 --warn-shared-textrel.
728 * options.h (class General_options): Add --warn-multiple-gp.
730 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
732 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
733 $(THREADSLIB) and $(LIBDL).
734 * Makefile.in: Rebuild.
736 2010-01-06 Ian Lance Taylor <iant@google.com>
739 * options.cc (General_options::parse_section_start): New function.
740 (General_options::section_start): New function.
741 (General_options::General_options): Initialize all members.
742 * options.h: Include <map>
743 (class General_options): Add --section-start. Add section_starts_
745 * layout.cc (Layout::attach_allocated_section_to_segment): If
746 --section-start was used, set the address of the segment. Remove
748 (Layout::relaxation_loop_body): If the address of the load segment
749 has been set by --section-start, don't use it.
750 * output.h (Output_segment::update_flags_for_output_section): New
752 * output.cc (Output_segment::add_output_section): Call
753 update_flags_for_output_section.
755 2010-01-05 Ian Lance Taylor <iant@google.com>
758 * options.h (class General_options): Add --undefined-version.
759 * script.cc (struct Version_expression): Add was_matched_by_symbol
761 (Version_script_info::matched_symbol): New function.
762 (Version_script_info::get_symbol_version_helper): Call
764 (Version_script_info::check_unmatched_names): New function.
765 * script.h (class Version_script_info): Update declarations.
766 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
768 * options.h (class General_options): Use DEFINE_bool_alias for
769 allow_multiple_definition.
770 * resolve.cc (Symbol_table::should_override): Don't test
771 allow_multiple_definition.
774 * options.h (class General_options): Add --cref.
775 * main.cc (main): Print cref table if --cref. Don't close mapfile
776 until after printing cref table.
777 * cref.cc: Include "symtab.h".
778 (class Cref_inputs): Define Cref_table_compare and Cref_table.
779 (Cref_table_compare::operator()): New function.
780 (Cref_inputs::gather_cref): New function.
781 (filecol): New static const.
782 (Cref_inputs::print_cref): New function.
783 (Cref::print_cref): New function.
784 * cref.h: Include <cstdio>.
785 (class Cref): Update declarations.
786 * mapfile.h (Mapfile::file): New function.
787 * object.h (class Object): Define Symbols. Declare virtual
788 do_get_global_symbols.
789 (Object::get_global_symbols): New function.
790 * object.cc (Input_objects::add_object): Pass object to cref_ if
792 (Input_objects::archive_start): Likewise.
793 (Input_objects::archive_stop): Likewise.
794 (Input_objects::print_cref): New function.
795 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
796 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
798 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
800 * plugin.h (class Sized_pluginobj): Update declarations.
802 2010-01-05 Ian Lance Taylor <iant@google.com>
804 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
805 to is_default_version. Rename insdef to insdefault.
806 (Symbol_table::add_from_relobj): Rename def to is_default_version
807 and local to is_forced_local.
808 (Symbol_table::add_from_pluginobj): Likewise.
809 (Symbol_table::add_from_dynobj): Likewise.
810 (Symbol_table::define_special_symbol): Rename insdef to
813 2010-01-04 Ian Lance Taylor <iant@google.com>
816 * options.h (class General_options): Add
817 --allow-multiple-definition and -z muldefs.
818 * resolve.cc (Symbol_table::should_override): Don't warn about a
819 multiple symbol definition if --allow-multiple-definition or -z
823 * options.h (class General_options): Add --add-needed and
824 --copy-dt-needed-entries. Tweak --as-needed help entry.
825 * object.cc (Input_objects::check_dynamic_dependencies): Give an
826 error if --copy-dt-needed-entries aka --add-needed is used and
827 would cause a change in behaviour.
830 * options.h (class General_options): Add -G as a short version of
831 --shared. Add no-op options -assert, -g, and -i.
833 2010-01-04 Sriraman Tallam <tmsriram@google.com>
835 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
836 check for .text or .gnu.linkonce.t sections.
837 * icf.cc (Icf::find_identical_sections): Ditto.
838 Change the detection for mangled function name within the section
840 * icf.h (is_section_foldable_candidate): New function.
842 2009-12-30 Ian Lance Taylor <iant@google.com>
845 * options.h (class General_options): Permit two dashes with
846 --retain-symbols-file.
848 2009-12-30 Ian Lance Taylor <iant@google.com>
851 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
852 don't put the file header and segment headers in the text
856 * common.cc (Sort_commons::operator()): Stabilize sort when both
858 (Symbol_table::do_allocate_commons_list): When allocating common
859 symbols, skip a symbol which is no longer common.
860 * symtab.h (Symbol::is_common): Test whether the symbol comes from
861 an object before checking its type.
862 * testsuite/common_test_2.c: New file.
863 * testsuite/common_test_3.c: New file.
864 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
865 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
866 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
867 (common_test_2_pic.o, common_test_2.so): New targets.
868 (common_test_3_pic.o, common_test_3.so): New targets.
869 * testsuite/Makefile.in: Rebuild.
872 * script.cc (read_input_script): If we see a new SECTIONS clause,
873 and we have added an input section, give an error.
874 * layout.h (class Layout): Add have_added_input_section function.
875 Add have_added_input_section_ field.
876 * layout.cc (Layout::Layout): Initialize
877 have_added_input_section_.
878 (Layout::layout): Set have_added_input_section_.
879 (Layout::layout_eh_frame): Likewise.
881 2009-12-30 Ian Lance Taylor <iant@google.com>
884 * options.h (class General_options): Add --sort-common option.
885 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
886 * common.cc (Sort_common): Add sort_order parameter to
887 constructor. Add sort_order_ field.
888 (Sort_commons::operator): Check sort_order_.
889 (Symbol_table::allocate_commons): Determine the sort order.
890 (Symbol_table::do_allocate_commons): Add sort_order parameter.
892 (Symbol_table::do_allocate_commons_list): Likewise.
894 2009-12-30 Ian Lance Taylor <iant@google.com>
897 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
898 symbols from this object, don't change the visibility of an
900 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
902 2009-12-30 Ian Lance Taylor <iant@google.com>
905 * script.h (class Version_script_info): Define Language enum.
906 Update declarations. Define Glob, Exact, and Lookup types. Add
907 new fields globals_, locals_, and is_finalized_.
908 * script.cc: Various formatting fixes.
909 (class Parser_closure): Change language_stack_ from a vector of
910 std::string to one of Version_script_info::Language. Adjust all
912 (class Lazy_demangler): Remove.
913 (struct Version_expression): Change language from std::string to
914 Version_script_info::Language.
915 (Version_script_info::Version_script_info): New function.
916 (Version_script_info::~Version_script_info): Don't call clear.
917 (Version_script_info::finalize): New function.
918 (Version_script_info::build_lookup_tables): New function.
919 (Version_script_info::build_expression_list_lookup): New
921 (Version_script_info::get_symbol_version_helper): Rewrite to use
923 (Version_script_info::print_expression_list): Adjust to use
924 Version_script_info::Language.
925 (script_push_lex_into_version_mode): Check that the version script
926 has not been finalized.
927 (version_script_push_lang): Change language string to
928 Version_script_info::Language.
929 * options.cc (Command_line::version_script): New function.
930 * options.h (class General_options): Add finalize_dynamic_list
931 function. Change version_script from declaration to definition.
932 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
933 * testsuite/version_script.map: Remove duplicate def of foo.
934 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
936 * testsuite/Makefile.in: Rebuild.
938 2009-12-30 Ian Lance Taylor <iant@google.com>
941 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
942 if the input symbol index is 0, make the output symbol index 0.
944 2009-12-30 Ian Lance Taylor <iant@google.com>
947 * options.h (class General_options): Add -x/--discard-all.
948 * object.cc (Sized_relobj::do_count_local_symbols): Handle
949 --discard-all. If the local symbol needs a dynamic entry, check
950 that before handling --discard-locals.
952 2009-12-30 Ian Lance Taylor <iant@google.com>
955 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
957 (Output_segment::add_output_section): Don't change the flags if
961 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
962 GNU hash table if they need a dynamic value. Otherwise, don't add
963 them if they are defined in a dynamic object or are forced local.
965 2009-12-29 Ian Lance Taylor <iant@google.com>
968 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
969 .gnu.hash table for a 32-bit target.
972 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
973 regular and a dynamic object only needs a dynamic symbol table
974 entry if it is externally visible.
977 * i386.cc (class Target_i386): Initialize global_offset_table_ in
978 constructor. Add global_offset_table_ field.
979 (Target_i386::got_section): Set global_offset_table_.
980 (Target_i386::do_finalize_sections): Set global_offset_table_
982 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
983 in constructor. Add global_offset_table_ field.
984 (Target_x86_64::got_section): Set global_offset_table_.
985 (Target_x86_64::do_finalize_sections): Set global_offset_table_
988 * layout.cc (Layout::Layout): Initialize increase_relro_.
989 (Layout::get_output_section): Add is_relro, is_last_relro, and
990 is_first_non_relro parameters. Change all callers.
991 (Layout::choose_output_section): Likewise.
992 (Layout::add_output_section_data): Likewise.
993 (Layout::make_output_section): Likewise.
994 (Layout::set_segment_offsets): Clear increase_relro when using a
996 * layout.h (class Layout): Add increase_relro method. Add
997 increase_relro_ field. Update declarations.
998 * output.cc (Output_section::Output_section): Initialize
999 is_last_relro_ and is_first_non_relro_.
1000 (Output_segment::add_output_section): Group relro sections is
1001 do_sort is true. Handle is_last_relro and is_first_non_relro.
1002 (Output_segment::maximum_alignment): Remove relro handling.
1003 (Output_segment::set_section_addresses): Add increase_relro
1004 parameter. Change all callers. Add initial alignment to align
1005 relro sections on separate page. Remove old relro handling.
1006 (Output_segment::set_section_list_addresses): Remove in_relro
1007 parameter. Change all callers.
1008 (Output_segment::set_offset): Add increase parameter. Change all
1009 callers. Remove old relro handling.
1010 * output.h (class Output_section): Add new methods: is_last_relro,
1011 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
1012 Add is_last_relro_ and is_first_non_relro_ fields.
1013 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
1014 Create separate .got.plt section. Call increase_relro.
1015 * x86_64.cc (Target_x86_64::got_section): Likewise.
1016 * testsuite/relro_script_test.t: Add .got.plt.
1019 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
1020 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
1021 (Layout::finalize): Call set_dynamic_symbol_size.
1022 (Layout::set_dynamic_symbol_size): New function.
1023 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
1024 set_dynamic_symbol_size.
1027 * output.h (class Output_section): Add is_entsize_zero_ field.
1028 * output.cc (Output_section::Output_section): Initialize
1030 (Output_section::set_entsize): If two different entsizes are
1031 requested, force it to zero.
1032 (Output_section::add_input_section): Set flags for .debug_str
1033 before updating section flags. Set entsize.
1034 (Output_section::update_flags_for_input_section): Set SHF_MERGE
1035 and SHF_STRING if all input sections have those flags.
1037 2009-12-29 Rafael Espindola <espindola@google.com>
1039 * main.cc (main): Fix the sys time reporting.
1040 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
1043 2009-12-29 Sriraman Tallam <tmsriram@google.com>
1045 * options.cc (General_options::parse_version): Allow -v to exit
1046 without an error if there is nothing to link.
1048 2009-12-29 Ian Lance Taylor <iant@google.com>
1050 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
1051 using a version of gcc before 4.1.
1052 * configure: Rebuild.
1054 2009-12-28 Chris Demetriou <cgd@google.com>
1056 * attributes.cc (Output_attributes_section_data::do_write): Use
1057 std::vector::front rather than std::vector::data.
1059 2009-12-28 Ian Lance Taylor <iant@google.com>
1061 * symtab.h (class Symbol_table): Add enum Defined.
1062 * resolve.cc (Symbol_table::should_override): Add defined
1063 parameter. Change all callers. Test whether object is NULL
1064 before calling a method on it.
1065 (Symbol_table::report_resolve_problem): Add defined parameter.
1067 (Symbol_table::should_override_with_special): Likewise.
1068 * symtab.cc (Symbol_table::define_in_output_data): Add defined
1069 parameter. Change all callers.
1070 (Symbol_table::do_define_in_output_data): Likewise.
1071 (Symbol_table::define_in_output_segment): Likewise.
1072 (Symbol_table::do_define_in_output_segment): Likewise.
1073 (Symbol_table::define_as_constant): Likewise.
1074 (Symbol_table::do_define_as_constant): Likewise.
1075 * script.h (class Symbol_assignment): Add is_defsym parameter to
1076 constructor; change all callers.
1077 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
1078 parameter. Change all callers. Add is_defsym_ field.
1079 (class Parser_closure): Add parsing_defsym parameter to
1080 constructor; change all callers. Add parsing_defsym accessor
1081 function. Add parsing_defsym_ field.
1083 2009-12-28 Ian Lance Taylor <iant@google.com>
1085 * gold.cc (queue_middle_tasks): Fix formatting.
1086 * object.cc (Relobj::is_section_name_included): Likewise.
1088 2009-12-23 Ian Lance Taylor <iant@google.com>
1090 * i386.cc (Target_i386::do_calls_non_split): Recognize
1091 -fsplit-stack prologue for a function with a static chain.
1092 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
1093 -fsplit-stack prologue when using %r11.
1095 2009-12-21 Sriraman Tallam <tmsriram@google.com>
1097 * options.cc (General_options::parse_version): Make -v continue and do
1098 the link like GNU ld does.
1100 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
1102 * Makefile.am (CCFILES): Add timer.cc.
1103 (HFILES): Add timer.h.
1104 * configure.ac: Check for sysconf and times.
1105 * main.cc: include timer.h.
1106 (main): Use Timer instead of get_run_time.
1109 * workqueue.cc: include timer.h.
1110 (Workqueue::find_and_run_task):
1111 Report user, sys and wall time.
1112 * Makefile.in: Regenerate.
1113 * config.in: Regenerate.
1114 * configure: Regenerate.
1116 2009-12-16 Doug Kwan <dougkwan@google.com>
1118 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
1120 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
1121 relaxed input sections.
1122 * output.cc (Output_section::find_relaxed_input_section): Change
1123 return type to Output_relaxed_input_section pointer. Adjust code
1124 for new type of relaxed_input_section_map_.
1125 * output.h (Output_section::find_relaxed_input_section): Change
1126 return type to Output_relaxed_input_section pointer.
1127 (Output_section::Output_relaxed_input_section_by_input_section_map):
1129 (Output_section::relaxed_input_section_map_): Change type to
1130 Output_section::Output_relaxed_input_section_by_input_section_map.
1131 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
1134 2009-12-15 Ian Lance Taylor <iant@google.com>
1136 * layout.cc (Layout::create_shstrtab): Only write out after input
1137 sections if we are compressing debug sections.
1139 2009-12-15 Ian Lance Taylor <iant@google.com>
1141 * archive.cc (Archive::add_symbols): Only look up a symbol without
1142 a version if there is, in fact, a version.
1144 2009-12-14 Ian Lance Taylor <iant@google.com>
1146 Revert -Wshadow changes, all changes from:
1147 2009-12-11 Doug Kwan <dougkwan@google.com>
1148 2009-12-11 Nick Clifton <nickc@redhat.com>
1149 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
1151 2009-12-11 Doug Kwan <dougkwan@google.com>
1153 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
1155 * attributes.cc (Object_attribute::size): Ditto.
1156 (Attributes_section_data::size): Ditto.
1157 (Attributes_section_data::Attributes_section_data): Ditto.
1158 (Output_attributes_section_data::do_write): Ditto.
1159 * attributes.h (Object_attribute::set_type): Ditto.
1160 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1162 2009-12-11 Nick Clifton <nickc@redhat.com>
1164 * archive.cc: Fix shadowed variable warnings.
1166 * compressed_output.cc: Likewise.
1167 * compressed_output.h: Likewise.
1168 * configure: Likewise.
1169 * dwarf_reader.cc: Likewise.
1170 * dynobj.cc: Likewise.
1171 * dynobj.h: Likewise.
1172 * ehframe.cc: Likewise.
1173 * ehframe.h: Likewise.
1174 * errors.cc: Likewise.
1175 * expression.cc: Likewise.
1176 * fileread.cc: Likewise.
1177 * fileread.h: Likewise.
1178 * freebsd.h: Likewise.
1179 * i386.cc: Likewise.
1181 * incremental.h: Likewise.
1182 * layout.cc: Likewise.
1183 * layout.h: Likewise.
1184 * mapfile.cc: Likewise.
1185 * merge.cc: Likewise.
1186 * merge.h: Likewise.
1187 * object.cc: Likewise.
1188 * object.h: Likewise.
1189 * options.h: Likewise.
1190 * output.cc: Likewise.
1191 * output.h: Likewise.
1192 * parameters.cc: Likewise.
1193 * plugin.cc: Likewise.
1194 * powerpc.cc: Likewise.
1195 * reduced_debug_output.cc: Likewise.
1196 * reduced_debug_output.h: Likewise.
1197 * reloc.cc: Likewise.
1198 * reloc.h: Likewise.
1199 * resolve.cc: Likewise.
1200 * script-sections.cc: Likewise.
1201 * script.cc: Likewise.
1202 * script.h: Likewise.
1203 * sparc.cc: Likewise.
1204 * symtab.cc: Likewise.
1205 * symtab.h: Likewise.
1206 * target-select.cc: Likewise.
1207 * target-select.h: Likewise.
1208 * token.h: Likewise.
1209 * workqueue.cc: Likewise.
1210 * workqueue.h: Likewise.
1211 * x86_64.cc: Likewise.
1213 2009-12-10 Doug Kwan <dougkwan@google.com>
1215 * arm.cc (attributes.h): New include.
1216 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1217 (Arm_relobj::~Arm_relobj): Delete object pointed by
1218 attributes_section_data_.
1219 (Arm_relobj::attributes_section_data): New method definition.
1220 (Arm_relobj::attributes_section_data_): New data member declaration.
1221 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1222 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1223 attributes_section_data_.
1224 (Arm_dynobj::attributes_section_data): New method definition.
1225 (Arm_dynobj::attributes_section_data_): New data member declaration.
1226 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
1227 initialization value of may_use_blx_ to false.
1228 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1229 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1230 object attributes to compute results instead of hard-coding.
1231 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1232 Target_arm::get_secondary_compatible_arch,
1233 Target_arm::set_secondary_compatible_arch
1234 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1235 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1236 New method declarations.
1237 (Target_arm::get_aeabi_object_attribute): New method definition.
1238 (Target_arm::attributes_section_data_): New data member declaration.
1239 (read_arm_attributes_section): New template definition.
1240 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1241 (Arm_dynobj::do_read_symbols): Ditto.
1242 (Target_arm::do_finalize_sections): Merge attributes sections from
1243 input. Check for BLX use after attributes section merging.
1244 Fix __exidx_start and __exidx_end visibility. Create an
1245 .ARM.attributes section if necessary.
1246 (Target_arm::get_secondary_compatible_arch,
1247 Target_arm::set_secondary_compatible_arch,
1248 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1249 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1250 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
1251 New method definitions.
1253 2009-12-09 Ian Lance Taylor <iant@google.com>
1255 * plugin.cc (Plugin::load): Don't cast from void* to a function
1258 2009-12-09 Ian Lance Taylor <iant@google.com>
1260 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1263 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
1265 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1266 Replace two_file_shared_1.so with two_file_shared_2.so.
1267 * testsuite/Makefile.in: Regenerated.
1269 2009-12-08 Doug Kwan <dougkwan@google.com>
1271 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1272 (HFILES): Add attributes.h and int_encoding.h.
1273 * Makefile.in: Regenerate.
1274 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1275 function definitions to int_encoding.cc
1276 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1277 prototypes to int_encoding.h
1278 * reduced_debug_output.cc (int_encoding.h): New include.
1279 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1280 function definitions to int_encoding.cc
1281 (insert_into_vector, read_from_pointer): Move template definitions to
1283 * attributes.cc: New file.
1284 * attributes.h: New file.
1285 * int_encoding.cc: New file.
1286 * int_encoding.h: New file.
1288 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
1291 * incremental-dump.cc (dump_incremental_inputs): New.
1292 (main): Use dump_incremental_inputs.
1294 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
1297 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1298 checking elfcpp::STT_FUNC.
1299 (Target_i386::Relocate::relocate): Likewise.
1300 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1302 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1303 symbols from shared libraries into normal FUNC symbols.
1305 * symtab.h (Symbol): Add is_func and use it.
1307 2009-12-05 Doug Kwan <dougkwan@google.com>
1309 * arm.cc (Target_arm::arm_info): Initialize new fields
1310 attributes_section and attributes_vendor.
1311 * i386.cc (Target_i386::i386_info): Same.
1312 * object.cc (Sized_relobj::do_layout): Skip attribute section.
1313 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1314 fields attributes_section and attributes_vendor.
1315 * sparc.cc (Target_sparc::sparc_info): Same.
1316 * target.h (Target::attributes_section, Target::attributes_vendor,
1317 Target::is_attributes_section, Target::attribute_arg_type,
1318 Target::attributes_order): New method definitions.
1319 (Target::Target_info::attributes_section,
1320 Target::Target_info::attributes_vendor): New fields.
1321 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1322 virtual method definitions.
1323 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1324 attributes_section and attributes_vendor.
1325 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1327 2009-12-05 Doug Kwan <dougkwan@google.com>
1329 * arm.cc: Update comments about interworking and stub generation.
1330 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1331 considered as non-PIC.
1332 (Arm_relocate_functions::base_abs): Fix formatting.
1333 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1334 of function to use GOT entry address instead of offset.
1335 (Target_arm::Scan::global): Issue an error if a symbol would need a
1336 PLT does not get one because it is untyped. Remove code to create
1337 dynamic symbols for relative branches.
1338 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1339 takes unsigned integer instead of boolean.
1341 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1343 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1344 (two_file_test_LDADD): Likewise.
1345 (common_test_1_LDADD): Likewise.
1346 (exception_test_LDADD) Likewise.
1347 (weak_test_LDADD): Likewise.
1348 (many_sections_test_LDADD): Likewise.
1349 (initpri1_LDADD): Likewise.
1350 (script_test_1_LDADD): Likewise.
1351 (script_test_2_LDADD): Likewise.
1352 (justsyms_LDADD): Likewise.
1353 (binary_test_LDADD): Likewise.
1354 (large_LDADD): Likewise.
1355 * testsuite/Makefile.in: Regenerated.
1357 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1359 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1360 (Symbol_table::override_with_special): Likewise.
1361 (Symbol_table::add_from_object): Likewise.
1363 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1365 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1366 Don't set the data_offset twice.
1368 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1370 * testsuite/Makefile.in: Regenerate.
1372 2009-12-03 Doug Kwan <dougkwan@google.com>
1374 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1375 (Target_arm::do_finalize_sections): Add parameter for symbol table
1376 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1377 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1378 parameter for symbol table pointer.
1379 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1380 an additional parameter for a pointer to symbol table.
1381 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1382 parameter for a symbol table pointer.
1383 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1384 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1386 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1387 parameter for a symbol table pointer.
1389 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
1391 * incremental.cc (Incremental_inputs_header)
1392 (Incremental_inputs_header_write, Incremental_inputs_entry)
1393 (Incremental_inputs_entry_write): Move ...
1394 * incremental.h (Incremental_inputs_header)
1395 (Incremental_inputs_header_write, Incremental_inputs_entry)
1396 (Incremental_inputs_entry_write): here.
1398 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1400 * incremental.cc (make_sized_incremental_binary): Set the target.
1401 Error if it is incompatible.
1402 * output.h (Output_file): Add filename method.
1404 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1406 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1407 from the get_* methods.
1409 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1411 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1412 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1413 Write 0 for the data_offset of scripts.
1415 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1417 * testsuite/Makefile.am: Add the incremental_test.sh test.
1418 * testsuite/incremental_test.sh: New.
1419 * testsuite/incremental_test_1.c: New.
1420 * testsuite/incremental_test_2.c: New.
1422 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
1424 * incremental-dump.cc (main): Fix typos.
1426 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
1429 * incremental-dump.cc (main): Use llu to print 64 bit values.
1431 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1432 H.J. Lu <hongjiu.lu@intel.com>
1434 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1436 (incremental_dump_LDADD): Likewise.
1437 * Makefile.in: Regenerated.
1439 2009-11-25 Doug Kwan <dougkwan@google.com>
1443 2009-11-25 Doug Kwan <dougkwan@google.com>
1445 * arm.cc (Target_arm::Target_arm): Move method definition
1446 outside of class definition. Add code to handle
1447 --target1-rel, --target1-abs and --target2= options.
1448 (Target_arm::get_reloc_reloc_type): Change method to be
1449 non-static and const.
1450 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1451 New data member declaration.
1452 (Target_arm::Scan::local, Target_arm::Scan::global,
1453 Target_arm::Relocate::relocate,
1454 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1455 Adjust call to Target_arm::get_real_reloc_type.
1456 (Target_arm::get_real_reloc_type): Use command line options
1457 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1458 * options.h (--target1-rel, --target1-abs, --target2): New
1461 2009-11-25 Doug Kwan <dougkwan@google.com>
1463 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1464 class definition. Add code to handle --target1-rel, --target1-abs
1465 and --target2= options.
1466 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1468 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1470 (Target_arm::Scan::local, Target_arm::Scan::global,
1471 Target_arm::Relocate::relocate,
1472 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1473 call to Target_arm::get_real_reloc_type.
1474 (Target_arm::get_real_reloc_type): Use command line options to
1475 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1476 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1479 2009-11-25 Doug Kwan <dougkwan@google.com>
1481 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1482 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1483 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1485 (Arm_relocate_functions::thm_call): Replace body with a call to
1486 Arm_relocate_functions::thumb_branch_common.
1487 (Arm_relocate_functions::thm_jump24,
1488 Arm_relocate_functions::thm_xpc22): New method definitions.
1489 (Arm_relocate_functions::thumb_branch_common): New method definition.
1490 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1492 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1493 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1495 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1497 * Makefile.am: Build incremental-dump
1498 * Makefile.in: Regenerate.
1499 * incremental-dump.cc: New.
1500 * incremental.cc (Incremental_inputs_header_data,
1501 Incremental_inputs_entry_data): Move to incremental.h
1502 * incremental.h: (Incremental_inputs_header_data,
1503 Incremental_inputs_entry_data): Move from incremental.cc
1505 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1507 * incremental.cc (Incremental_inputs_header,
1508 Incremental_inputs_header_write, Incremental_inputs_entry,
1509 Incremental_inputs_entry_write): Add a typedef with the data type.
1511 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1513 * incremental.cc (Incremental_inputs_header,
1514 Incremental_inputs_header_write, Incremental_inputs_entry,
1515 Incremental_inputs_entry_write): Update comment about which
1516 type has the filed descriptions.
1518 2009-11-15 Doug Kwan <dougkwan@google.com>
1520 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1521 (Arm_relocate_functions::arm_branch_common): Change method defintion
1522 in class definition to a method declaration and update list of formal
1524 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1525 Arm_relocation_functions::jump24): Adjust call to
1526 Arm_relocate_functions::arm_branch_common. Update list of formal
1528 (Arm_relocate_functions::xpc25): New method definition.
1529 (Arm_relocate_functions::arm_branch_common): Move method defintion
1530 out from class definition. Use stubs for mode-switching and extending
1532 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1533 specially. Change code to enable use of stubs in ARM branches.
1535 2009-11-10 Doug Kwan <dougkwan@google.com>
1537 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1538 in method declaration.
1539 (Target_arm::relocate_stub): New method declaration.
1540 (Target_arm::default_target): Change to return a pointer instead of
1542 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1543 Target_arm::default_target.
1544 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1546 (Target_arm::relocate_section): Adjust view.
1547 (Target_arm::relocate_stub): New method definition.
1549 2009-11-10 Doug Kwan <dougkwan@google.com>
1551 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1553 * incremental.cc (open_incremental_binary): Initialized local
1554 variables to avoid warnings.
1555 * object.cc (make_elf_object): Ditto.
1556 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1559 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1562 * testsuite/plugin_test.c: Include "config.h".
1564 2009-11-09 Doug Kwan <dougkwan@google.com>
1566 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1567 (arm_symbol_value): Remove.
1568 (Arm_relocate_functions::arm_branch_common,
1569 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1570 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1571 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1572 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1573 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1574 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1575 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1576 Arm_relocate_functions::thm_mobw_abs_nc,
1577 Arm_relocate_functions::thm_mov_abs,
1578 Arm_relocate_functions::movw_prel_nc,
1579 Arm_relocate_functions::thm_movt_abs,
1580 Arm_relocate_functions::movt_prel,
1581 Arm_relocate_functions::thm_movw_prel_nc,
1582 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1583 (Target_arm::Relocate::relocate): Only decompose address into two
1584 parts if relocation type uses the thumb-bit and pass the actual
1585 bit instead of a flag indicating that the thumb-bit is used. Adjust
1586 calls to methods in Arm_relocate_functions for this change.
1588 2009-11-08 Ian Lance Taylor <iant@google.com>
1591 * reloc.cc: Instantiate
1592 Sized_relobj::initialize_input_to_output_maps and
1593 Sized_relobj:free_input_to_output_maps.
1595 2009-11-06 Ian Lance Taylor <iant@google.com>
1598 * defstd.cc (in_segment): Set only_if_ref true for "end".
1600 2009-11-06 Doug Kwan <dougkwan@google.com>
1602 * arm.cc (class Reloc_stub): Correct a comment.
1603 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1604 (Target_arm::scan_section_for_stubs): New method declaration.
1605 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1606 Change methods from private to protected.
1607 (Target_arm::do_may_relax): New method definition.
1608 (Target_arm::do_relax, Target_arm::group_sections,
1609 Target_arm::scan_reloc_for_stub,
1610 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1611 (Target_arm::arm_input_section_map_): New data member declaration.
1612 (Target_arm::scan_reloc_for_stub,
1613 Target_arm::scan_reloc_section_for_stubs,
1614 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1615 Target_arm::do_relax): New method definitions.
1617 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1619 * configure.ac: Check for (struct stat)::st_mtim
1620 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1621 * config.in: Regenerate.
1622 * configure: Regenerate.
1624 2009-11-05 Ian Lance Taylor <iant@google.com>
1627 * output.cc (Output_segment::add_output_section): Add missing
1630 2009-11-04 Ian Lance Taylor <iant@google.com>
1633 * object.h (class Object): Add is_needed and set_is_needed
1634 methods. Add is_needed_ field. Make bool fields into bitfields.
1635 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1636 defined in a dynamic object and referenced by a regular object,
1637 set is_needed for the dynamic object.
1638 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1639 if the file is marked with as_needed and it is not needed.
1641 2009-11-04 Ian Lance Taylor <iant@google.com>
1644 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1645 tags if data is discarded by linker script.
1646 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1647 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1648 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1649 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1651 2009-11-04 Ian Lance Taylor <iant@google.com>
1653 * layout.cc (Layout::get_output_section): Add is_interp and
1654 is_dynamic_linker_section parameters. Change all callers.
1655 (Layout::choose_output_section): Likewise.
1656 (Layout::make_output_section): Likewise.
1657 (Layout::add_output_section_data): Add is_dynamic_linker_section
1658 parameter. Change all callers.
1659 * layout.h (class Layout): Update declarations.
1660 * output.h (class Output_section): Add is_interp, set_is_interp,
1661 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1662 Add is_interp_, is_dynamic_linker_section_ fields. Change
1663 generate_code_fills_at_write_ to a bitfield.
1664 * output.cc (Output_section::Output_sections): Initialize new
1666 (Output_segment::add_output_section): Add do_sort parameter.
1669 2009-11-03 Ian Lance Taylor <iant@google.com>
1672 * options.h (class General_options): Add --warn-common.
1673 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1674 merging two common symbols.
1675 (Symbol_table::should_override): Handle --warn-common when merging
1676 a common symbol with a defined symbol. Use report_resolve_problem
1677 for multiple definitions.
1678 (Symbol_table::report_resolve_problem): New function.
1679 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1681 2009-11-03 Doug Kwan <dougkwan@google.com>
1683 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1685 (Target_arm::stub_factory): New method definition.
1686 (Target_arm::new_arm_input_section,
1687 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1688 Target_arm::reloc_uses_thumb_bit): New method declarations.
1689 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1690 New type definitions.
1691 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1692 member declarations.
1693 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1694 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1695 New method definitions.
1697 2009-11-03 Ian Lance Taylor <iant@google.com>
1699 * options.h (class General_options): Add --warn_constructors.
1701 2009-11-03 Ian Lance Taylor <iant@google.com>
1704 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1705 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1707 2009-11-03 Ian Lance Taylor <iant@google.com>
1710 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1711 --msgid-bugs-address.
1712 (install-pdf): New target.
1713 (install-data_yes): Look up one directory to find mkinstalldirs.
1715 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1717 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1720 2009-10-30 Doug Kwan <dougkwan@google.com>
1722 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1724 2009-10-30 Doug Kwan <dougkwan@google.com>
1726 * arm.cc (Stub_addend_reader): New struct template definition
1727 and partial specializations.
1728 (Stub_addend_reader::operator()): New method definition for a
1729 partially specialized template.
1731 2009-10-30 Doug Kwan <dougkwan@google.com>
1733 * arm.cc (Arm_relobj::processor_specific_flags): New method
1735 (Arm_relobj::do_read_symbols): New method declaration.
1736 (Arm_relobj::processor_specific_flags_): New data member declaration.
1737 (Arm_dynobj): New class definition.
1738 (Target_arm::do_finalize_sections): Add input_objects parameter.
1739 (Target_arm::do_adjust_elf_header): New method declaration.
1740 (Target_arm::are_eabi_versions_compatible,
1741 (Target_arm::merge_processor_specific_flags): New method declaration.
1742 (Target_arm::do_make_elf_object): New overloaded method definitions
1744 (Arm_relobj::do_read_symbols): New method definition.
1745 (Arm_dynobj::do_read_symbols): Ditto.
1746 (Target_arm::do_finalize_sections): Add input_objects parameters.
1747 Merge processor-specific flags from all input objects.
1748 (Target_arm::are_eabi_versions_compatible,
1749 Target_arm::merge_processor_specific_flags,
1750 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1751 New method definitions.
1752 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1753 Input_objects pointer type parameter.
1754 * layout.cc (Layout::finalize): Pass input objects to target's.
1755 finalize_sections function.
1756 * output.cc (Output_file_header::do_sized_write): Set ELF file
1757 header's processor-specific flags.
1758 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1759 Input_objects pointer type parameter.
1760 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1761 * target.h (Input_objects): New forward class declaration.
1762 (Target::processor_specific_flags,
1763 Target::are_processor_specific_flags_sect): New method definitions.
1764 (Target::finalize_sections): Add input_objects parameter.
1765 (Target::Target): Initialize processor_specific_flags_ and
1766 are_processor_specific_flags_set_.
1767 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1769 (Target::set_processor_specific_flags): New method definition.
1770 (Target::processor_specific_flags_,
1771 Target::are_processor_specific_flags_set_): New data member
1773 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1774 Input_objects pointer type parameter.
1776 2009-10-30 Doug Kwan <dougkwan@google.com>
1778 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1780 2009-10-28 Ian Lance Taylor <iant@google.com>
1782 * object.h (class Relobj): Drop options parameter from
1783 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1784 do_scan_relocs, do_relocate. Change all callers.
1785 (class Sized_relobj): Drop options parameters from
1786 do_gc_process_relocs, do_scan_relocs, do_relocate,
1787 do_relocate_sections, relocate_sections, emit_relocs_scan,
1788 emit_relocs_scan_reltype. Change all callers.
1789 (struct Relocate_info): Remove options field and all references to
1791 * reloc.h (class Read_relocs): Remove options constructor
1792 parameter and options_ field. Change all callers.
1793 (class Gc_process_relocs, class Scan_relocs): Likewise.
1794 (class Relocate_task): Likewise.
1795 * target-reloc.h (scan_relocs): Remove options parameter. Change
1797 (scan_relocatable_relocs): Likewise.
1798 * target.h (class Sized_target): Remove options parameter from
1799 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1801 * gc.h (gc_process_relocs): Remove options parameter. Change all
1803 * arm.cc: Update functions to remove options parameters.
1804 * i386.cc: Likewise.
1805 * powerpc.cc: Likewise.
1806 * sparc.cc: Likewise.
1807 * x86_64.cc: Likewise.
1808 * testsuite/testfile.cc: Likewise.
1810 2009-10-28 Doug Kwan <dougkwan@google.com>
1812 * arm.cc (Arm_relobj): New class definition.
1813 (Arm_relobj::scan_sections_for_stubs,
1814 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1815 New method definitions.
1817 2009-10-28 Cary Coutant <ccoutant@google.com>
1819 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1820 (Plugin::cleanup_done_): New member.
1821 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1822 (Plugin_manager::cleanup_done_): Remove.
1823 (Plugin_manager::add_input_file): Edit error message.
1824 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1825 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1827 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1829 * fileread.cc: (File_read::View::~View): Use the new
1830 data_ownership_ filed.
1831 (File_read::~File_read): Dispose the new whole_file_view_.
1832 (File_read::open): Mmap the whole file if needed.
1833 (File_read::open): Use whole_file_view_ instead of contents_.
1834 (File_read::find_view): Use whole_file_view_ if applicable.
1835 (File_read::do_read): Use whole_file_view_ instead of contents_.
1836 (File_read::make_view): Use whole_file_view_ instead of contents_,
1837 update File_read::View::View call.
1838 (File_read::find_or_make_view): Update File_read::View::View
1840 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1842 (File_read::View::Data_ownership): New enum.
1843 (File_read::View::View): Replace bool mapped_ with Data_ownership
1845 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1846 (File_read::View::data_ownership_): New field.
1847 (File_read::contents_): Remove (replaced by whole_file_view_).
1848 (File_read::whole_file_view_): New field.
1849 * options.h (class General_options): Add --keep-files-mapped.
1851 2009-10-27 Cary Coutant <ccoutant@google.com>
1853 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1854 * testsuite/Makefile.am (plugin_test_5): New test case.
1855 * testsuite/Makefile.in: Regenerate.
1857 2009-10-25 Doug Kwan <dougkwan@google.com>
1859 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1860 from private to protected to allow access by child class.
1861 (Sized_relobj::do_relocate_sections): New method declaration.
1862 (Sized_relobj::relocate_sections): Virtualize.
1863 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1864 Sized_relobj::relocate_sections. Instantiate template explicitly
1865 for different target sizes and endianity.
1867 2009-10-24 Doug Kwan <dougkwan@google.com>
1869 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1870 (Arm_input_section::as_arm_input_section): New method.
1871 (Arm_output_section): New class definition.
1872 (Arm_output_section::create_stub_group,
1873 Arm_output_section::group_sections): New method definitions.
1875 2009-10-22 Doug Kwan <dougkwan@google.com>
1877 * arm.cc (Arm_input_section): New class definition.
1878 (Arm_input_section::init, Arm_input_section:do_write,
1879 Arm_input_section::set_final_data_size,
1880 Arm_input_section::do_reset_address_and_file_offset): New method
1883 2009-10-21 Doug Kwan <dougkwan@google.com>
1885 * arm.cc (Stub_table, Arm_input_section): New forward class
1887 (Stub_table): New class defintion.
1888 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1889 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1890 New method definition.
1892 2009-10-21 Doug Kwan <dougkwan@google.com>
1894 * arm.cc: Update copyright comments.
1895 (Target_arm): New forward class template declaration.
1896 (Arm_address): New type.
1897 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1898 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1899 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1901 (Insn_template): Same.
1902 (DEF_STUBS): New macro.
1903 (Stub_type): New enum type.
1904 (Stub_template): New class definition.
1907 (Stub_factory): Same.
1908 (Target_arm::Target_arm): Initialize may_use_blx_ and
1909 should_force_pic_veneer_.
1910 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1911 Target_arm::should_force_pic_veneer,
1912 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1913 Target_arm::using_thumb_only, Target_arm:;default_target): New
1915 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1916 New data member declarations.
1917 (Insn_template::size, Insn_template::alignment): New method defintions.
1918 (Stub_template::Stub_template): New method definition.
1919 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1920 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1921 (Stub_factory::Stub_factory): New method definition.
1922 * gold.h (string_hash): New template.
1923 * output.h (Input_section_specifier::hash_value): Use
1925 (Input_section_specifier::string_hash): Remove.
1926 * stringpool.cc (Stringpool_template::string_hash): Use
1929 2009-10-20 Doug Kwan <dougkwan@google.com>
1931 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1932 symbols of relaxed input sections.
1933 * output.h (Output_section::find_relaxed_input_section): Make
1936 2009-10-16 Doug Kwan <dougkwan@google.com>
1938 * dynobj.cc (Versions::Versions): Initialize version_script_.
1939 Only insert base version symbol definition for a shared object
1940 if version script defines any version versions.
1941 (Versions::define_base_version): New method definition.
1942 (Versions::add_def): Check that base version is not needed.
1943 (Versions::add_need): Define base version lazily.
1944 * dynobj.h (Versions::define_base_version): New method declaration.
1945 (Versions::needs_base_version_): New data member declaration.
1946 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1947 (check_DATA): Add no_version_test.stdout.
1948 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1950 * testsuite/Makefile.in: Regenerate.
1951 * testsuite/no_version_test.c: New file.
1952 * testsuite/no_version_test.sh: Ditto.
1954 2009-10-16 Doug Kwan <dougkwan@google.com>
1956 * expression.cc (class Segment_start_expression): New class definition.
1957 (Segment_start_expression::value): New method definition.
1958 (script_exp_function_segment_start): Return a new
1959 Segment_start_expression.
1960 * gold/script-c.h (script_saw_segment_start_expression): New function
1962 * script-sections.cc (Script_sections::Script_sections): Initialize
1963 SAW_SEGMENT_START_EXPRESSION_ to false.
1964 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1965 and -Tbbs options to specify section addresses if given in
1966 command line and no SEGMENT_START expression is seen in a script.
1967 * script-sections.h (Script_sections::saw_segment_start_expression,
1968 Script_sections::set_saw_segment_start_expression): New method
1970 (Script_sections::saw_segment_start_expression_): New data member
1972 * script.cc (script_saw_segment_start_expression): New function.
1973 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1974 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1975 script_test_7.sh and script_test_8.sh.
1976 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1977 script_test_8.stdout.
1978 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1979 (script_test_6, script_test_6.stdout, script_test_7,
1980 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1981 * Makefile.in: Regenerate.
1982 * testsuite/script_test_6.sh: New file.
1983 * testsuite/script_test_6.t: Same.
1984 * testsuite/script_test_7.sh: Same.
1985 * testsuite/script_test_7.t: Same.
1986 * testsuite/script_test_8.sh: Same.
1988 2009-10-16 Doug Kwan <dougkwan@google.com>
1990 * output.cc (Output_segment::set_section_list_address): Cast
1991 expressions to unsigned long long type to avoid format warnings.
1993 2009-10-15 Ian Lance Taylor <iant@google.com>
1995 * script.cc (Script_options::add_symbol_assignment): Always add a
1996 dot assignment to script_sections_.
1997 * script-sections.cc (Script_sections::add_dot_assignment):
1998 Initialize if necessary.
2000 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
2001 program headers with no load segment if there is a linker script.
2003 * layout.cc (Layout::set_segment_offsets): Align the file offset
2004 to the segment aligment for -N or -n with no load segment.
2005 * output.cc (Output_segment::add_output_section): Don't crash if
2006 the first section is a TLS section.
2007 (Output_segment::set_section_list_addresses): Print an error
2008 message if the address moves backward in a linker script.
2009 * script-sections.cc
2010 (Output_section_element_input::set_section_addresses): Don't
2011 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
2012 (Orphan_output_section::set_section_addresses): Likewise.
2014 2009-10-15 Doug Kwan <dougkwan@google.com>
2016 * layout.cc (Layout::finish_dynamic_section): Generate tags
2017 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
2018 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
2019 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
2021 2009-10-14 Ian Lance Taylor <iant@google.com>
2023 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
2025 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
2026 data_shdr fields of relinfo.
2027 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
2028 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
2029 R_386_TLS_LDO_32, adjust based on section flags.
2030 (Target_i386::Relocate::fix_up_ldo): Remove.
2032 2009-10-13 Ian Lance Taylor <iant@google.com>
2034 Add support for -pie.
2035 * options.h (class General_options): Add -pie and
2037 (General_options::output_is_position_independent): Test -pie.
2038 (General_options::output_is_executable): Return true if not shared
2039 and not relocatable.
2040 (General_options::output_is_pie): Remove.
2041 * options.cc (General_options::finalize): Reject incompatible uses
2043 * gold.cc (queue_middle_tasks): A -pie link is not static.
2044 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
2045 * symtab.cc (Symbol::final_value_is_known): Return false if
2046 output_is_position_independent.
2047 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
2048 output_is_position_independent.
2049 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
2050 output_is_position_independent.
2051 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
2052 output_is_position_independent.
2053 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
2055 (basic_pie_test.o, basic_pie_test): New targets.
2056 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
2057 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
2058 (two_file_pie_test): New target.
2059 * testsuite/Makefile.in: Rebuild.
2060 * README: Remove note saying that -pie is not supported.
2062 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2064 * options.h (class General_options): Add -init and -fini.
2065 * layout.cc (Layout::finish_dynamic_section): Emit
2066 given init and fini functions.
2068 2009-10-13 Sriraman Tallam <tmsriram@google.com>
2070 * gc.h (gc_process_relocs): Check if icf is enabled using new
2072 * gold.cc (queue_initial_tasks): Likewise.
2073 (queue_middle_tasks): Likewise.
2074 * object.cc (do_layout): Likewise.
2075 * symtab.cc (is_section_folded): Likewise.
2076 * main.cc (main): Likewise.
2077 * reloc.cc (Read_relocs::run): Likewise.
2078 (Sized_relobj::do_scan_relocs): Likewise.
2079 * icf.cc (is_function_ctor_or_dtor): New function.
2080 (Icf::find_identical_sections): Check if function is ctor or dtor when
2082 * options.h (General_options::icf): Change option to be an enum.
2083 (Icf_status): New enum.
2084 (icf_enabled): New method.
2085 (icf_safe_folding): New method.
2086 (set_icf_status): New method.
2087 (icf_status_): New variable.
2088 * (options.cc) (General_options::finalize): Set icf_status_.
2089 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
2090 icf_test and icf_keep_unique_test to use the --icf enum flag.
2091 * testsuite/icf_safe_test.sh: New file.
2092 * testsuite/icf_safe_test.cc: New file.
2094 2009-10-12 Sriraman Tallam <tmsriram@google.com>
2096 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
2097 includes to gc.h and icf.h.
2098 * arm.cc: Include gc.h.
2099 * gold.cc: Likewise.
2100 * i386.cc: Likewise.
2101 * powerpc.cc: Likewise.
2102 * sparc.cc: Likewise.
2103 * x86_64.cc: Likewise.
2104 * gc.h: Include icf.h.
2106 2009-10-11 Ian Lance Taylor <iant@google.com>
2108 * plugin.cc: Include "gold.h" before other header files.
2110 2009-10-10 Chris Demetriou <cgd@google.com>
2112 * options.h (Input_file_argument::Input_file_type): New enum.
2113 (Input_file_argument::is_lib_): Replace with...
2114 (Input_file_argument::type_): New member.
2115 (Input_file_argument::Input_file_argument): Take Input_file_type
2116 'type' rather than boolean 'is_lib' as second argument.
2117 (Input_file_argument::is_lib): Use type_.
2118 (Input_file_argument::is_searched_file): New function.
2119 (Input_file_argument::may_need_search): Handle is_searched_file.
2120 * options.cc (General_options::parse_library): Support -l:filename.
2121 (General_options::parse_just_symbols): Update for Input_file_argument
2123 (Command_line::process): Likewise.
2124 * archive.cc (Archive::get_file_and_offset): Likewise.
2125 * plugin.cc (Plugin_manager::release_input_file): Likewise.
2126 * script.cc (read_script_file, script_add_file): Likewise.
2127 * fileread.cc (Input_file::Input_file): Likewise.
2128 (Input_file::will_search_for): Handle is_searched_file.
2129 (Input_file::open): Likewise.
2130 * readsyms.cc (Read_symbols::get_name): Likewise.
2131 * testsuite/Makefile.am (searched_file_test): New test.
2132 * testsuite/Makefile.in: Regenerate.
2133 * testsuite/searched_file_test.cc: New file.
2134 * testsuite/searched_file_test_lib.cc: New file.
2136 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2137 Ian Lance Taylor <iant@google.com>
2139 * descriptor.cc: Include <cstdio> and "binary-io.h".
2140 (Descriptors::open): Open the files in binary mode always.
2141 * script.cc (Lex::get_token): Treat \r as whitespace.
2143 2009-10-09 Ian Lance Taylor <iant@google.com>
2145 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
2147 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2148 Ian Lance Taylor <iant@google.com>
2150 * configure.ac: Check for readv function also.
2151 * fileread.cc (readv): Define if not HAVE_READV.
2152 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
2154 * config.in: Regenerate.
2155 * configure: Regenerate.
2157 2009-10-09 Doug Kwan <dougkwan@google.com>
2159 * layout.cc (Layout::make_output_section): Call target hook to make
2160 ordinary output section.
2161 (Layout::finalize): Adjust parameter list of call the
2162 Target::may_relax().
2163 * layout.h (class Layout::section_list): New method.
2164 * merge.h (Output_merge_base::entsize): Change visibility to public.
2165 (Output_merge_base::is_string, Output_merge_base::do_is_string):
2167 (Output_merge_string::do_is_string): New method.
2168 * object.cc (Sized_relobj::do_setup): renamed from
2169 Sized_relobj::set_up.
2170 * object.h (Sized_relobj::adjust_shndx,
2171 Sized_relobj::initializ_input_to_output_maps,
2172 Sized_relobj::free_input_to_output_maps): Change visibilities to
2174 (Sized_relobj::setup): Virtualize.
2175 (Sized_relobj::do_setup): New method declaration.
2176 (Sized_relobj::invalidate_section_offset,
2177 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2178 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2179 * options.cc (parse_int): New function.
2180 * options.h (parse_int): New declaration.
2181 (DEFINE_int): New macro.
2182 (stub_group_size): New option.
2183 * output.cc (Output_section::Output_section): Initialize memebers
2184 merge_section_map_, merge_section_by_properties_map_,
2185 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2186 (Output_section::add_input_section): Handled deferred code-fill
2187 generation and remove an old comment.
2188 (Output_section::add_relaxed_input_section): New method definition.
2189 (Output_section::add_merge_input_section): Use merge section by
2190 properties map to speed to search. Update merge section maps
2192 (Output_section::build_relaxation_map): New method definition.
2193 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2195 (Output_section::relax_input_section): Renamed to
2196 Output_section::convert_input_sections_to_relaxed_sections and change
2197 interface to take a vector of pointers to relaxed sections.
2198 (Output_section::find_merge_section,
2199 Output_section::find_relaxed_input_section): New method definitions.
2200 (Output_section::is_input_address_mapped,
2201 Output_section::output_offset, Output_section::output_address):
2202 Use output section data maps to speed up searching.
2203 (Output_section::find_starting_output_address): Add comments.
2204 (Output_section::do_write,
2205 Output_section::write_to_postprocessing_buffer): Do code-fill
2206 generation as appropriate.
2207 (Output_section::get_input_sections): Invalidate relaxed input section
2209 (Output_section::restore_states): Adjust type of checkpoint .
2210 Invalidate relaxed input section map.
2211 * output.h (Output_merge_base): New class declaration.
2212 (Input_section_specifier): New class defintion.
2213 (class Output_relaxed_input_section) Change base class to
2214 Output_section_data_build.
2215 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2216 base class initializer.
2217 (Output_section::add_relaxed_input_section): New method declaration.
2218 (Output_section::Input_section): Change visibility to protected.
2219 (Output_section::Input_section::relobj,
2220 Output_section::Input_section::shndx): Handle relaxed input sections.
2221 Output_section::input_sections) Change visibility to protected. Also
2222 define overload to return a non-const pointer.
2223 (Output_section::Merge_section_properties): New class defintion.
2224 (Output_section::Merge_section_by_properties_map,
2225 Output_section::Output_section_data_by_input_section_map,
2226 Output_section::Relaxation_map): New types.
2227 (Output_section::relax_input_section): Rename method to
2228 Output_section::convert_input_sections_to_relaxed_sections and change
2229 interface to take a vector of relaxed section pointers.
2230 (Output_section::find_merge_section,
2231 Output_section::find_relaxed_input_section,
2232 Output_section::build_relaxation_map,
2233 Output_section::convert_input_sections_in_list_to_relaxed_sections):
2234 New method declarations.
2235 (Output_section::merge_section_map_
2236 Output_section::merge_section_by_properties_map_,
2237 Output_section::relaxed_input_section_map_,
2238 Output_section::is_relaxed_input_section_map_valid_,
2239 Output_section::generate_code_fills_at_write_): New data members.
2240 * script-sections.cc
2241 (Output_section_element_input::set_section_addresses): Call
2242 current_data_size and addralign methods of relaxed input sections.
2243 (Orphan_output_section::set_section_addresses): Call current_data_size
2244 and addralign methods of relaxed input sections.
2245 * symtab.cc (Symbol_table::compute_final_value): Extract template
2246 from the body of Symbol_table::sized_finalize_symbol.
2247 (Symbol_table::sized_finalized_symbol): Call
2248 Symbol_table::compute_final_value.
2249 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2250 (Symbol_table::compute_final_value): New templated method declaration.
2251 * target.cc (Target::do_make_output_section): New method defintion.
2252 * target.h (Target::make_output_section): New method declaration.
2253 (Target::relax): Add more parameters for input objects, symbol table
2254 and layout. Adjust call to do_relax.
2255 (Target::do_make_output_section): New method declaration.
2256 (Target::do_relax): Add parameters for input objects, symbol table
2259 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2261 * pread.c: Include stdio.h.
2263 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2265 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2268 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2270 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2271 Change read_shndx type to unsigned int.
2272 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2274 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2275 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2276 Change read_shndx type to unsigned int.
2277 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2279 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2280 * layout.cc (Layout::create_symtab_sections): Cast the result of
2281 local_symcount * symsize to off_t in the gold_assert.
2283 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2285 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2286 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2288 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2289 (Arm_relocate_functions::thm_abs5): New function.
2290 (Arm_relocate_functions::abs12): New function.
2291 (Arm_relocate_functions::abs16): New function.
2292 (Arm_relocate_functions::base_abs): New function.
2293 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2294 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
2295 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2297 (Scan::global): Likewise.
2298 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2299 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2300 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2301 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2304 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2306 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2307 (Arm_relocate_functions::movt_prel): New function.
2308 (Arm_relocate_functions::thm_movw_prel_nc): New function.
2309 (Arm_relocate_functions::thm_movt_prel): New function.
2310 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2311 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2312 (Scan::global, Relocate::relocate): Likewise.
2313 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2315 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2317 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2318 Incremental_checker.
2319 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2321 (class Incremental_inputs_header): New class.
2322 (Incremental_inputs_header_writer): Edit comment.
2323 (Incremental_inputs_entry): New class.
2324 (Incremental_inputs_entry_writer): Edit comment.
2325 (Sized_incremental_binary::do_find_incremental_inputs_section):
2326 Add *strtab_shndx parameter, fill it.
2327 (Sized_incremental_binary::do_check_inputs): New method.
2328 (Incremental_checker::can_incrementally_link_output_file): Use
2329 Sized_incremental_binary::check_inputs.
2330 (Incremental_inputs::report_command_line): Save command line in
2333 (Incremental_binary::find_incremental_inputs_section): New
2335 (Incremental_binary::do_find_incremental_inputs_section): Add
2336 strtab_shndx parameter.
2337 (Incremental_binary::do_check_inputs): New pure virtual method.
2338 (Sized_incremental_binary::do_check_inputs): Declare.
2339 (Incremental_checker::Incremental_checker): Add incremental_inputs
2340 parameter, use it to initialize incremental_inputs_.
2341 (Incremental_checker::incremental_inputs_): New field.
2342 (Incremental_checker::command_line): New method.
2343 (Incremental_checker::inputs): New method.
2344 (Incremental_checker::command_line_): New field.
2346 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2348 * incremental.cc: Include <cstdarg> and "target-select.h".
2349 (vexplain_no_incremental): New function.
2350 (explain_no_incremental): New function.
2351 (Incremental_binary::error): New method.
2352 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2354 (make_sized_incremental_binary): New function.
2355 (open_incremental_binary): New function.
2356 (can_incrementally_link_file): Add checks if output is ELF and has
2358 * incremental.h: Include "elfcpp_file.h" and "output.h".
2359 (Incremental_binary): New class.
2360 (Sized_incremental_binary): New class.
2361 (open_incremental_binary): Declare.
2362 * object.cc (is_elf_object): Use
2363 elfcpp::Elf_recognizer::is_elf_file.
2364 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2365 * output.h (Output_file::filesize): New method.
2367 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2369 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2371 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2372 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2374 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2376 (Arm_relocate_functions::movw_abs_nc): New function.
2377 (Arm_relocate_functions::movt_abs): New function.
2378 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2379 (Arm_relocate_functions::thm_movt_abs): New function.
2380 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2381 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2382 (Scan::global): Likewise.
2383 (Relocate::relocate): Likewise.
2384 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2386 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2388 * arm.cc (Arm_relocate_functions::got_prel) New function.
2389 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2390 (Relocate::relocate): Likewise.
2391 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2393 2009-10-06 Ian Lance Taylor <iant@google.com>
2395 * options.h (class General_options): Define
2396 split_stack_adjust_size parameter.
2397 * object.h (class Object): Add uses_split_stack_ and
2398 has_no_split_stack_ fields. Add uses_split_stack and
2399 has_no_split_stack accessor functions. Declare
2400 handle_split_stack_section.
2401 (class Reloc_symbol_changes): Define.
2402 (class Sized_relobj): Define Function_offsets. Declare
2403 split_stack_adjust, split_stack_adjust_reltype, and
2405 * object.cc (Object::handle_split_stack_section): New function.
2406 (Sized_relobj::do_layout): Call handle_split_stack_section.
2407 * dynobj.cc (Sized_dynobj::do_layout): Call
2408 handle_split_stack_section.
2409 * reloc.cc (Sized_relobj::relocate_sections): Call
2410 split_stack_adjust for executable sections in split_stack
2411 objects. Pass reloc_map to relocate_section.
2412 (Sized_relobj::split_stack_adjust): New function.
2413 (Sized_relobj::split_stack_adjust_reltype): New function.
2414 (Sized_relobj::find_functions): New function.
2415 * target-reloc.h: Include "object.h".
2416 (relocate_section): Add reloc_symbol_changes parameter. Change
2418 * target.h (class Target): Add calls_non_split method. Declare
2419 do_calls_non_split virtual method. Declare match_view and
2421 * target.cc: Include "elfcpp.h".
2422 (Target::do_calls_non_split): New function.
2423 (Target::match_view): New function.
2424 (Target::set_view_to_nop): New function.
2425 * gold.cc (queue_middle_tasks): Give an error if mixing
2426 split-stack and non-split-stack objects with -r.
2427 * i386.cc (Target_i386::relocate_section): Add
2428 reloc_symbol_changes parameter.
2429 (Target_i386::do_calls_non_split): New function.
2430 * x86_64.cc (Target_x86_64::relocate_section): Add
2431 reloc_symbol_changes parameter.
2432 (Target_x86_64::do_calls_non_split): New function.
2433 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2435 * powerpc.cc (Target_powerpc::relocate_section): Add
2436 reloc_symbol_changes parameter.
2437 * sparc.cc (Target_sparc::relocate_section): Add
2438 reloc_symbol_changes parameter.
2439 * configure.ac: Call AM_CONDITIONAL for the default target.
2440 * configure: Rebuild.
2441 * testsuite/Makefile.am (TEST_AS): New variable.
2442 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2443 (check_DATA): Add split_i386 and split_x86_64 files.
2444 (SPLIT_DEFSYMS): Define.
2445 (split_i386_[1234n].o): New targets.
2446 (split_i386_[124]): New targets.
2447 (split_i386_[1234r].stdout): New targets.
2448 (split_x86_64_[1234n].o): New targets.
2449 (split_x86_64_[124]): New targets.
2450 (split_x86_64_[1234r].stdout): New targets.
2451 (MOSTLYCLEANFILES): Add new executables.
2452 * testsuite/split_i386.sh: New file.
2453 * testsuite/split_x86_64.sh: New file.
2454 * testsuite/split_i386_1.s: New file.
2455 * testsuite/split_i386_2.s: New file.
2456 * testsuite/split_i386_3.s: New file.
2457 * testsuite/split_i386_4.s: New file.
2458 * testsuite/split_i386_n.s: New file.
2459 * testsuite/split_x86_64_1.s: New file.
2460 * testsuite/split_x86_64_2.s: New file.
2461 * testsuite/split_x86_64_3.s: New file.
2462 * testsuite/split_x86_64_4.s: New file.
2463 * testsuite/split_x86_64_n.s: New file.
2464 * testsuite/testfile.cc (Target_test): Update relocation_section
2466 * testsuite/Makefile.in: Rebuild.
2468 2009-10-06 Ian Lance Taylor <iant@google.com>
2470 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2471 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2472 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2473 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2474 the address on ldo_addrs_.
2475 (Target_i386::Relocate::fix_up_ldo): New function.
2477 2009-10-06 Rafael Espindola <espindola@google.com>
2479 * plugin.cc (add_input_library): New.
2480 (Plugin::load): Add add_input_library to tv.
2481 (Plugin_manager::add_input_file): Add the is_lib argument.
2482 (add_input_file): Update call to Plugin_manager::add_input_file.
2483 (add_input_library): New.
2484 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2486 2009-09-30 Doug Kwan <dougkwan@google.com>
2488 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2489 symbol and call Symbol::may_need_copy_reloc to determine if
2490 a copy reloc is needed.
2491 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2492 nocopyreloc is given in command line.
2493 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2494 given in command line.
2495 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2496 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2497 of the removed Target_i386::may_need_copy_reloc.
2498 * options.h (copyreloc): New option with default value false.
2499 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2500 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2501 instead of the removed Target_powerpc::may_need_copy_reloc.
2502 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2503 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2504 instead of the removed Target_sparc::may_need_copy_reloc.
2505 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2506 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2507 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2508 instead of the removed Target_x86_64::may_need_copy_reloc.
2510 2009-09-30 Ian Lance Taylor <iant@google.com>
2512 * object.h (class Object): Remove target_ field, and target,
2513 sized_target, and set_target methods.
2514 (Object::sized_target): Remove.
2515 (class Sized_relobj): Update declarations. Remove sized_target.
2516 * object.cc (Sized_relobj::setup): Remove target parameter.
2518 (Input_objects::add_object): Don't do anything with the target.
2519 (make_elf_sized_object): Add punconfigured parameter. Change all
2520 callers. Set or test parameter target.
2521 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2523 * parameters.cc (Parameters::set_target): Change parameter type to
2525 (Parameters::default_target): Remove.
2526 (set_parameters_target): Change parameter type to be non-const.
2527 (parameters_force_valid_target): New function.
2528 (parameters_clear_target): New function.
2529 * parameters.h (class Parameters): Update declarations. Remove
2530 default_target method. Add sized_target and clear_target
2531 methods. Change target_ to be non-const.
2532 (set_parameters_target): Update declaration.
2533 (parameters_force_valid_target): Declare.
2534 (parameters_clear_target): Declare.
2535 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2536 as NULL if we aren't searching.
2537 (Add_symbols::run): Don't check for compatible target.
2538 * fileread.cc (Input_file::open_binary): Call
2539 parameters_force_valid_target.
2540 * gold.cc (queue_middle_tasks): Likewise.
2541 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
2542 set_target on object.
2543 * dynobj.h (class Sized_dynobj): Update declarations.
2544 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2545 make_elf_object returns NULL.
2546 (Archive::include_member): Don't check whether object target is
2548 * output.cc (Output_section::add_input_section): Get target from
2550 (Output_section::relax_input_section): Likewise.
2551 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2553 (Sized_relobj::do_scan_relocs): Likewise.
2554 (Sized_relobj::relocate_sections): Likewise.
2555 * resolve.cc (Symbol_table::resolve): Likewise.
2556 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2557 parameter. Change all callers.
2558 (Symbol_table::add_from_object): Get target from parameters.
2559 (Symbol_table::add_from_relobj): Don't check object target.
2560 (Symbol_table::add_from_dynobj): Likewise.
2561 (Symbol_table::define_special_symbol): Get target from
2563 * symtab.h (class Symbol_table): Update declaration.
2564 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2565 parameter. Change all callers. Clear parameter target.
2566 (Binary_test): Test target here.
2567 * testsuite/object_unittest.cc (gold_testsuite): Remove
2568 target_test_pointer parameter. Change all callers.
2569 (Object_test): Test target here.
2571 2009-09-26 Ian Lance Taylor <iant@google.com>
2573 * testsuite/initpri1.c: Don't try to use constructor priorities if
2574 compiling with gcc before 4.3.
2576 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2578 * testsuite/retain_symbols_file_test.sh (check_present): Change
2579 output file name to retain_symbols_file_test.stdout.
2580 (check_absent): Likewise.
2582 2009-09-18 Craig Silverstein <csilvers@google.com>
2584 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2585 * options.cc: Include <cerrno> and <fstream>.
2586 (General_options::finalize): Parse -retain-symbols-file tag.
2587 * options.h: New flag.
2588 (General_options): New method should_retain_symbol, new
2589 variable symbols_to_retain.
2590 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2591 should_retain_symbol map.
2592 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2593 * testsuite/Makefile.in: Regenerate.
2594 * testsuite/retain_symbols_file_test.sh: New file.
2596 2009-09-18 Nick Clifton <nickc@redhat.com>
2598 * po/es.po: Updated Spanish translation.
2600 2009-09-17 Doug Kwan <dougkwan@google.com>
2602 * debug.h (DEBUG_RELAXATION): New constant.
2603 (DEBUG_ALL): Add DEBUG_RELAXATION.
2604 (debug_string_to_enum): Add relaxation debug option.
2606 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2607 Layout::Relaxation_debug_check::read_sections,
2608 Layout::Relaxation_debug_check::read_sections): New method definitions.
2609 (Layout::Layout): Initialize data members
2610 record_output_section_data_from_scrips_,
2611 script_output_section_data_list_ and relaxation_debug_check_.
2612 (Layout::save_segments, Layout::restore_segments,
2613 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2614 Layout::relaxation_loop_body): New method definitions.
2615 (Layout::finalize): Support relaxation. Move section layout code to
2616 Layout::relaxation_loop_body.
2617 (Layout::set_asection_address_from_script): Move code for orphan
2618 section placement out.
2619 (Layout::place_orphan_sections_in_script): New method definition.
2620 * layout.h (Output_segment_headers, Output_file_header):
2621 New forward class declarations.
2622 (Layout::~Layout): Define.
2623 (Layout::new_output_section_data_from_script): New method definition.
2624 (Layout::place_orphan_sections_in_script): New method declaration.
2625 (Layout::Segment_states): New type declaration.
2626 (Layout::save_segments, Layout::restore_segments,
2627 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2628 Layout::relaxation_loop_body): New method declarations.
2629 (Layout::Output_section_data_list): New type declaration.
2630 (Layout::Relaxation_debug_check): New class definition.
2631 (Layout::record_output_section_data_from_script_,
2632 Layout::script_output_section_data_list_, Layout::segment_states_,
2633 Layout::relaxation_debug_check_): New data members.
2634 * output.cc: (Output_section_headers::do_size): New method definition.
2635 (Output_section_headers::Output_section_headers): Move size
2636 computation to Output_section_headers::do_size.
2637 (Output_segment_headers::do_size): New method definition.
2638 (Output_file_header::Output_file_header): Move size computation to
2639 Output_file_header::do_size and call it.
2640 (Output_file_header::do_size): New method definition.
2641 (Output_data_group::Output_data_group): Adjust call to
2642 Output_section_data.
2643 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2644 (Output_symtab_xindex::do_write): Add array bound check.
2645 (Output_section::Input_section::print_to_mapfile): Handle
2646 RELAXED_INPUT_SECTION_CODE.
2647 (Output_section::Output_section): Initialize data member checkpoint_.
2648 (Output_section::~Output_section): Delete checkpoint object pointed
2650 (Output_section::add_input_section): Always add an Input_section if
2652 (Output_section::add_merge_input_section): Add assert.
2653 (Output_section::relax_input_section): New method definition.
2654 (Output_section::set_final_data_size): Set load address to zero for
2655 an unallocated section.
2656 (Output_section::do_address_and_file_offset_have_reset_values):
2657 New method definition.
2658 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2659 Handle relaxed input section.
2660 (Output_section::sort_attached_input_sections): Checkpoint input
2661 section list lazily.
2662 (Output_section::get_input_sections): Change type of input_sections to
2663 list of Simple_input_section pointers. Checkpoint input section list
2664 lazily. Also handle relaxed input sections.
2665 (Output_section::add_input_section_for_script): Take a reference to
2666 a Simple_input_section object instead of Relobj pointer and section
2667 index as parameter. Handle relaxed input sections.
2668 (Output_section::save_states, Output_section::restore_states): New
2670 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2671 (Output_data::is_data_size_fixed): New method definition.
2672 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2674 (Output_data::address_and_file_offset_have_reset_values): New method
2676 (Output_data::do_address_and_file_offset_have_reset_values): New method
2678 (Output_data::set_data_size): Check that data size is not fixed.
2679 (Output_data::fix_data_size): New method definition.
2680 (Output_data::is_data_size_fixed_): New data member.
2681 (Output_section_headers::set_final_data_size): New method definition.
2682 (Output_section_headers::do_size): New method declaration.
2683 (Output_segment_headers::set_final_data_size): New method definition.
2684 (Output_segment_headers::do_size): New method declaration.
2685 (Output_file_header::set_final_data_size)::New method definition.
2686 (Output_file_header::do_size)::New method declaration.
2687 (Output_section_data::Output_section_data): Add new parameter
2688 is_data_size_fixed and use it to fix data size.
2689 (Output_data_const::Output_data_const): Adjust call to base class
2690 constructor and fix data size.
2691 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2692 base class constructor and fix data size.
2693 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2694 base class constructor and fix data size.
2695 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2696 class constructor and fix data size.
2697 (Output_data_group::set_final_data_size): New method definition.
2698 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2699 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2700 class constructor and fix data size.
2701 (Output_relaxed_input_section): New class definition.
2702 (Output_section::Simple_input_section): New class definition.
2703 (Output_section::get_input_sections): Adjust parameter list.
2704 (Output_section::add_input_section_for_script): Same.
2705 (Output_section::save_states, Output_section::restore_states,
2706 Output_section::do_address_and_file_offset_have_reset_values,
2707 (Output_section::Input_section::Input_section): Handle
2708 RELAXED_INPUT_SECTION_CODE. Add new overload for
2709 Output_relaxed_input_section.
2710 (Output_section::Input_section::is_input_section,
2711 Output_section::Input_section::set_output_section): Handle relaxed
2713 (Output_section::Input_section::is_relaxed_input_section,
2714 Output_section::Input_section::output_section_data,
2715 Output_section::Input_section::relaxed_input_section): New method
2717 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2719 (Output_section::Input_section::u1_): Update comments.
2720 (Output_section::Input_section::u2_): Add new union member poris.
2721 (Output_section::Checkpoint_output_section): New classs definition.
2722 (Output_section::relax_input_section): New method declaration.
2723 (Output_section::checkpoint_): New data member.
2724 (Output_segment): Update comments.
2725 (Output_segment::Output_segment): Un-privatize copy constructor.
2726 (Output_segment::operator=): Un-privatize.
2727 * script-sections.cc (Output_section_element::Input_section_list):
2728 Change element type to Output_section::Simple_input_section.
2729 (Output_section_element_dot_assignment::set_section_addresses):
2730 Register output section data for relaxation clean up.
2731 (Output_data_exression::Output_data_expression): Adjust call to base
2732 constructor to fix data size.
2733 (Output_section_element_data::set_section_addresses): Register
2734 Output_data_expression object for relaxation clean up.
2735 (struct Input_section_info): Replace Relobj pointer and section index
2736 pair with Output_section::Simple_input_section and Convert struct to a
2738 (Input_section_sorter::operator()): Adjust access to
2739 Input_section_info data member to use accessors.
2740 (Output_section_element_input::set_section_addresses): Use layout
2741 parameter. Adjust code to use Output_section::Simple_input_section
2742 and Input_secction_info classes. Register filler for relaxation
2744 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2745 and section index pair with Output_section::Simple_input_section
2746 class. Adjust code accordingly.
2747 (Phdrs_element::release_segment): New method definition.
2748 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2750 (Script_sections::release_segments): New method definition.
2751 * gold/script-sections.h (Script_sections::release_segments): New
2753 * gold/target.h (Target::may_relax, Target::relax,
2754 Target::do_may_relax, Target::do_relax): New method definitions.
2756 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2758 * arm.cc (has_signed_unsigned_overflow): New function.
2759 (Arm_relocate_functions::abs8): New function.
2760 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2761 (Target_arm::Scan::global): Likewise.
2762 (Target_arm::relocate::relocate): Likewise.
2763 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2766 2009-09-16 Cary Coutant <ccoutant@google.com>
2768 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2769 * testsuite/Makefile.in: Regenerate.
2771 2009-09-11 Nick Clifton <nickc@redhat.com>
2773 * po/gold.pot: Updated by the Translation project.
2775 2009-09-08 Cary Coutant <ccoutant@google.com>
2777 * output.cc (Output_file::open): Add execute permission to empty file.
2778 * testsuite/Makefile.am (permission_test): New test.
2779 * testsuite/Makefile.in: Regenerate.
2781 2009-09-02 Ian Lance Taylor <iant@google.com>
2783 * output.cc (Output_file::resize): Call map_no_anonymous rather
2786 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2788 * gold.cc: Include "incremental.h".
2789 (queue_initial_tasks): Call Incremental_checker methods.
2790 * incremental.cc: Include "output.h".
2791 (Incremental_checker::can_incrementally_link_output_file): New
2793 * incremental.h (Incremental_checker): New class.
2795 * output.cc (Output_file::open_for_modification): New method.
2796 (Output_file::map_anonymous): Changed return type to bool. Record
2798 (Output_file::map_no_anonymous): New method, broken out of map.
2799 (Output_file::map): Use map_no_anonymous and map_anonymous.
2800 * output.h (class Output_file): Update declarations.
2802 2009-08-24 Cary Coutant <ccoutant@google.com>
2804 * options.h (Command_line::Pre_options): New class.
2805 (Command_line::pre_options): New member.
2806 * options.cc (gold::options::ready_to_register): New variable.
2807 (One_option::register_option): Do nothing if not registering options.
2808 Assert if same short option registered twice.
2809 (General_options::General_options): Turn off option registration when
2811 (Command_line::Pre_options::Pre_options): New constructor.
2813 2009-08-24 Cary Coutant <ccoutant@google.com>
2815 * options.h (General_options::no_keep_memory): Remove incorrect
2818 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2820 * Makefile.am (am__skiplex, am__skipyacc): New.
2821 * Makefile.in: Regenerate.
2823 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2825 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2826 (INCLUDES): ... this.
2827 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2828 (AM_CPPFLAGS): Renamed from ...
2829 (INCLUDE): ... this.
2830 * Makefile.in, testsuite/Makefile.in: Regenerate.
2832 * Makefile.in: Regenerate.
2833 * aclocal.m4: Likewise.
2834 * config.in: Likewise.
2835 * configure: Likewise.
2836 * testsuite/Makefile.in: Likewise.
2838 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2839 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2840 * Makefile.in: Regenerate.
2841 * testsuite/Makefile.in: Regenerate.
2843 2009-08-19 Cary Coutant <ccoutant@google.com>
2845 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2846 symbols in shared libraries overridden by hidden or internal symbols
2847 in the main program.
2849 2009-08-19 Chris Demetriou <cgd@google.com>
2851 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2852 checking source file names in error messages.
2854 2009-08-18 Doug Kwan <dougkwan@google.com>
2856 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2857 an elcpp::Ehdr as parameter. Adjust call to set_target.
2858 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2859 an elfcpp::Ehdr as parameter.
2860 * object.cc (Object::set_target): Remove the version that looks up
2861 a target and sets it.
2862 (Sized_relobj::setup): Take a Target object instead of
2863 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2864 (make_elf_sized_object): Find target and ask target to
2866 * object.h: (Object::set_target): Remove the version that looks up
2867 a target and sets it.
2868 (Sized_relobj::setup): Take a Target object instead of
2869 an elfcpp:Ehdr as parameter.
2870 * target.cc: Include dynobj.h.
2871 (Target::do_make_elf_object_implementation): New.
2872 (Target::do_make_elf_object): New.
2873 * target.h (Target::make_elf_object): New template declaration.
2874 (Target::do_make_elf_object): New method declarations.
2875 (Target::do_make_elf_object_implementation): New template declaration.
2877 2009-08-14 Ian Lance Taylor <iant@google.com>
2879 * gold.h (FUNCTION_NAME): Define.
2880 (gold_unreachable): Use FUNCTION_NAME.
2882 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2884 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2885 symbol in the --keep-unique list is not found.
2887 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2889 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2890 been maked as --keep-unique.
2891 (Icf::unfold_section): New function.
2892 * icf.h (Icf::unfold_section): New function.
2893 * options.h (General_options::keep_unique): New option.
2894 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2895 * testsuite/Makefile.in: Regenerate.
2896 * testsuite/icf_keep_unique_test.sh: New file.
2897 * testsuite/icf_keep_unique_test.cc: New file.
2899 2009-08-12 Cary Coutant <ccoutant@google.com>
2902 * resolve.cc (Symbol_table::resolve): Check for references from
2903 dynamic objects to hidden and internal symbols.
2904 * testsuite/Makefile.am (hidden_test.sh): New test.
2905 * testsuite/Makefile.in: Regenerate.
2906 * testsuite/hidden_test.sh: New script.
2907 * testsuite/hidden_test_1.c: New test source.
2908 * testsuite/hidden_test_main.c: New test source.
2910 2009-08-11 Doug Kwan <dougkwan@google.com>
2912 * arm.cc: Update comments.
2913 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2914 segment to locate the .ARM.exidx section if present.
2916 2009-08-09 Doug Kwan <dougkwan@google.com>
2918 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2921 2009-08-07 Sriraman Tallam <tmsriram@google.com>
2922 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2925 2009-08-06 Sriraman Tallam <tmsriram@google.com>
2927 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2928 valid tls_segment only for non-debug-section relocations.
2929 * testsuite/Makefile.am: Add gc_tls_test.
2930 * testsuite/Makefile.in: Regenerate.
2931 * testsuite/gc_tls_test.cc: New file.
2932 * testsuite/gc_tls_test.sh: New file.
2934 2009-08-05 Sriraman Tallam <tmsriram@google.com>
2938 * Makefile.am (CCFILES): Add icf.cc.
2940 * Makefile.in: Regenerate.
2941 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2942 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2943 section, symbol and addend information for the relocs.
2944 * gold.cc (queue_middle_tasks): Call identical code folding.
2945 * gold.h: Add defines for multimap.
2946 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2947 to the call of finalize_local_symbols.
2948 * main.cc (main): Create object of class Icf.
2949 * object.cc (Sized_relobj::do_layout): Allow this function to be
2950 called twice during icf.
2951 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2952 to sections marked as identical by icf.
2953 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2955 (Sized_relobj::do_section_entsize): New function.
2956 * object.h (Object::section_entsize): New function.
2957 (Object::do_section_entsize): New pure virtual function.
2958 (Relobj::finalize_local_symbols): Add new parameter.
2959 (Relobj::do_section_entsize): New function.
2960 * options.h (General_options::icf): New option.
2961 (General_options::icf_iterations): New option.
2962 (General_options::print_icf_sections): New option.
2963 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2964 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2965 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2967 * symtab.cc (Symbol_table::is_section_folded): New function.
2968 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2969 to sections marked as identical by icf.
2970 * symtab.h (Symbol_table::set_icf): New function.
2971 (Symbol_table::icf): New function.
2972 (Symbol_table::is_section_folded): New function.
2973 (Symbol_table::icf_): New data member.
2974 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2975 * testsuite/Makefile.am: Add commands to build icf_test.
2976 * testsuite/Makefile.in: Regenerate.
2977 * testsuite/icf_test.sh: New file.
2978 * testsuite/icf_test.cc: New file.
2980 2009-07-24 Chris Demetriou <cgd@google.com>
2982 * layout.cc (is_compressible_debug_section): Fix incorrect
2983 comment about compressed section names.
2985 2009-07-20 Ian Lance Taylor <ian@airs.com>
2988 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2990 2009-07-16 Ian Lance Taylor <iant@google.com>
2993 * layout.h: #include <map>.
2994 (class Kept_section): Change from struct to class. Add accessors
2995 and setters. Add section size to Comdat_group mapping. Change
2996 Comdat_group to std::map. Add is_comdat_ field. Add
2997 linkonce_size field in union.
2998 (class Layout): Update declaration of find_or_add_kept_section.
2999 Don't declare find_kept_object.
3000 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
3001 parameter. Add object, shndx, is_comdat, and is_group_name
3002 parameters. Change all callers. Adjust for new Kept_section.
3003 (Layout::find_kept_object): Remove.
3004 * object.cc (Sized_relobj::include_section_group): Update use of
3005 Kept_section. Rename secnum to shndx. Only record
3006 Kept_comdat_section if sections are the same size.
3007 (Sized_relobj::include_linkonce_section): Update use of
3008 Kept_section. Only record Kept_comdat_section if sections are the
3009 same size. Set size of linkonce section.
3010 (Sized_relobj::map_to_kept_section): Update call to
3011 get_kept_comdat_section.
3012 * object.h (class Sized_relobj): Rename fields in
3013 Kept_comdat_section to drop trailing underscores; change object
3014 field to Relobj*. Change Kept_comdat_section_table to store
3015 struct rather than pointer.
3016 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
3017 Add kept_object and kept_shndx parameters. Change all callers.
3018 (Sized_relobj::get_kept_comdat_section): Change return type to
3019 bool. Add kept_object and kept_shndx parameters. Change all
3021 * plugin.cc (Pluginobj::include_comdat_group): Update call to
3022 Layout::find_or_add_kept_section.
3024 2009-07-09 Ian Lance Taylor <iant@google.com>
3026 * merge.cc (Object_merge_map::initialize_input_to_output_map):
3027 Reserve space in the hash table.
3029 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
3031 * fileread.cc (File_read::get_mtime): New method.
3032 * fileread.h (Timespec): New structure.
3033 (File_read::get_mtime): New method.
3034 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
3035 Renamed from timestamp_nsec.
3036 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
3038 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
3040 (Incremental_inputs::report_archive): Save mtime; style fix.
3041 (Incremental_inputs::report_obejct): Save mtime; style fix.
3042 (Incremental_inputs::report_script): Save mtime; style fix.
3043 (Incremental_inputs::finalize_inputs): Style fix.
3044 (Incremental_inputs::finalize): Style fix.
3045 (Incremental_inputs::create_input_section_data): Store inputs
3047 * incremental.h (Incremental_inputs::report_script): Add mtime
3049 (Incremental_inputs::Input_info::Input_info): Intialize only one
3051 (Incremental_inputs::Input_info::archive): Move to nameless
3053 (Incremental_inputs::Input_info::obejct): Move to nameless union.
3054 (Incremental_inputs::Input_info::script): Move to nameless union.
3055 (Incremental_inputs::mtime): New field.
3056 * script.cc (read_input_script): Pass file mtime to
3058 * script.h (Script_info::inputs): Style fix.
3060 2009-07-01 Ian Lance Taylor <ian@airs.com>
3062 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
3065 2009-06-24 Ian Lance Taylor <iant@google.com>
3068 * layout.cc (Layout::choose_output_section): If we find an
3069 existing section, update the flags.
3070 (Layout::create_notes): New function, broken out of
3072 (Layout::finalize): Don't create note sections.
3073 (Layout::create_note): Don't crash if linker script discards
3075 (Layout::create_gold_note): Likewise.
3076 (Layout::create_build_id): Likewise. Don't set
3077 after_input_sections on the section.
3078 (Layout::create_executable_stack_info): Remove target parameter.
3080 * layout.h (class Layout): Declare create_notes. Update
3081 declaration of create_executable_stack_info.
3082 * gold.cc (queue_middle_tasks): Call create_notes.
3083 * output.cc (Output_section::update_flags_for_input_section): Move
3084 here from output.h. If SHF_ALLOC flag is newly set, mark address
3086 * output.h (Output_data::mark_address_invalid): New function.
3087 (class Output_section): Only declare, not define,
3088 update_flags_for_input_section. Remove set_flags.
3090 2009-06-24 Ian Lance Taylor <iant@google.com>
3092 * script-sections.cc (Output_section_definition::
3093 set_section_addresses): Rename shadowing local load_address to
3096 2009-06-24 Ian Lance Taylor <iant@google.com>
3099 * reloc.cc (relocate_sections): Skip empty relocation sections.
3101 2009-06-23 Ian Lance Taylor <iant@google.com>
3104 * layout.cc (Layout::create_note): Use choose_output_section
3105 rather than make_output_section.
3107 2009-06-23 Ian Lance Taylor <iant@google.com>
3110 * options.cc (General_options::parse_V): Set printed_version_.
3111 (General_options::General_options): Initialize printed_version_.
3112 * options.h (class General_options): Add printed_version_ field.
3113 * gold.cc (queue_initial_tasks): If there are no input files,
3114 don't give a fatal error if we printed the version information.
3115 (queue_middle_tasks): If using -r with a shared object, give a
3116 fatal error rather than an ordinary error.
3118 2009-06-23 Ian Lance Taylor <iant@google.com>
3121 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
3122 (Layout::make_output_section): Set have_stabstr_section_ if we see
3123 a .stab*str section.
3124 (Layout::finalize): Call link_stabs_sections.
3125 (Layout::link_stabs_sections): New file.
3126 * layout.h (class Layout): Add have_stabstr_section_ field.
3127 Declare link_stabs_sections.
3129 2009-06-23 Doug Kwan <dougkwan@google.com>
3131 * Makefile.am (libgold_a_LIBADD): New.
3132 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
3133 * Makefile.in: Regenerate.
3134 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
3135 * configure: Regenerate.
3136 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
3137 * fileread.cc: Include sys/state.h
3138 * gold.h: Declare memmem and strndup if found missing.
3139 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
3141 2009-06-23 Ian Lance Taylor <iant@google.com>
3143 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
3144 * configure: Rebuild.
3146 2009-06-23 Ian Lance Taylor <iant@google.com>
3149 * object.cc (Object::section_contents): Don't try to get a view if
3150 the section has length zero.
3151 (Object::handle_gnu_warning_section): If the section is empty, use
3152 the name of the section as the warning.
3154 2009-06-23 Ian Lance Taylor <iant@google.com>
3157 * stringpool.h (class Stringpool_template): Add optimize_ field.
3158 (Stringpool_template::set_optimize): New function.
3159 * stringpool.cc (Stringpool_template::Stringpool_template):
3160 Initialize optimize_ field.
3161 (Stringpool_template::set_string_offsets): Test local optimize
3162 fild rather than parameter.
3163 * layout.cc (Layout::Layout): Call set_optimize on the section
3166 2009-06-22 Ian Lance Taylor <iant@google.com>
3169 * yyscript.y: Parse TARGET.
3170 * script.cc (script_set_target): New function.
3171 * script-c.h (script_set_target): Declare.
3172 * options.cc (General_options::string_to_object_format): Rename
3173 from string_to_object_format in anonymous namespace. Change
3175 * options.h (class General_options): Declare
3176 string_to_object_format.
3178 2009-06-22 Ian Lance Taylor <iant@google.com>
3180 * script-sections.cc (Script_sections::create_segments): Don't put
3181 program headers in a PT_LOAD segment if -n or -N.
3183 2009-06-22 Ian Lance Taylor <iant@google.com>
3186 * options.h (class General_options): Add -z lazy and -z now. Sort
3187 -z options into alphabetical order.
3188 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3190 2009-06-21 Ian Lance Taylor <iant@google.com>
3192 * layout.cc (Layout::make_output_section): Call
3193 Target::new_output_section.
3194 (Layout::attach_allocated_section_to_segment): Put large section
3195 sections in a separate load segment with the large segment flag
3197 (Layout::segment_precedes): Sort large data segments after other
3199 (align_file_offset): New static function.
3200 (Layout::set_segment_offsets): Use align_file_offset.
3201 * output.h (class Output_section): Add is_small_section_ and
3202 is_large_section_ fields.
3203 (Output_section::is_small_section): New function.
3204 (Output_section::set_is_small_section): New function.
3205 (Output_section::is_large_section): New function.
3206 (Output_section::set_is_large_section): New function.
3207 (Output_section::is_large_data_section): New function.
3208 (class Output_segment): Add is_large_data_segment_ field.
3209 (Output_segment::is_large_data_segment): New function.
3210 (Output_segment::set_is_large_data_segment): New function.
3211 * output.cc (Output_section::Output_section): Initialize new
3213 (Output_segment::Output_segment): Likewise.
3214 (Output_segment::add_output_section): Add assertion that large
3215 data sections always go in large data segments. Force small data
3216 sections to the end of the list of data sections. Force small BSS
3217 sections to the start of the list of BSS sections. For large BSS
3218 sections to the end of the list of BSS sections.
3219 * symtab.h (class Symbol): Declare is_common_shndx.
3220 (Symbol::is_defined): Check Symbol::is_common_shndx.
3221 (Symbol::is_common): Likewise.
3222 (class Symbol_table): Define enum Commons_section_type. Update
3223 declarations. Add small_commons_ and large_commons_ fields.
3224 * symtab.cc (Symbol::is_common_shndx): New function.
3225 (Symbol_table::Symbol_table): Initialize new fields.
3226 (Symbol_table::add_from_object): Put small and large common
3227 symbols in the right list.
3228 (Symbol_table::sized_finalized_symbol): Check
3229 Symbol::is_common_shndx.
3230 (Symbol_table::sized_write_globals): Likewise.
3231 * common.cc (Symbol_table::do_allocate_commons): Allocate new
3232 common symbol lists. Don't call do_allocate_commons_list if the
3234 (Symbol_table::do_allocate_commons_list): Remove is_tls
3235 parameter. Add comons_section_type parameter. Change all
3236 callers. Handle small and large common symbols.
3237 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3238 Symbol::is_common_shndx.
3239 * resolve.cc (symbol_to_bits): Likewise.
3240 * target.h (Target::small_common_shndx): New function.
3241 (Target::small_common_section_flags): New function.
3242 (Target::large_common_shndx): New function.
3243 (Target::large_common_section_flags): New function.
3244 (Target::new_output_section): New function.
3245 (Target::Target_info): Add small_common_shndx, large_common_shndx,
3246 small_common_section_flags, and large_common_section_flags
3248 (Target::do_new_output_section): New virtual function.
3249 * arm.cc (Target_arm::arm_info): Initialize new fields.
3250 * i386.cc (Target_i386::i386_info): Likewise.
3251 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3253 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3254 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3255 (Target_x86_64::do_new_output_section): New function.
3256 * configure.ac: Define conditional MCMODEL_MEDIUM.
3257 * testsuite/Makefile.am (check_PROGRAMS): Add large.
3258 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3259 (large_LDFLAGS): Define.
3260 * testsuite/large.c: New file.
3261 * testsuite/testfile.cc (Target_test::test_target_info):
3262 Initialize new fields.
3263 * configure, testsuite/Makefile.in: Rebuild.
3265 2009-06-05 Doug Kwan <dougkwan@google.com>
3267 * Makefile.am (CCFILES): Add target.cc.
3268 * Makefile.in: Regenerate.
3269 * i386.cc (class Target_i386): Define new virtual method to
3270 override do_is_local_label_name in parent.
3271 * object.cc (Sized_relobj::do_count_local_symbols): Discard
3272 local symbols if --discard-locals or -X is given.
3273 * options.h (class General_options): Declare new options
3274 '--discard-locals' and '-X' for discarding locals.
3275 * target.h (class Target): Define new methods is_local_label_name.
3276 Declare new virtual method do_is_local_label_name.
3277 * target.cc: New file.
3278 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3279 (check_SCRIPTS): Add discard_locals_test.sh.
3280 (check_DATA): Add discard_local_tests.syms.
3281 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3282 (discard_local_tests.syms, discard_locals_test.o): New make rules.
3283 * testsuite/Makefile.in: Regenerate.
3284 * testsuite/discard_locals_test.c: New file.
3285 * testsuite/discard_locals_test.sh: Same.
3287 2009-06-05 Doug Kwan <dougkwan@google.com>
3289 * object.cc (Sized_relobj::Sized_relobj): Initialize
3290 discarded_eh_frame_shndx_ to -1U.
3291 (Sized_relobj::do_layout): Record index of a discard .eh_frame
3293 (Sized_relobj::do_count_local_symbols): Skip local symbols in
3294 a discarded .eh_frame section.
3295 (Sized_relobj::do_finalize_local_symbols): Ditto.
3296 * object.h (class Sized_relobj): Declare new member
3297 discarded_eh_frame_shndx_.
3298 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3299 (local_labels_test.o, local_labels_test): New rules.
3300 * testsuite/Makefile.in: Regenerate.
3302 2009-06-04 Doug Kwan <dougkwan@google.com>
3304 * layout.cc (Layout::section_name_mapping): Add mapping for
3305 special ARM sections.
3307 2009-06-03 Doug Kwan <dougkwan@google.com>
3309 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3310 (utils::has_overflow): Same.
3312 2009-06-03 Ian Lance Taylor <iant@google.com>
3314 * layout.cc (Layout::section_name_mapping): New array, replacing
3315 Layout::linkonce_mapping.
3316 (Layout::section_name_mapping_count): New variable, replacing
3317 Layout::linkonce_mapping_count.
3318 (Layout::linkonce_output_name): Remove.
3319 (Layout::output_section_name): Rewrite.
3320 * layout.h (class Layout): Rename Linkonce_mapping to
3321 Section_name_mapping, linkonce_mapping to section_name_mapping,
3322 linkonce_mapping_count to section_name_mapping_count. Don't
3323 declare linkonce_output_name.
3325 2009-06-03 Doug Kwan <dougkwan@google.com>
3327 * gold/arm.cc (namespace utils): New.
3328 (Target_arm::reloc_is_non_pic): Define new method.
3329 (class Arm_relocate_functions): New.
3330 (Target_arm::Relocate::relocate): Handle relocation types used by
3333 2009-06-03 Ian Lance Taylor <iant@google.com>
3335 * arm.cc (Target_arm::scan::global): Use || instead of |.
3337 2009-06-02 Doug Kwan <dougkwan@google.com>
3339 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3340 issued_non_pic_error_.
3341 (class Target_arm::Scan): Declare new method check_non_pic.
3342 Define new method symbol_needs_plt_entry.
3343 Declare new data member issued_non_pic_error_.
3344 (class Target_arm::Relocate): Declare new method
3345 should_apply_static_reloc.
3346 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3347 (Target_arm::Scan::check_non_pic): Define new method.
3348 (Target_arm::Scan::local): Handle a small subset of reloc types used
3350 (Target_arm::Scan::local): Same.
3351 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3353 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3355 * incremental.cc (Incremental_inputs::report_command_line): Filter
3356 out --incremental-* options.
3358 2009-05-29 Doug Kwan <dougkwan@google.com>
3360 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3362 (class Target_arm): Update comment.
3363 (Target_arm::Target_arm): Initialize new data members GOT_,
3364 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3365 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3366 and Target_arm::rel_dyn_section.
3367 Declare new_enum Target_arm::Got_type.
3368 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3370 Update commments for member do_dynsym_value.
3371 (Target_arm::got_size, Target_arm::plt_section,
3372 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3373 new methods inside class defintion.
3374 (Target_arm::got_section): Define new method.
3375 (Target_arm::rel_dyn_section): Same.
3376 (Output_data_plt_arm): New template class.
3377 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3378 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3379 (Output_data_plt_arm::add_entry): Same.
3380 (Output_data_plt_arm::first_plt_entry): Define new
3381 static data member for PLT instruction template.
3382 (Output_data_plt_arm::plt_entry): Same.
3383 (Output_data_plt_arm::do_write): Define new method.
3384 (Target_arm::make_plt_entry): Same.
3385 (Target_arm::do_finalize_sections): Same.
3386 (Target_arm::do_dynsym_value): Same.
3388 2009-05-28 Doug Kwan <dougkwan@google.com>
3390 * Makefile.am (TARGETSOURCES): Add arm.cc.
3391 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3392 * Makefile.in: Regenerate.
3394 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3396 2009-05-26 Doug Kwan <dougkwan@google.com>
3398 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3399 (General_options::check_excluded_libs): Strip off directories in
3400 archive name before matching like GNU ld does.
3401 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3402 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3403 (exclude_libs_test_LDFLAGS): Add linker option
3404 -Wl,--exclude-libs,libexclude_libs_test_3
3405 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3406 an explicit archive without using -l.
3407 (alt/libexclude_libs_test_3.a): New make rule.
3408 * testsuite/Makefile.in: Regenerate.
3409 * testsuite/exclude_libs_test.c : Declare lib3_default().
3411 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3412 * exclude_libs_test_3.c: New file.
3414 2009-05-26 Nick Clifton <nickc@redhat.com>
3416 * po/id.po: New Indonesian translation.
3417 * po/gold.pot: Updated template file.
3419 2009-05-22 Sriraman Tallam <tmsriram@google.com>
3421 * testsuite/Makefile.am: Add -ffunction-sections to compile
3422 gc_comdat_test files. Add -Wl,--gc-sections to build
3424 * testsuite/Makefile.in: Regenerate.
3425 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3427 2009-05-21 Sriraman Tallam <tmsriram@google.com>
3429 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3430 kept comdat section was garbage collected.
3431 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3432 * testsuite/Makefile.in: Regenerate.
3433 * testsuite/gc_comdat_test.sh: New file.
3434 * testsuite/gc_comdat_test_1.cc: New file.
3435 * testsuite/gc_comdat_test_2.cc: New file.
3437 2009-05-19 Doug Kwan <dougkwan@google.com>
3439 * archive.cc (Archive::Archive): Move constructor from archive.h
3440 to here. Initialize no_export_.
3441 (Archive::get_elf_object_for_member): Set no_export flag of object.
3442 * archive.h (Archive::Archive): Move constructor body to
3444 (Archive::no_export): New method.
3445 (Archive::no_export_): New field.
3446 * object.h (Object::Object): Initialize no_export_ to false.
3447 (Object::no_export, Object::set_no_export): New methods.
3448 (Object::no_export_): New field.
3449 * options.cc (General_options::parse_exclude_libs): New method.
3450 (General_options::check_excluded_libs) Same.
3451 * options.h (exclude_libs): New option.
3452 (General_options::check_excluded_libs): New method declaration.
3453 (General_options::excluded_libs_): New field.
3454 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3455 default or protected visibility if an object has no-export flag set.
3456 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3457 (check_SCRIPTS): Add exclude_libs_test.sh.
3458 (check_DATA): Add exclude_libs_test.syms.
3459 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3460 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3461 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3462 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3463 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3464 libexclude_libs_test_2.a): New rules.
3465 * testsuite/Makefile.in: Regenerate.
3466 * testsuite/exclude_libs_test.c: New file.
3467 * testsuite/exclude_libs_test.sh: Ditto.
3468 * testsuite/exclude_libs_test_1.c: Ditto.
3469 * testsuite/exclude_libs_test_2.c: Ditto.
3471 2009-05-15 Ian Lance Taylor <iant@google.com>
3473 * configure.ac: Check for declarations for cases where libiberty.h
3474 checks HAVE_DECL_xxx.
3475 * configure, config.in: Rebuild.
3477 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3479 * gold.h (Incremental_argument_list): Remove (invalid) forward
3481 * incremental.cc (Incremental_inputs::report_achive): New method.
3482 (Incremental_inputs::report_object): New method.
3483 (Incremental_inputs::report_script): New method.
3484 (Incremental_inputs::finalize_inputs): New method.
3485 (Incremental_inputs::finalize): Call finalize_inputs().
3486 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3487 Create inputs entries.
3488 * incremental.h (Incremental_input_type): New enum.
3489 (Incremental_inputs::Incremental_input): Initialize new fields.
3490 (Incremental_inputs::report_inputs): New method.
3491 (Incremental_inputs::report_achive): New method.
3492 (Incremental_inputs::report_object): New method.
3493 (Incremental_inputs::report_script): New method.
3494 (Incremental_inputs::finalize_inputs): New method.
3495 (Incremental_inputs::Input_info): New struct.
3496 (Incremental_inputs::Input_info_map): New typedef.
3497 (Incremental_inputs::lock_): New field.
3498 (Incremental_inputs::Inputs_): New field.
3499 (Incremental_inputs::Inputs_map): New field.
3500 * main.cc (main): Call Incremental_input::report_inputs.
3501 * options.h (Input_argument_list): Typedef moved from
3503 (Input_file_group::Files): Remove, use ::Input_argument_list.
3504 (Input_file_group::Input_argument_list): Remove, use
3505 ::Input_argument_list.
3506 * plugin.cc (Plugin_manager::add_input_file): Add error in
3508 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3510 * script.cc (read_input_script): Call
3511 Incremental_input::report_script.
3512 * script.h (Script_info): New class.
3514 2009-04-27 Ian Lance Taylor <iant@google.com>
3516 * x86_64.cc (do_adjust_output_section): Set entsize to
3519 2009-04-23 Elliott Hughes <enh@google.com>
3521 * output.cc (Output_file::close): After short writes, continue
3522 writing from the correct offset in the buffer being written.
3524 2009-04-23 Chris Demetriou <cgd@google.com>
3526 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3527 * configure: Regenerate.
3528 * config.in: Regenerate.
3529 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3530 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3532 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
3534 * incremental.cc (Incremental_inputs_header_data): Renamed from
3535 Incremental_input_header_data.
3536 (Incremental_inputs_header_data::data_size): New field.
3537 (Incremental_inputs_header_data::put_input_file_count): Renamed
3538 from input_file_count.
3539 (Incremental_inputs_header_data::put_command_line_offset): Renamed
3540 from command_line_offset.
3541 (Incremental_inputs_header_data::put_reserved): Renamed from
3543 (Incremental_inputs_entry_data): Renamed from
3544 Incremental_input_entry_data.
3545 (Incremental_inputs_entry_data::data_size): New field.
3546 (Incremental_inputs::report_command_line): New method.
3547 (Incremental_inputs::finalize): New method.
3548 (Incremental_inputs::create_incremental_inputs_data): New method.
3549 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3550 * incremental.h: New file.
3551 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3552 (Layout::finalize): Create incremental inputs section in
3554 (Layout::create_incremental_info_sections): New method.
3555 * layout.h (Layout::incremental_inputs): New method.
3556 (Layout::create_incremental_info_sections): New method.
3557 (Layout::incremental_inputs_): New field.
3558 * main.cc (main): Notify Incremental_input of the command line.
3560 2009-04-01 Ian Lance Taylor <iant@google.com>
3561 Mikolaj Zalewski <mikolajz@google.com>
3563 * gold.h (reserve_unordered_map): Define, three versions, one for
3564 each version of Unordered_map.
3565 * layout.cc (Layout::Layout): Remove options parameter. Add
3566 number_of_input_files parameter. Don't initialize options_.
3567 Initialize number_of_input_files_ and resized_signatures_. Move
3568 sections_are_attached_.
3569 (Layout::layout_group): Reserve space for group_signatures_.
3570 (Layout::find_or_add_kept_section): Change name parameter to be a
3571 reference. Resize signatures_ map when it gets large enough.
3572 (Layout::layout_eh_frame): Use parameters->options() instead of
3574 (Layout::make_output_section): Likewise.
3575 (Layout::attach_allocated_section_to_segment): Likewise.
3576 (Layout::finalize, Layout::create_executable_stack): Likewise.
3577 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3578 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3579 * layout.h (class Layout): Update declarations. Remove options_
3580 field. Add number_of_input_files_ and resized_signatures_
3581 fields. Move sections_are_attached_ field.
3582 * main.cc (main): Pass number of input files to Layout
3583 constructor. Don't pass options.
3585 2009-03-30 Ian Lance Taylor <iant@google.com>
3587 * ffsll.c (ffsll): Correct implementation.
3589 2009-03-27 Ian Lance Taylor <iant@google.com>
3591 * ffsll.c: New file.
3592 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3593 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3594 * ftruncate.c (ftruncate): Declare before definition.
3595 * mremap.c (mremap): Likewise.
3596 * pread.c (pread): Likewise.
3597 * configure, Makefile.in, config.in: Rebuild.
3599 * mremap.c: New file.
3600 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3601 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3602 (mremap): Declare if HAVE_MREMAP is not defined.
3603 * configure, Makefile.in, config.in: Rebuild.
3605 2009-03-27 Cary Coutant <ccoutant@google.com>
3607 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3608 position independent.
3609 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3610 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3612 2009-03-24 Cary Coutant <ccoutant@google.com>
3614 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3616 (needs_dynamic_reloc): Likewise.
3618 2009-03-24 Ian Lance Taylor <iant@google.com>
3620 * yyscript.y (file_cmd): Recognize EXTERN.
3621 (extern_name_list, extern_name_list_body): New nonterminals.
3622 * script.cc (script_add_extern): Define.
3623 * script-c.h (script_add_extern): Declare.
3625 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
3627 * object.cc (is_elf_object): Define.
3628 * object.h (is_elf_object): Declare.
3629 * archive.cc (Archive::get_elf_object_for_member): Call
3631 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3633 2009-03-24 Elliott Hughes <enh@google.com>
3635 * output.cc (Output_file::map_anonymous): Define.
3636 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3637 try an anonymous one. Report the size if the mmap fails.
3638 * output.h (class Output_file): Declare map_anonymous.
3640 2009-03-24 Ian Lance Taylor <iant@google.com>
3642 * target-select.cc (instantiate_target): Don't acquire the lock if
3643 the instantiated_target_ field has already been set.
3645 2009-03-23 Ian Lance Taylor <iant@google.com>
3647 * gold-threads.h (class Initialize_lock): Define.
3648 * gold-threads.cc (class Initialize_lock_once): Define.
3649 (initialize_lock_control): New static variable.
3650 (initialize_lock_pointer): New static variable.
3651 (initialize_lock_once): New static function.
3652 (Initialize_lock::Initialize_lock): Define.
3653 (Initialize_lock::initialize): Define.
3654 * target-select.h: Include "gold-threads.h".
3655 (class Target_selector): Add lock_ and initialize_lock_ fields.
3656 Don't define instantiate_target, just declare it.
3657 * target-select.cc (Target_selector::Target_selector): Initialize
3659 (Target_selector::instantiate_target): Define.
3660 * descriptors.h: Include "gold-threads.h".
3661 (class Descriptors): Add initialize_lock_ field.
3662 * descriptors.cc (Descriptors::Descriptors): Initialize new
3664 (Descriptors::open): Use initialize_lock_ field
3665 * errors.h (class Errors): Add initialize_lock_ field.
3666 * errors.cc (Errors::Errors): Initialize new field.
3667 (Errors::initialize_lock): Use initialize_lock_ field.
3668 * powerpc.cc (class Target_selector_powerpc): Remove
3669 instantiated_target_ field. In do_recognize call
3670 instantiate_target rather than do_instantiate_target. In
3671 do_instantiate_target just allocate a new target.
3672 * sparc.cc (class Target_selector_sparc): Likewise.
3674 * freebsd.h: New file.
3675 * i386.cc: Include "freebsd.h".
3676 (Target_i386): Derive from Target_freebsd rather than
3678 (Target_selector_i386): Derive from Target_selector_freebsd rather
3679 than Target_selector.
3680 * x86_64.cc: Include "freebsd.h".
3681 (Target_x86_64): Derive from Target_freebsd rather than
3683 (Target_selector_x86_64): Derive from Target_selector_freebsd
3684 rather than Target_selector.
3685 * target.h (class Target): Add adjust_elf_header and
3686 do_adjust_elf_header.
3687 * output.cc (Output_file_header:: do_sized_write): Call target
3688 adjust_elf_header routine.
3689 * configure.tgt: Set targ_osabi.
3690 * configure.ac: Define GOLD_DEFAULT_OSABI.
3691 * parameters.cc (Parameters::default_target): Pass
3692 GOLD_DEFAULT_OSABI to select_target.
3693 * target-select.h (class Target_selector): Make instantiate_target
3694 protected rather than private.
3695 * Makefile.am (HFILES): Add freebsd.h.
3696 * configure, Makefile.in, config.in: Rebuild.
3698 * merge.cc (do_add_input_section): Correct pend value. Change
3699 message about last entry not being null terminated from error to
3702 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3704 * incremental.cc: New file.
3705 * Makefile.am (CCFILES): Add incremental.cc.
3706 * Makefile.in: Rebuild.
3708 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3710 * layout.cc (Layout::output_section_name): Preserve names
3711 of '.note.' sections.
3713 2009-03-19 Ian Lance Taylor <iant@google.com>
3715 * descriptors.cc (Descriptors::open): Check that the options are
3716 valid before using them.
3718 2009-03-18 Ian Lance Taylor <iant@google.com>
3720 * script-sections.h: Include <list>.
3721 (class Script_sections): Change Sections_elements from std::vector
3722 to std::list. Typedef public Elements_iterator. Add
3723 orphan_section_placement_, data_segment_align_start_, and
3724 saw_data_segment_align_ fields. Remove data_segment_align_index_
3726 * script-sections.cc (class Orphan_section_placement): New class.
3727 (class Sections_element): Add virtual functions is_relro and
3728 orphan_section_init. Remove virtual function place_orphan_here.
3729 (class Output_section_definition): Add is_relro and
3730 orphan_section_init. Remove place_orphan_here.
3731 (class Orphan_output_section): Likewise.
3732 (Script_sections::Script_sections): Update for field changes.
3733 (Script_sections::data_segment_align): Set saw_data_segment_align_
3734 and data_segment_align_start_, not data_segment_align_index.
3735 (Script_sections::data_segment_relro_end): Check
3736 saw_data_segment_align_. Use data_segment_align_start_ rather
3737 than data_segment_align_index_.
3738 (Script_sections::place_orphan): Rewrite to use
3739 Orphan_section_placement.
3741 2009-03-17 Ian Lance Taylor <iant@google.com>
3743 * archive.cc (Archive::add_symbols): Check for a version attached
3744 to the symbol name in the archive map.
3745 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3746 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3747 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3748 (ver_test_11.a): New target.
3749 * testsuite/Makefile.in: Rebuild.
3751 * configure.ac: Check for chsize and posix_fallocate. Replace
3753 * ftruncate.c: New file, from gnulib.
3754 * output.cc (posix_fallocate): Define dummy version if not
3755 HAVE_POSIX_FALLOCATE.
3756 (Output_file::map): Call posix_fallocate rather than lseek and
3758 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3759 * configure, Makefile.in, config.in: Rebuild.
3761 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3763 * layout.h (Layout::create_note): Add section_name parameter.
3764 * layout.cc (Layout::create_note): Likewise.
3765 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3767 2009-03-17 Ian Lance Taylor <iant@google.com>
3769 * descriptors.cc: Include "options.h".
3770 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3771 (Descriptors::open): Always use O_CLOEXEC when opening a new
3772 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3773 then set FD_CLOEXEC.
3775 * sparc.cc (class Target_sparc): Add has_got_section.
3776 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3777 make sure we have a GOT section.
3779 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3780 (Target_sparc::Scan::local): Likewise.
3781 (Target_sparc::Scan::global): Likewise.
3782 (Target_sparc::Relocate::relocate): Likewise.
3783 (Target_sparc::Relocate::relocate_tls): Likewise.
3785 * symtab.cc (Symbol_table::define_default_version): New function,
3786 broken out of add_from_object.
3787 (Symbol_table::add_from_object): Call define_default_version.
3788 (Symbol_table::define_special_symbol): Add resolve_oldsym
3789 parameter. Change all callers. If the version for a symbol comes
3790 from a version script, resolve it with the symbol with the same
3791 name with no version. Also add the symbol without a version if
3793 (do_define_in_output_data): If resolving with oldsym, don't delete
3795 (do_define_in_output_segment): Likewise.
3796 (do_define_as_constant): Likewise.
3797 * symtab.h (class Symbol_table): Update declarations.
3799 2009-03-13 Ian Lance Taylor <iant@google.com>
3801 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3802 (Read_symbols::requeue): New function.
3803 (Read_symbols::do_read_symbols): If make_elf_object fails because
3804 the target type is not configured, and the file was searched for,
3805 issue a warning and retry with the next directory.
3806 (Add_symbols::run): If the file has an incompatible format, and
3807 it was searched for, requeue the Read_symbols task. On error,
3809 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3810 dirindex parameter to constructor. Change all callers. Declare
3811 incompatible_warning and requeue.
3812 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3813 input_argument_ and input_group_ fields. Add them to
3814 constructor. Change all callers.
3815 (class Read_script): Add dirindex_ field. Add it to constructor.
3817 * archive.cc (Archive::setup): Remove input_objects parameter.
3819 (Archive::get_file_and_offset): Likewise.
3820 (Archive::read_all_symbols): Likewise.
3821 (Archive::read_symbols): Likewise.
3822 (Archive::get_elf_object_for_member): Remove input_objects
3823 parameter. Add punconfigured parameter. Change all callers.
3824 (Archive::add_symbols): Change return type to bool. Check return
3825 value of include_member.
3826 (Archive::include_all_members): Likewise.
3827 (Archive::include_member): Change return type to bool. Return
3828 false if first included object has incompatible target. Set
3829 included_member_ field.
3830 (Add_archive_symbols::run): If add_symbols returns false, requeue
3832 * archive.h (class Archive): Add included_member_ field.
3833 Initialize it in constructor. Add input_file and searched_for
3834 methods. Update declarations.
3835 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3836 input_argument_ fields. Add them to constructor. Change all
3838 * script.cc: Include "target-select.h".
3839 (class Parser_closure): Add skip_on_incompatible_target_ and
3840 found_incompatible_target_ fields. Add
3841 skip_on_incompatible_target parameter to constructor. Change all
3842 callers. Add methods skip_on_incompatible_target,
3843 clear_skip_on_incompatible_target, found_incompatible_target, and
3844 set_found_incompatible_target.
3845 (read_input_script): Add dirindex parameter. Change all callers.
3846 If parser finds an incompatible target, requeue Read_symbols
3848 (script_set_symbol): Clear skip_on_incompatible_target in
3850 (script_add_assertion, script_parse_option): Likewise.
3851 (script_start_sections, script_add_phdr): Likewise.
3852 (script_check_output_format): New function.
3853 * script.h (read_input_script): Update declaration.
3854 * script-c.h (script_check_output_format): Declare.
3855 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3856 (ignore_cmd): Remove OUTPUT_FORMAT.
3857 * fileread.cc (Input_file::Input_file): Add explicit this.
3858 (Input_file::will_search_for): New function.
3859 (Input_file::open): Add pindex parameter. Change all callers.
3860 * fileread.h (class Input_file): Add input_file_argument method.
3861 Declare will_search_for. Update declarations.
3862 * object.cc (make_elf_object): Add punconfigured parameter.
3864 * object.h (class Object): Make input_file public. Add
3865 searched_for method.
3866 (make_elf_object): Update declaration.
3867 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3869 * dirsearch.h (class Dirsearch): Update declaration.
3870 * options.h (class General_options): Add --warn-search-mismatch.
3871 * parameters.cc (Parameters::is_compatible_target): New function.
3872 * parameters.h (class Parameters): Declare is_compatible_target.
3873 * workqueue.cc (Workqueue::add_blocker): New function.
3874 * workqueue.h (class Workqueue): Declare add_blocker.
3876 * fileread.cc (Input_file::open): Remove options parameter.
3878 (Input_file::open_binary): Likewise.
3879 * script.cc (read_input_script): Likewise.
3880 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3881 options parameter from constructor. Change all callers.
3882 (class Read_script): Likewise.
3883 * fileread.h (class Input_file): Update declarations.
3884 * script.h (read_input_script): Update declaration.
3886 2009-03-10 Nick Clifton <nickc@redhat.com>
3888 * po/es.po: New Spanish translation.
3890 2009-03-06 Cary Coutant <ccoutant@google.com>
3892 * options.cc (parse_short_option): Keep dash_z from registering itself.
3894 2009-03-03 Ian Lance Taylor <iant@google.com>
3897 * target-reloc.h (relocate_section): Pass output_section to
3899 * i386.cc (Target_i386::should_apply_static_reloc): Add
3900 output_section parameter. Change all callers.
3901 (Target_i386::Relocate::relocate): Add output_section parameter.
3902 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3903 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3904 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3905 * testsuite/two_file_shared.sh: New script.
3906 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3907 (check_DATA): Add two_file_shared.dbg.
3908 (two_file_shared.dbg): New target.
3909 * testsuite/Makefile.in: Rebuild.
3911 2009-03-01 Ian Lance Taylor <iant@google.com>
3913 * configure.ac: Check for byteswap.h.
3914 * configure: Rebuild.
3915 * config.in: Rebuild.
3917 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3919 * layout.cc (Layout::find_or_add_kept_section): New function.
3920 (Layout::add_comdat): Removed.
3921 * layout.h (struct Kept_section): Move out of class Layout.
3922 Remove trailing underscores from field names. Add group_sections
3923 field. Rename group_ field to is_group. Change all uses.
3924 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3925 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3926 comdat_groups_ field.
3927 (Sized_relobj::include_section_group): Use
3928 find_or_add_kept_section and Kept_section::group_sections.
3929 (Sized_relobj::include_linkonce_section): Likewise.
3930 * object.cc (class Sized_relobj): Don't define Comdat_group or
3931 Comdat_group_table. Remove find_comdat_group and
3932 add_comdat_group. Remove comdat_groups_ field.
3933 * plugin.cc (include_comdat_group): Use
3934 Layout::find_or_add_kept_section.
3936 2009-02-28 Ian Lance Taylor <iant@google.com>
3938 * README: --gc-sections and map files are now supported. Document
3939 some build requirements.
3942 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3943 relocatable link set the value of the section symbol to zero.
3944 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3945 relocatable link don't include the section address in the local
3948 2009-02-27 Ian Lance Taylor <iant@google.com>
3951 * options.h (class Search_directory): Add is_system_directory.
3952 (class General_options): Declare is_in_system_directory.
3953 * options.cc (get_relative_sysroot): Make static.
3954 (get_default_sysroot): Make static.
3955 (General_optoins::is_in_system_directory): New function.
3956 * fileread.cc (Input_file::is_in_system_directory): New function.
3957 * fileread.h (class Input_file): Declare is_in_system_directory.
3958 * object.h (class Object): Add is_in_system_directory.
3959 (class Input_objects): Remove system_library_directory_ field.
3960 * object.cc (Input_objects::add_object): Don't set
3961 system_library_directory_.
3962 (input_objects::found_in_system_library_directory): Remove.
3963 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3964 parameter. Change all callers.
3965 (Symbol_table::sized_write_globals): Likewise.
3966 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3967 Call Object::is_in_system_directory.
3968 * symtab.h (class Symbol_table): Update declarations.
3971 * descriptors.h (Open_descriptor): Add is_on_stack field.
3972 * descriptors.cc (Descriptors::open): If the descriptor is on the
3973 top of the stack, remove it. Initialize is_on_stack field.
3974 (Descriptors::release): Only add pod to stack if it is not on the
3976 (Descriptors::close_some_descriptor): Clear stack_next and
3980 * output.cc (Output_section::find_starting_output_address): Rename
3981 from starting_output_address; add PADDR parameter; change return
3983 * output.h (class Output_section): Declare
3984 find_starting_output_address instead of starting_output_address.
3985 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3986 section symbol for which we can't find a merge section.
3989 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3990 hidden or internal, force the symbol to be local.
3991 * resolve.cc (Symbol::override_visibility): Define.
3992 (Symbol::override_base): Use override_visibility.
3993 (Symbol_table::resolve): Likewise.
3994 (Symbol::override_base_with_special): Likewise.
3995 (Symbol_table::override_with_special): If the visibility is hidden
3996 or internal, force the symbol to be local.
3997 * symtab.h (class Symbol): Add set_visibility and
3998 override_visibility.
3999 * testsuite/ver_test_1.sh: New file.
4000 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
4001 (check_DATA): Add ver_test_1.syms.
4002 (ver_test_1.syms): New target.
4003 * testsuite/Makefile.in: Rebuild.
4005 2009-02-25 Cary Coutant <ccoutant@google.com>
4007 * layout.cc (Layout::choose_output_section): Don't rename sections
4008 when using a linker script that has a SECTIONS clause.
4009 * Makefile.in: Regenerate.
4011 * testsuite/Makefile.am (script_test_5.sh): New test case.
4012 * testsuite/Makefile.in: Regenerate.
4013 * testsuite/script_test_5.cc: New file.
4014 * testsuite/script_test_5.sh: New file.
4015 * testsuite/script_test_5.t: New file.
4017 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
4019 * archive.cc (Archive::include_member): Update calls to add_symbols.
4020 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
4021 the Layout argument.
4022 * dynobj.h (do_add_symbols): Add the Layout argument.
4023 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
4025 * object.h (Object::add_symbols): Add the Layout argument.
4026 (Object::do_add_symbols): Add the Layout argument.
4027 (Sized_relobj::do_add_symbols): Add the Layout argument.
4028 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
4029 Unify the two versions.
4030 (Add_plugin_symbols): Remove.
4031 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
4032 (Sized_pluginobj::do_add_symbols): Unify the two versions.
4033 (Add_plugin_symbols): Remove.
4034 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
4035 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
4036 (Add_symbols::run): Make it work with Pulginobj.
4038 2009-02-06 Ian Lance Taylor <iant@google.com>
4040 * object.cc (Sized_relobj::do_layout): Make info message start
4041 with lower case letter.
4043 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
4045 * binary.cc: Fix file comment.
4047 * options.h (enum Incremental_disposition): Define.
4048 (class General_options): Add new options: --incremental,
4049 --incremental_changed, --incremental_unchanged,
4050 --incremental_unknown. Add incremental_disposition_ and
4051 implicit_incremental_ fields.
4052 (General_options::incremental_disposition): New function.
4053 (class Position_dependent_options): Add incremental_disposition
4055 (Position_dependent_options::copy_from_options): Set incremental
4057 * options.cc (General_options::parse_incremental_changed): New
4059 (General_options::parse_incremental_unchanged): New function.
4060 (General_options::parse_incremental_unknown): New function.
4061 (General_options::General_options): Initialize new fields
4062 incremental_disposition_ and implicit_incremental_.
4063 (General_options::finalize): Check for uasge of --incremental-*
4064 without --incremental.
4066 2009-02-06 Chris Demetriou <cgd@google.com>
4068 * gold.h (gold_undefined_symbol): Change to take only a Symbol
4069 pointer and to report location as the file name associated with
4071 (gold_undefined_symbol_at_location): New function to replace the
4072 old gold_undefined_symbol functionality.
4073 * target-reloc.h (relocate_section): Update to use
4074 gold_undefined_symbol_at_location.
4075 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4076 Call gold_undefined_symbol function rather than gold_error.
4077 * errors.h (Errors::undefined_symbol): Take location as a
4078 string, rather than calculating it from a relocation.
4079 * errors.cc (Errors::fatal): Print "fatal error:" before the
4081 (Errors::error, Errors::error_at_location): Print "error: "
4082 before the formatted message.
4083 (Errors::undefined_symbol): Take location as a string, rather
4084 than calculating it from a relocation.
4085 (gold_undefined_symbol_at_location): New function akin to
4086 old gold_undefined_symbol, calculates location from relocation.
4087 (gold_undefined_symbol): Change to take only a Symbol pointer
4088 and to report location as the file name associated with the symbol.
4089 * testsuite/debug_msg.sh: Update for changed error messages.
4090 * testsuite/undef_symbol.sh: Likewise.
4092 2009-02-04 Duncan Sands <baldrick@free.fr>
4095 * reduced_debug_output.h
4096 (Output_reduced_debug_abbrev_section::failed): Use format for
4098 (Output_reduced_debug_info_section::faild): Likewise.
4100 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
4102 * script.cc (Lazy_demangler): New class.
4103 (Version_script_info::get_symbol_version_helper): Demangle a
4106 2009-01-29 Cary Coutant <ccoutant@google.com>
4108 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
4110 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4112 2009-01-28 Ian Lance Taylor <iant@google.com>
4114 * version.cc (version_string): Bump to 1.9.
4116 * gold.h: Include <cstring> and <stdint.h>.
4117 * version.cc: Include <cstdio>.
4118 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
4120 * reduced_debug_output.cc (insert_into_vector): Rename from
4121 Insert_into_vector; change all callers. Use Swap_unaligned to
4122 avoid aliasing issue; remove union since it is unnecessary.
4124 2009-01-27 Sriraman Tallam <tmsriram@google.com>
4126 * Makefile.am (CCFILES): Add gc.cc.
4128 * Makefile.in: Regenerate.
4129 * gold.cc (Gc_runner): New class.
4130 (queue_initial_tasks): Call garbage collection related tasks
4131 when corresponding options are invoked.
4132 (queue_middle_gc_tasks): New function.
4133 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
4134 processed early before laying out sections during garbage collection.
4135 * gold.h (queue_middle_gc_tasks): New function.
4136 (is_prefix_of): Move from "layout.cc".
4137 * i386.cc (Target_i386::gc_process_relocs): New function.
4138 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
4139 * main.cc (main): Create object of class "Garbage_collection".
4140 * object.cc (Relobj::copy_symbols_data): New function.
4141 (Relobj::is_section_name_included): New function.
4142 (Sized_relobj::do_layout): Allow this function to be called twice
4143 during garbage collection and defer layout of section during the
4145 * object.h (Relobj::get_symbols_data): New function.
4146 (Relobj::is_section_name_included): New function.
4147 (Relobj::copy_symbols_data): New function.
4148 (Relobj::set_symbols_data): New function.
4149 (Relobj::get_relocs_data): New function.
4150 (Relobj::set_relocs_data): New function.
4151 (Relobj::is_output_section_offset_invalid): New pure virtual function.
4152 (Relobj::gc_process_relocs): New function.
4153 (Relobj::do_gc_process_relocs): New pure virtual function.
4154 (Relobj::sd_): New data member.
4155 (Sized_relobj::is_output_section_offset_invalid): New function.
4156 (Sized_relobj::do_gc_process_relocs): New function.
4157 * options.h (General_options::gc_sections): Modify to not be a no-op.
4158 (General_options::print_gc_sections): New option.
4159 * plugin.cc (Plugin_finish::run): Remove function call to
4160 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
4161 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4162 * reloc.cc (Read_relocs::run): Add task to process relocs and
4163 determine unreferenced sections when doing garbage collection.
4164 (Gc_process_relocs): New class.
4165 (Sized_relobj::do_gc_process_relocs): New function.
4166 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4167 sections that are garbage collected.
4168 * reloc.h (Gc_process_relocs): New class.
4169 * sparc.cc (Target_sparc::gc_process_relocs): New function.
4170 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4171 symbols whose corresponding sections are garbage collected.
4172 (Symbol_table::Symbol_table): Add new parameter for the garbage
4174 (Symbol_table::gc_mark_undef_symbols): New function.
4175 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4176 (Symbol_table::gc_mark_dyn_syms): New function.
4177 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4179 (Symbol_table::add_from_object): Likewise.
4180 (Symbol_table::add_from_relobj): When building shared objects, do not
4181 treat externally visible symbols as garbage.
4182 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4183 table information for static and relocatable links.
4184 * symtab.h (Symbol_table::set_gc): New function.
4185 (Symbol_table::gc): New function.
4186 (Symbol_table::gc_mark_undef_symbols): New function.
4187 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4188 (Symbol_table::gc_mark_dyn_syms): New function.
4189 (Symbol_table::gc_): New data member.
4190 * target.h (Sized_target::gc_process_relocs): New pure virtual
4192 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4193 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4195 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
4197 * options.h (General_options::gc_sections): Define as a no-op for now.
4198 (General_options::no_keep_memory): Ditto.
4199 (General_options::Bshareable): Define.
4200 * options.cc (General_options::finalize): Honor -Bshareable.
4202 2009-01-20 Andreas Schwab <schwab@suse.de>
4204 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4205 read the value in the contents, since we don't use it. Use the
4206 template endianness when writing.
4207 (Relocate::relocate): Use it for R_PPC_REL16_HA.
4209 2009-01-19 Andreas Schwab <schwab@suse.de>
4211 * configure.tgt (powerpc64-*): Fix targ_obj.
4213 2009-01-15 Ian Lance Taylor <iant@google.com>
4215 * object.cc (Sized_relobj::write_local_symbols): Don't write out
4216 local symbols when stripping all symbols.
4218 2009-01-14 Cary Coutant <ccoutant@google.com>
4220 * output.cc (Output_reloc): Add explicit instantiations.
4222 2009-01-14 Cary Coutant <ccoutant@google.com>
4224 * archive.cc (Archive::get_elf_object_for_member): Remove call
4225 to File_read::claim_for_plugin.
4226 * descriptors.cc (Descriptors::open): Remove reference to
4228 (Descriptors::claim_for_plugin): Remove.
4229 * descriptors.h (Descriptors::claim_for_plugin): Remove.
4230 (Descriptors::is_claimed): Remove.
4231 (claim_descriptor_for_plugin): Remove.
4232 * fileread.cc (File_read::claim_for_plugin): Remove.
4233 * fileread.h (File_read::claim_for_plugin): Remove.
4234 (File_read::descriptor): Reopen descriptor if necessary.
4235 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
4236 (Plugin_manager::all_symbols_read): Add task parameter. Change
4238 (Plugin_manager::get_input_file): New function.
4239 (Plugin_manager::release_input_file): New function.
4240 (Pluginobj::Pluginobj): Add filesize parameter and initialize
4241 corresponding data member.
4242 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4243 and pass to base constructor. Change all callers.
4244 (get_input_file, release_input_file): New functions.
4245 (make_sized_plugin_object): Add filesize parameter. Change all callers.
4246 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4247 (Plugin_manager::all_symbols_read): Add task parameter.
4248 (Plugin_manager::get_input_file): New function.
4249 (Plugin_manager::release_input_file): New function.
4250 (Plugin_manager::task_): New data member.
4251 (Pluginobj::Pluginobj): Add filesize parameter.
4252 (Pluginobj::filename): New function.
4253 (Pluginobj::descriptor): New function.
4254 (Pluginobj::filesize): New function.
4255 (Pluginobj::filesize_): New data member.
4256 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4257 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4258 File_read::claim_for_plugin; use Object::unlock to unlock the file.
4260 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4261 with archive libraries.
4262 * testsuite/Makefile.in: Regenerate.
4263 * testsuite/plugin_test.c (struct sym_info): New type.
4264 (get_input_file, release_input_file): New static variables.
4265 (onload): Capture new transfer vector entries.
4266 (claim_file_hook): Stop reading at end of file according to filesize.
4267 Factor out parsing of readelf output into separate function.
4268 (all_symbols_read_hook): Exercise get_input_file and release_input_file
4269 APIs and get the source file name from the symbol table. Convert
4270 source file name to corresponding object file name. Print info
4271 message when adding new input files.
4272 (parse_readelf_line): New function.
4273 * testsuite/plugin_test_1.sh: Add checks for new info messages.
4274 * testsuite/plugin_test_2.sh: Likewise.
4275 * testsuite/plugin_test_3.sh: Likewise.
4276 * testsuite/plugin_test_4.sh: New test case.
4278 2009-01-07 Ian Lance Taylor <iant@google.com>
4280 * version.cc (version_string): Bump to 1.8.
4282 2008-12-23 Cary Coutant <ccoutant@google.com>
4284 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4285 * plugin.cc (Plugin_manager::finish): Rename as
4286 layout_deferred_objects. Move cleanup to separate function.
4287 (Plugin_manager::cleanup): New function.
4288 (Plugin_finish::run): Call layout_deferred_objects and cleanup
4290 * plugin.h (Plugin_manager::finish): Rename as
4291 layout_deferred_objects.
4292 (Plugin_manager::cleanup): New function.
4293 (Plugin_manager::cleanup_done): New field.
4295 2008-12-23 Cary Coutant <ccoutant@google.com>
4297 * plugin.cc (is_visible_from_outside): New function.
4298 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4299 so we don't return "IR only" status for exported symbols or -r links.
4301 * testsuite/Makefile.am (plugin_test_3): New test case.
4302 * testsuite/Makefile.in: Regenerate.
4303 * testsuite/plugin_test_3.sh: New file.
4305 2008-12-22 Cary Coutant <ccoutant@google.com>
4307 * object.cc (Sized_relobj::layout_section): New function.
4308 (Sized_relobj::do_layout): Defer layout of input sections until after
4309 plugin has provided replacement files.
4310 (Sized_relobj::do_layout_deferred_sections): New function.
4311 * object.h (Relobj::set_section_offset): Remove virtual keyword.
4312 (Relobj::layout_deferred_sections): New function.
4313 (Relobj::do_layout_deferred_sections): New function.
4314 (Sized_relobj::do_layout_deferred_sections): New function.
4315 (Sized_relobj::layout_section): New function.
4316 (Sized_relobj::Deferred_layout): New structure.
4317 (Sized_relobj::deferred_layout_): New field.
4318 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4319 Change all callers. Layout deferred sections.
4320 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4322 (Plugin_hook::run): Move code from do_plugin_hook inline.
4323 (Plugin_hook::do_plugin_hook): Remove.
4324 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4325 (Plugin_manager::finish): Renamed, was cleanup.
4326 (Plugin_manager::should_defer_layout): New function.
4327 (Plugin_manager::add_deferred_layout_object): New function.
4328 (Plugin_manager::Deferred_layout_list): New type.
4329 (Plugin_manager::deferred_layout_objects_): New field.
4330 (Plugin_hook::do_plugin_hook): Remove.
4332 2008-12-17 Ian Lance Taylor <iant@google.com>
4334 * options.h (class General_options): Add --no case for
4337 2008-12-16 Cary Coutant <ccoutant@google.com>
4339 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4341 (Plugin_manager::claim_file): Create plugin object even if
4342 plugin did not call the add_symbols callback.
4343 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4344 asking for more symbols than were added.
4345 * testsuite/Makefile.am (plugin_test_1): Add test case with
4347 (empty.syms): New target.
4348 * testsuite/Makefile.in: Regenerate.
4349 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4350 message. Don't call add_symbols if no globals.
4351 (all_symbols_read_hook): Don't provide replacement for empty
4354 2008-12-12 Ian Lance Taylor <iant@google.com>
4356 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4357 r_type == 0 for a local symbol with r_sym == 0.
4358 (scan_relocatable_relocs): Pass r_sym to
4359 local_non_section_strategy.
4360 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4363 * configure.ac: Update test for TLS descriptors: they are
4364 supported as of glibc 2.9.
4365 * configure: Rebuild.
4367 2008-12-11 Ian Lance Taylor <iant@google.com>
4370 * target-reloc.h (Default_scan_relocatable_relocs): For each
4371 function, map r_type == 0 to RELOC_DISCARD.
4373 2008-12-10 Cary Coutant <ccoutant@google.com>
4375 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4376 object to override a kept COMDAT group from a plugin object.
4378 2008-12-09 Ian Lance Taylor <iant@google.com>
4381 * yyscript.y (file_cmd): Handle INPUT.
4383 * testsuite/initpri1.c: Change all declarations to be full
4384 prototypes by adding void, to avoid compiler warnings.
4386 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
4388 * options.cc (General_options::parse_plugin_opt): New.
4389 (General_options::add_plugin): The argument now is just the filename.
4390 (General_options::add_plugin_option): New.
4391 * options.h (plugin_opt): New.
4392 (add_plugin): Change argument name.
4393 (add_plugin_option): New.
4394 * plugin.cc (Plugin::load): Don't parse the plugin option.
4395 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4396 (Plugin::add_option): New.
4397 (Plugin::args_): Change type.
4398 (Plugin::filename_): New.
4399 (Plugin_manager::add_plugin_option): New.
4400 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4401 * testsuite/Makefile.in: Regenerate.
4403 2008-12-05 Cary Coutant <ccoutant@google.com>
4405 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4406 Handle --strip-lto-sections option.
4407 * options.h (strip_lto_sections): New option.
4409 2008-12-01 Cary Coutant <ccoutant@google.com>
4411 * plugin.cc (ld_plugin_message): Change format parameter to const.
4412 Fix mismatch between new[] and delete.
4414 2008-11-14 Cary Coutant <ccoutant@google.com>
4416 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4419 2008-11-05 Craig Silverstein <csilvers@google.com>
4421 * options.cc (General_options::parse_dynamic_list): New function.
4422 * options.h (General_options): New flags dynamic_list,
4423 dynamic_list_data, dynamic_list_cpp_new, and
4424 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4425 (General_options::in_dynamic_list): New function.
4426 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4427 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4428 (Lex::can_continue_name): Likewise.
4430 (read_script_file): New parameter script_options.
4431 (read_dynamic_list): New function.
4432 (Script_options::define_dynamic_list): New function.
4433 (dynamic_list_keyword_parsecodes): New variable.
4434 (dynamic_list_keywords): New variable.
4435 * script.h (Script_options::define_dynamic_list): New function
4437 (read_dynamic_list): New function prototype.
4438 * symtab.cc (strprefix): New macro.
4439 (Symbol::should_add_dynsym_entry): Support dynamic_list,
4440 dynamic_list_data, dynamic_list_cpp_new, and
4441 dynamic_list_cpp_typeinfo.
4442 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4443 (dynamic_list_expr): New rule.
4444 (dynamic_list_nodes): Likewise.
4445 (dynamic_list_node): Likewise.
4446 * testsuite/Makefile.am (dynamic_list): New test.
4447 * testsuite/Makefile.in: Regenerated.
4448 * testsuite/dynamic_list.t: New file.
4449 * testsuite/dynamic_list.sh: New file.
4451 2008-11-05 Craig Silverstein <csilvers@google.com>
4453 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4454 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4455 (t11_last): Likewise.
4456 * testsuite/ver_test_6.c (main): Likewise.
4458 2008-10-07 Cary Coutant <ccoutant@google.com>
4460 * options.c (General_options::finalize): Add check for -static and
4462 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4465 2008-10-02 Cary Coutant <ccoutant@google.com>
4467 * plugin.cc (make_sized_plugin_object): Fix conditional
4468 compilation to work when not all targets are enabled.
4470 2008-09-29 Cary Coutant <ccoutant@google.com>
4472 * archive.cc (Archive::get_file_and_offset): Use filename instead
4473 of name to get library path.
4474 (Archive::include_member): Unlock external member of a thin archive.
4476 * testsuite/Makefile.am (TEST_AR): New variable.
4477 (thin_archive_test_1): New test.
4478 (thin_archive_test_2): New test.
4479 * testsuite/Makefile.in: Regenerate.
4480 * testsuite/thin_archive_main.cc: New file.
4481 * testsuite/thin_archive_test_1.cc: New file.
4482 * testsuite/thin_archive_test_2.cc: New file.
4483 * testsuite/thin_archive_test_3.cc: New file.
4484 * testsuite/thin_archive_test_4.cc: New file.
4486 2008-09-29 Cary Coutant <ccoutant@google.com>
4488 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4489 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4491 (Sized_relobj::do_finalize_local_symbols): Likewise.
4492 (Sized_relobj::map_to_kept_section): Likewise.
4493 * object.h (Sized_relobj::invalid_address): New constant.
4494 (Sized_relobj::do_output_section_offset): Check for invalid_address
4496 * output.cc (Output_reloc::local_section_offset): Use constant
4497 invalid_address instead of -1U.
4498 (Output_reloc::get_address): Likewise.
4499 (Output_section::output_address): Change -1U to -1ULL.
4500 * output.h (Output_reloc::invalid_address): New constant.
4501 * reloc.cc (Sized_relobj::write_sections): Use constant
4502 invalid_address instead of -1U.
4503 (Sized_relobj::relocate_sections): Likewise.
4504 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4505 values for merge sections.
4506 * target-reloc.h (relocate_for_relocatable): Use constant
4507 invalid_address instead of -1U.
4509 2008-09-19 Cary Coutant <ccoutant@google.com>
4511 Add plugin functionality for link-time optimization (LTO).
4512 * configure.ac (plugins): Add --enable-plugins option.
4513 * configure: Regenerate.
4514 * config.in: Regenerate.
4515 * Makefile.am (LIBDL): New variable.
4516 (CCFILES): Add plugin.cc.
4517 (HFILES): Add plugin.h.
4518 (ldadd_var): Add LIBDL.
4519 * Makefile.in: Regenerate.
4521 * archive.cc: Include "plugin.h".
4522 (Archive::setup): Don't preread archive symbols when using a plugin.
4523 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
4524 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4526 (Archive::include_member): Add symbols from plugin objects.
4527 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4528 * descriptors.cc (Descriptors::open): Check for file descriptors
4529 abandoned by plugins.
4530 (Descriptors::claim_for_plugin): New function.
4531 * descriptors.h (Descriptors::claim_for_plugin): New function.
4532 (Open_descriptor::is_claimed): New field.
4533 (claim_descriptor_for_plugin): New function.
4534 * fileread.cc (File_read::claim_for_plugin): New function.
4535 * fileread.h (File_read::claim_for_plugin): New function.
4536 (File_read::descriptor): New function.
4537 * gold.cc: Include "plugin.h".
4538 (queue_initial_tasks): Add task to call plugin hooks for generating
4540 * main.cc: Include "plugin.h".
4541 (main): Load plugin libraries.
4542 * object.h (Pluginobj): Declare.
4543 (Object::pluginobj): New function.
4544 (Object::do_pluginobj): New function.
4545 (Object::set_target): New function.
4546 * options.cc: Include "plugin.h".
4547 (General_options::parse_plugin): New function.
4548 (General_options::General_options): Initialize plugins_ field.
4549 (General_options::add_plugin): New function.
4550 * options.h (Plugin_manager): Declare.
4551 (General_options): Add --plugin option.
4552 (General_options::has_plugins): New function.
4553 (General_options::plugins): New function.
4554 (General_options::add_plugin): New function.
4555 (General_options::plugins_): New field.
4556 * plugin.cc: New file.
4557 * plugin.h: New file.
4558 * readsyms.cc: Include "plugin.h".
4559 (Read_symbols::do_read_symbols): Check for archive before checking
4560 for ELF file. Call plugin hooks to claim files.
4561 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4562 from a real object file; force override when processing replacement
4564 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4565 (Symbol::init_base_object): Likewise.
4566 (Symbol::init_base_output_data): Likewise.
4567 (Symbol::init_base_output_segment): Likewise.
4568 (Symbol::init_base_constant): Likewise.
4569 (Symbol::init_base_undefined): Likewise.
4570 (Symbol::output_section): Assert that object is not a plugin.
4571 (Symbol_table::add_from_pluginobj): New function.
4572 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4574 (Symbol_table::sized_write_globals): Likewise.
4575 (Symbol_table::add_from_pluginobj): Instantiate template.
4576 * symtab.h (Sized_pluginobj): Declare.
4577 (Symbol::in_real_elf): New function.
4578 (Symbol::set_in_real_elf): New function.
4579 (Symbol::in_real_elf_): New field.
4580 (Symbol_table::add_from_pluginobj): New function.
4582 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4583 (LIBDL): New variable.
4585 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4586 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4587 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4588 (MOSTLYCLEANFILES): Likewise.
4589 * testsuite/Makefile.in: Regenerate.
4590 * testsuite/plugin_test.c: New file.
4591 * testsuite/plugin_test_1.sh: New file.
4592 * testsuite/plugin_test_2.sh: New file.
4594 2008-09-16 Ian Lance Taylor <iant@google.com>
4596 * target-reloc.h (relocate_section): Check whether a symbol is
4597 defined by the ABI before reporting an undefined symbol error.
4598 * target.h (Target::is_defined_by_abi): Make parameter const.
4599 (Target::do_is_defined_by_abi): Likewise.
4600 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4601 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4602 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4603 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4604 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4605 * testsuite/Makefile.in: Rebuild.
4607 * fileread.cc (make_view): Add casts to avoid warning.
4609 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4611 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4612 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4614 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4616 * options.h (General_options::output_is_executable): New.
4617 (General_options::output_is_pie): New.
4618 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4619 for shared libraries.
4620 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4622 2008-09-11 Chris Demetriou <cgd@google.com>
4624 * options.h (origin): New -z option.
4625 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4626 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4629 2008-09-05 Cary Coutant <ccoutant@google.com>
4631 * fileread.cc (File_read::make_view): Add check for attempt to map
4634 2008-09-05 Cary Coutant <ccoutant@google.com>
4636 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4637 explicit instantiations.
4639 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4642 * options.cc (General_options::finalize): Allow undefined symbols
4643 in shlibs if linking -shared.
4646 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4647 symbols as not needing a dynsym entry.
4649 2008-08-20 Craig Silverstein <csilvers@google.com>
4651 * fileread.cc (File_read::open): Do not lock the file unless it
4652 was successfully opened.
4654 2008-08-14 Cary Coutant <ccoutant@google.com>
4656 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4657 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4658 * testsuite/tls_test.cc (struct int128): 128-bit struct
4659 for testing TLS relocs with non-zero addend.
4660 (v12): New TLS variable.
4662 (t_last): Add check for v12.
4663 * testsuite/tls_test.h (t12): New function.
4664 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4666 2008-08-13 Ian Lance Taylor <iant@google.com>
4668 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4669 set tls_segment_ or relro_segment_.
4670 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4672 * output.h (Output_section::clear_is_relro): New function.
4673 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4674 sections specially even when output_data_ is empty.
4675 (Output_segment::maximum_alignment): When first section is relro,
4676 only force alignment for PT_LOAD segments.
4677 * script.cc (script_data_segment_align): New function.
4678 (script_data_segment_relro_end): New function.
4679 * script-c.h (script_data_segment_align): Declare.
4680 (script_data_segment_relro_end): Declare.
4681 * script-sections.h (class Script_sections): Declare
4682 data_segment_align and data_segment_relro_end. Add fields
4683 segment_align_index_ and saw_relro_end_.
4684 * script-sections.cc (class Sections_element): Add set_is_relro
4685 virtual function. Add new bool* parameter to place_orphan_here.
4686 Add get_output_section virtual function.
4687 (class Output_section_definition): Add set_is_relro. Add new
4688 bool* parameter to place_orphan_here. Add get_output_section.
4689 Add is_relro_ field.
4690 (Output_section_definition::Output_section_definition): Initialize
4691 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4692 and is_relro_ fields.
4693 (Output_section_definition::place_orphan_here): Add is_relro
4695 (Output_section_definition::set_section_addresses): Set relro for
4697 (Output_section_definition::alternate_constraint): Likewise.
4698 (class Orphan_output_section): Add new bool* parameter to
4699 place_orphan_here. Add get_output_section.
4700 (Orphan_output_section::place_orphan_here): Add is_relro
4702 (Script_sections::Script_sections): Initialize
4703 data_segment_align_index_ and saw_relro_end_.
4704 (Script_sections::data_segment_align): New function.
4705 (Script_sections::data_segment_relro_end): New function.
4706 (Script_sections::place_orphan): Set or clear is_relro.
4707 (Script_sections::set_section_addresses): Force alignment of first
4709 * yyscript.y (exp): Call script_data_segment_align and
4710 script_data_segment_relro_end.
4711 * testsuite/relro_script_test.t: New file.
4712 * testsuite/relro_test.cc (using_script): Declare.
4713 (t1, t2): Test using_script.
4714 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4715 (relro_script_test_SOURCES): Define.
4716 (relro_script_test_DEPENDENCIES): Define.
4717 (relro_script_test_LDFLAGS): Define.
4718 (relro_script_test_LDADD): Define.
4719 (relro_script_test.so): New target.
4720 * testsuite/Makefile.in: Rebuild.
4722 2008-08-06 Cary Coutant <ccoutant@google.com>
4724 * archive.cc (Archive::total_archives, Archive::total_members)
4725 (Archive::total_members_loaded): New variables.
4726 (Archive::setup): Add parameter. Add option to preread
4728 (Archive::read_armap): Add counter.
4729 (Archive::get_file_and_offset): New function.
4730 (Archive::get_elf_object_for_member): New function.
4731 (Archive::read_all_symbols): New function.
4732 (Archive::read_symbols): New function.
4733 (Archive::add_symbols): Add counters.
4734 (Archive::include_all_members): Use armap to find members if it's
4736 (Archive::include_member): Skip reading symbols if already read.
4737 Factored code into Archive::get_file_and_offset and
4738 Archive::get_elf_object_for_member. Changed call to
4739 Mapfile::report_include_archive_member.
4740 (Archive::print_stats): New function.
4741 * archive.h: Declare Object and Read_symbols_data classes.
4742 (Archive::Archive): Add initializers for new members.
4743 (Archive::setup): Add parameter.
4744 (Archive::print_stats): New function.
4745 (Archive::total_archives, Archive::total_members)
4746 (Archive::total_members_loaded): New variables.
4747 (Archive::get_file_and_offset): New function.
4748 (Archive::get_elf_object_for_member): New function.
4749 (Archive::read_all_symbols): New function.
4750 (Archive::read_symbols): New function.
4751 (Archive::Archive_member): New class.
4752 (Archive::members_): New member.
4753 (Archive::num_members_): New member.
4754 * main.cc: Include archive.h.
4755 (main): Call Archive::print_stats.
4756 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4757 archive parameter; member_name is now the fully-decorated name.
4758 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4759 * options.h: (General_options): Add --preread-archive-symbols option.
4760 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4763 2008-08-04 Ian Lance Taylor <iant@google.com>
4765 * symtab.h (Symbol::use_plt_offset): New function.
4766 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4767 * powerpc.cc (Relocate::relocate): Likewise.
4768 * sparc.cc (Relocate::relocate): Likewise.
4769 * x86_64.cc (Relocate::relocate): Likewise.
4770 * testsuite/weak_plt.sh: New test.
4771 * testsuite/weak_plt_main.cc: New test.
4772 * testsuite/weak_plt_shared.cc: New test.
4773 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4774 (check_PROGRAMS): Add weak_plt.
4775 (check_DATA): Add weak_plt_shared.so.
4776 (weak_plt_main_pic.o, weak_plt): New targets.
4777 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4778 * testsuite/Makefile.in: Rebuild.
4780 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4782 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4783 * testsuite/Makefile.in: Rebuild.
4785 2008-08-04 Alan Modra <amodra@bigpond.net.au>
4787 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4788 * Makefile.in: Regenerate.
4789 * po/POTFILES.in: Regenerate.
4791 2008-07-29 Ian Lance Taylor <iant@google.com>
4793 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4794 symbols before other symbols.
4795 * testsuite/script_test_2.cc (test_addr): Declare.
4796 (test_addr_alias): Declare.
4797 (main): Check that test_addr and test_addr_alias have the right
4799 * testsuite/script_test_2.t: Define test_addr_alias and
4802 2008-07-24 Ian Lance Taylor <iant@google.com>
4805 * descriptors.cc: New file.
4806 * descriptors.h: New file.
4807 * gold-threads.h (class Hold_optional_lock): New class.
4808 * fileread.cc: Include "descriptors.h".
4809 (File_read::~File_read): Release descriptor rather than closing
4811 (File_read::open) [file]: Call open_descriptor rather than open.
4812 Set is_descriptor_opened_.
4813 (File_read::open) [memory]: Assert that descriptor is not open.
4814 (File_read::reopen_descriptor): New function.
4815 (File_read::release): Release descriptor.
4816 (File_read::do_read): Make non-const. Reopen descriptor.
4817 (File_read::read): Make non-const.
4818 (File_read::make_view): Reopen descriptor.
4819 (File_read::do_readv): Likewise.
4820 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4821 Update declarations.
4822 * layout.cc: Include "descriptors.h".
4823 (Layout::create_build_id): Use open_descriptor rather than open.
4824 * output.cc: Include "descriptors.h".
4825 (Output_file::open): Use open_descriptor rather than open.
4826 * archive.cc (Archive::const_iterator): Change Archive to be
4828 (Archive::begin, Archive::end): Make non-const.
4829 (Archive::count_members): Likewise.
4830 * archive.h (class Archive): Update declarations.
4831 * object.h (Object::read): Make non-const.
4832 * Makefile.am (CCFILES): Add descriptors.cc.
4833 (HFILES): Add descriptors.h.
4834 * Makefile.in: Rebuild.
4837 * gold.h: Always include <clocale>. Add Solaris workarounds
4838 following code in binutils/sysdep.h.
4841 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4842 this->eh_frame_hdr_ is NULL before using it.
4844 * dynobj.cc (Versions::Versions): Update comment.
4846 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4847 the base version name.
4849 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4850 array size plus one.
4851 (Stringpool_template::set_string_offsets): Subtract one from key
4852 before using it as an array index.
4853 (Stringpool_template::get_offset_with_length): Likewise.
4854 (Stringpool_template::write_to_buffer): Likewise.
4855 * stringpool.h (Stringpool_template::get_offset_from_key):
4858 2008-07-23 Ian Lance Taylor <iant@google.com>
4861 * object.h (Merged_symbol_value::value): Do our best to handle a
4865 * script.cc (Version_script_info::get_versions): Don't add empty
4866 version tag to return value.
4867 (Version_script_info::get_symbol_version_helper): Change return
4868 type to bool. Add pversion parameter. Change all callers.
4869 (script_register_vers_node): Don't require a non-NULL tag.
4870 * script.h (class Version_script_info): Update declarations.
4871 (Version_script_info::get_symbol_version): Change return type to
4872 bool. Add version parameter. Change all callers.
4873 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4874 handling. Handle an empty version from a version script.
4875 (Symbol_table::define_special_symbol): Likewise.
4876 * testsuite/ver_test_10.script: New file.
4877 * testsuite/ver_test_10.sh: New file.
4878 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4879 (check_DATA): Add ver_test_10.syms.
4880 (ver_test_10.syms, ver_test_10.so): New target.
4881 * testsuite/Makefile.in: Rebuild.
4883 2008-07-23 Simon Baldwin <simonb@google.com>
4885 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4886 to zero for undefined symbols from dynamic libraries.
4888 2008-07-23 Ian Lance Taylor <iant@google.com>
4890 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4892 * symtab.h (class Symbol_table): Update declaration.
4893 * testsuite/ver_test_9.cc: New file.
4894 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4895 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4896 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4897 (ver_test_9.so, ver_test_9.o): New targets.
4898 * testsuite/Makefile.in: Rebuild.
4900 2008-07-22 Ian Lance Taylor <iant@google.com>
4902 * options.h (class General_options): Define --check-sections.
4903 * layout.cc (Layout::set_segment_offsets): Handle
4906 * options.h (class General_options): Define -n/--nmagic and
4908 * options.cc (General_options::finalize): For -n/--nmagic or
4909 -N/--omagic, set -static.
4910 * layout.cc (Layout::attach_allocated_section_to_segment): If
4911 -N/--omagic, don't put read-only and read-write sections in
4913 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4914 finding a read-only segment.
4915 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4916 don't set the minimum segment alignment to the common page size,
4917 and don't set the file offset to the address modulo the page size.
4918 * script-sections.cc (Script_sections::create_segments): If
4919 -n/--omagic, don't put read-only and read-write sections in
4922 * cref.cc: New file.
4924 * options.h (class General_options): Add --print-symbol-counts.
4925 * main.cc (main): Issue defined symbol report if requested.
4926 * archive.cc (Archive::interpret_header): Make into a const member
4928 (Archive::add_symbols): Call Input_objects::archive_start and
4930 (Archive::const_iterator): Define new class.
4931 (Archive::begin, Archive::end): New functions.
4932 (Archive::include_all_members): Rewrite to use iterator.
4933 (Archive::count_members): New function.
4934 * archive.h (class Archive): Update declarations.
4935 (Archive::filename): New function.
4936 * object.cc: Include "cref.h".
4937 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4938 (Sized_relobj::do_get_global_symbol_counts): New function.
4939 (Input_objects::add_object): Add object to cross-referencer.
4940 (Input_objects::archive_start): New function.
4941 (Input_objects::archive_stop): New function.
4942 (Input_objects::print_symbol_counts): New function.
4943 * object.h: Declare Cref and Archive.
4944 (Object::get_global_symbol_counts): New function.
4945 (Object::do_get_global_symbol_counts): New pure virtual function.
4946 (class Sized_relobj): Add defined_count_ field. Update
4948 (class Input_objects): Add cref_ field. Update constructor.
4949 Update declarations.
4950 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4952 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4954 (Sized_dynobj::do_get_global_symbol_counts): New function.
4955 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4956 defined_count_. Update declarations. Define Symbols typedef.
4957 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4958 parameter. Change all callers.
4959 (Symbol_table::add_from_dynobj): Add sympointers and defined
4960 parameters. Change all callers.
4961 * symtab.h (class Symbol_table): Update declarations.
4962 * Makefile.am (CCFILES): Add cref.cc.
4963 (HFILES): Add cref.h.
4964 * Makefile.in: Rebuild.
4966 2008-07-22 Simon Baldwin <simonb@google.com>
4968 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4969 to zero when writing undefined symbols.
4971 2008-07-22 Ian Lance Taylor <iant@google.com>
4973 * output.cc (Output_section::add_input_section): Don't try to
4974 merge empty merge sections.
4976 2008-07-21 Craig Silverstein <csilvers@google.com>
4978 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4979 Include symbol version in error message.
4981 2008-07-20 Chris Demetriou <cgd@google.com>
4983 * configure.ac (gold_cv_c_random_seed): New configured variable.
4984 (RANDOM_SEED_CFLAGS): New substituted variable.
4985 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4986 * configure: Rebuild.
4987 * Makefile.in: Likewise.
4988 * testsuite/Makefile.in: Likewise.
4990 2008-07-18 Ian Lance Taylor <iant@google.com>
4992 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4993 where we see NAME/NULL and NAME/VERSION as separate symbols.
4994 * testsuite/ver_test_main.cc (main): Call t4.
4995 (t4, t4_2a): Define.
4996 * testsuite/ver_test_2.cc (t4_2): Define.
4997 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4998 * testsuite/ver_test_4.cc (t4_2a): Define.
4999 * testsuite/ver_test_4.script: Put t4_2a in VER2.
5000 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
5002 2008-07-17 Ian Lance Taylor <iant@google.com>
5004 * dynobj.cc (Versions::add_def): If we give an error about a
5005 missing version, go ahead and create the version anyhow.
5007 2008-07-10 Ian Lance Taylor <iant@google.com>
5009 Handle output sections with more than 0x7fffffff bytes.
5010 * object.h (class Relobj): Change map_to_output_ to
5011 output_sections_, and just keep a section pointer. Change all
5012 uses. Move comdat group support to Sized_relobj.
5013 (Relobj::is_section_specially_mapped): Remove.
5014 (Relobj::output_section): Remove poff parameter. Change all
5016 (Relobj::output_section_offset): New function.
5017 (Relobj::set_section_offset): Rewrite.
5018 (Relobj::map_to_output): Remove.
5019 (Relobj::output_sections): New function.
5020 (Relobj::do_output_section_offset): New pure virtual function.
5021 (Relobj::do_set_section_offset): Likewise.
5022 (class Sized_relobj): Add section_offsets_ field. Add comdat
5023 group support from Relobj. Update declarations.
5024 (Sized_relobj::get_output_section_offset): New function.
5025 (Sized_relobj::do_output_section_offset): New function.
5026 (Sized_relobj::do_set_section_offset): New function.
5027 * object.cc (Relobj::output_section_address): Remove.
5028 (Sized_relobj::Sized_relobj): Initialize new fields.
5029 (Sized_relobj::include_section_group): Cast find_kept_object to
5031 (Sized_relobj::include_linkonce_section): Likewise.
5032 (Sized_relobj::do_layout): Use separate arrays for output section
5034 (Sized_relobj::do_count_local_symbols): Change map_to_output to
5036 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
5037 output_sections and section_offsets.
5038 (Sized_relobj::write_local_symbols): Likewise.
5039 (map_to_kept_section): Compute output address directly.
5040 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
5041 output_sections and section_offsets.
5042 (Sized_relobj::write_sections): Likewise.
5043 (Sized_relobj::relocate_sections): Likewise.
5044 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
5045 * output.h (class Output_reloc): Update declarations. Change
5046 u2_.relobj to Sized_relobj*.
5047 (class Output_data_reloc): Change add functions to use
5049 * output.cc (Output_reloc::Output_reloc): Change relobj to
5051 (Output_reloc::local_section_offset): Change return type to
5052 Elf_Addr. Use get_output_section_offset.
5053 (Output_reloc::get_address): Likewise.
5054 (Output_section::is_input_address_mapped): Don't call
5055 is_section_specially_mapped.
5056 (Output_section::output_offset): Likewise.
5057 (Output_section::output_address): Likewise.
5058 (Output_section::starting_output_address): Likewise.
5059 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
5060 parameter to Sized_relobj*.
5061 (Copy_relocs::need_copy_reloc): Likewise.
5062 (Copy_relocs::save): Likewise.
5063 * copy-relocs.h (class Copy_relocs): Update declarations.
5064 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
5065 Sized_relobj*. Change relobj_ field to Sized_relobj*.
5066 * target-reloc.h (relocate_for_relocatable): Change
5067 offset_in_output_section type to Elf_Addr. Change code that uses
5069 * layout.cc (Layout::layout): Always set *off.
5070 * mapfile.cc (Mapfile::print_input_section): Use
5071 output_section_offset.
5072 * i386.cc (Target_i386::copy_reloc): Change object parameter to
5074 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
5075 * sparc.cc (Target_sparc::copy_reloc): Likewise.
5076 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
5078 2008-07-03 Ian Lance Taylor <iant@google.com>
5080 * layout.cc (Layout::include_section): Do not discard unrecognized
5081 SHT_STRTAB sections.
5083 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
5085 * script.cc (Lex::can_continue_name): Make '?' allowable in
5086 version-script names.
5087 * testsuite/version_script.map: Change glob pattern to use '?'
5089 2008-06-30 Manish Singh <yosh@gimp.org>
5092 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
5095 2008-06-30 Ian Lance Taylor <iant@google.com>
5099 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
5100 versions]: Don't try to read the value in the contents, since we
5101 don't use it. Use the template endianness when writing.
5103 2008-06-25 Cary Coutant <ccoutant@google.com>
5105 * fileread.cc (File_read::make_view): Assert on zero-length view.
5106 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
5107 symbol table when there are no symbols to read.
5109 2008-06-23 Craig Silverstein <csilvers@google.com>
5111 * version.cc (version_string): Bump to 1.7
5113 2008-06-18 Craig Silverstein <csilvers@google.com>
5115 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
5116 constant 0xFFFF to type Valtype.
5117 (Powerpc_relocate_functions::rel16_ha): Likewise.
5119 2008-06-17 Ian Lance Taylor <iant@google.com>
5121 * output.h (Output_section::Input_section): Initialize p2align_ to
5122 zero for Output_section_data constructors.
5123 (Output_section::Input_section::addralign): If not an input
5124 section, return the alignment of the Output_section_data.
5125 * testsuite/copy_test.cc: New file.
5126 * testsuite/copy_test_1.cc: New file.
5127 * testsuite/copy_test_2.cc: New file.
5128 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
5129 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
5130 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
5131 (copy_test_1_pic.o, copy_test_1.so): New targets.
5132 (copy_test_2_pic.o, copy_test_2.so): New targets.
5133 * testsuite/Makefile.in: Rebuild.
5135 * script-sections.cc (Script_sections::place_orphan): Initialize
5136 local variable exact.
5138 2008-06-13 David Edelsohn <edelsohn@gnu.org>
5140 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5142 2008-06-12 David Edelsohn <edelsohn@gnu.org>
5143 David S. Miller <davem@davemloft.net>
5145 * powerpc.cc: New file.
5146 * Makefile.am (TARGETSOURCES): Add powerpc.cc
5147 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
5148 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
5149 * Makefile.in: Rebuild.
5151 2008-06-09 Ian Lance Taylor <iant@google.com>
5153 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
5155 (throwing, orig_terminate): New static variables.
5156 (terminate_handler): New static function.
5157 (t2): Set terminate handler.
5159 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
5162 * binary.cc (Binary_to_elf::sized_convert): Fix .data
5165 2008-05-30 Cary Coutant <ccoutant@google.com>
5167 * archive.cc (Archive::include_all_members) Correct to step
5168 over symbol table and extended name table in thin archives.
5170 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
5173 * target-reloc.h (relocate_for_relocatable): Fix new_offset
5176 2008-05-28 Caleb Howe <cshowe@google.com>
5178 * reduced_debug_output.cc: New file.
5179 * reduced_debug_output.h: New file.
5180 * options.h (class General_options): Add --strip-debug-non-line.
5181 * options.cc (General_options::finalize): Add strip_debug_non_line
5182 to the strip heirarchy.
5183 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5185 * layout.cc: Include "reduced_debug_output.h".
5186 (Layout::Layout): Initialize new fields.
5187 (line_only_debug_sections): New static array.
5188 (is_lines_only_debug_sections): New static inline function.
5189 (Layout::include_section): Handle --strip-debug-non-line.
5190 (Layout::make_output_section): If --strip-debug-non-line, build
5191 new output sections for .debug_abbrev and .debug_info.
5192 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5193 gold. Warn about possible overflow.
5194 (read_signed_LEB_128): Likewise.
5195 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5196 (read_signed_LEB_128): Declare.
5197 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5198 (HFILES): Add reduced_debug_output.h.
5199 * Makefile.in: Rebuild.
5201 2008-05-21 Ian Lance Taylor <iant@google.com>
5203 * mapfile.cc: New file.
5204 * mapfile.h: New file.
5205 * options.h (class General_options): Add -M/--print-map and -Map.
5206 * options.cc (General_options::finalize): Make -M equivalent to
5208 * main.cc: Include <cstdio> and "mapfile.h".
5209 (main): Open mapfile if requested.
5210 * gold.cc (class Middle_runner): Add mapfile_ field. Update
5211 constructor. Change caller.
5212 (queue_initial_tasks): Add mapfile parameter. Change caller.
5213 (queue_middle_tasks): Likewise.
5214 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5216 * archive.cc: Include "mapfile.h".
5217 (Archive::add_symbols): Add mapfile parameter. Change all
5218 callers. Pass mapfile, symbol, and reason to include_member.
5219 (Archive::include_all_members): Add mapfile parameter. Change all
5221 (Archive::include_member): Add mapfile, sym, and why parameters.
5222 Change all callers. Report inclusion to map file.
5223 * archive.h: Include "fileread.h".
5224 (class Archive): Update declarations.
5225 (Archive::file): New const method.
5226 (class Add_archive_symbols): Add mapfile_ field. Update
5227 constructor. Change all callers.
5228 * readsyms.h (class Read_symbols): Likewise.
5229 (class Finish_group): Likewise.
5230 (class Read_script): Likewise.
5231 * common.cc: Include "mapfile.h".
5232 (Symbol_table::allocate_commons): Add mapfile parameter. Change
5234 (Symbol_table::do_allocate_commons): Likewise.
5235 (Symbol_table::do_allocate_commons_list): Likewise. Report common
5236 symbol allocation to mapfile.
5237 * common.h (class Allocate_commons_task): Add mapfile_ field.
5238 Update constructor. Change all callers.
5239 * symtab.h (class Symbol_table): Update declarations.
5240 * layout.cc: Include "mapfile.h".
5241 (Layout_task_runner::run): Print information to mapfile.
5242 (Layout::create_gold_note): Change Output_data_fixed_space to
5243 Output_data_zero_fill.
5244 (Layout::create_build_id): Likewise.
5245 (Layout::print_to_mapfile): New function.
5246 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
5247 constructor. Change caller.
5248 (class Layout): Declare print_to_mapfile.
5249 * output.cc (Output_section::Input_section::print_to_mapfile): New
5251 (Output_section::add_input_section): If producing a map, always
5252 add to input_sections_ list.
5253 (Output_section::do_print_to_mapfile): New function.
5254 (Output_segment::print_sections_to_mapfile): New function.
5255 (Output_segment::print_section_list_to_mapfile): New function.
5256 * output.h: Include "mapfile.h".
5257 (Output_data::print_to_mapfile): New function.
5258 (Output_data::do_print_to_mapfile): New virtual function.
5259 (Output_segment_headers::do_print_to_mapfile): New function.
5260 (Output_file_header::do_print_to_mapfile): New function.
5261 (Output_data_const::do_print_to_mapfile): New function.
5262 (class Output_data_const_buffer): Add map_name_ field. Update
5263 constructor. Change all callers. Add do_print_to_mapfile
5265 (class Output_data_fixed_space): Likewise.
5266 (class Output_data_space): Likewise.
5267 (class Output_data_zero_fill): New class.
5268 (Output_data_strtab::do_print_to_mapfile): New function.
5269 (Output_data_reloc_base::do_print_to_mapfile): New function.
5270 (Output_relocatable_relocs::do_print_to_mapfile): New function.
5271 (Output_data_group::do_print_to_mapfile): New function.
5272 (Output_data_got::do_print_to_mapfile): New function.
5273 (Output_data_dynamic::do_print_to_mapfile): New function.
5274 (Output_symtab_xindex::do_print_to_mapfile): New function.
5275 (class Output_section): Declare do_print_to_mapflie. Declare
5276 print_to_mapfile in Input_section.
5277 (class Output_segment): Declare new functions.
5278 * object.h (Sized_relobj::symbol_count): New function.
5279 * script-sections.cc
5280 (Output_section_element_dot_assignment::set_section_addresses):
5281 Change Output_data_fixed_space to Output_data_zero_fill.
5282 (Output_data_expression::do_print_to_mapfile): New function.
5283 * script.cc (read_input_script): Add mapfile parameter. Change
5285 * script.h (read_input_script): Update declaration.
5286 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5287 (Eh_frame::do_print_to_mapfile): New function.
5288 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5289 (Output_merge_string::do_print_to_mapfile): New function.
5290 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5292 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5294 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5296 * Makefile.am (CCFILES): Add mapfile.cc.
5297 (HFILES): Add mapfile.h.
5298 * Makefile.in: Rebuild.
5300 2008-05-19 Ian Lance Taylor <iant@google.com>
5302 * options.h (class General_options): Add -z relro.
5303 * layout.cc (Layout::Layout): Initialize relro_segment_.
5304 (Layout::add_output_section_data): Return the output section.
5305 (Layout::make_output_section): Rcognize relro sections and mark
5307 (Layout::attach_allocated_section_to_segment): Put relro sections
5308 in a PT_GNU_RELRO segment.
5309 (Layout::create_initial_dynamic_sections): Mark the .dynamic
5311 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5313 (Layout::linkonce_mapping): Map d.rel.ro.local to
5315 (Layout::output_section_name): Us .data.rel.ro.local for any
5316 section which begins with that.
5317 * layout.h (class Layout): Update add_output_section_data
5318 declaration. Add relro_segment_ field.
5319 * output.cc (Output_section::Output_section): Initialize is_relro_
5320 and is_relro_local_ fields.
5321 (Output_segment::add_output_section): Group relro sections.
5322 (Output_segment::is_first_section_relro): New function.
5323 (Output_segment::maximum_alignment): If there is a relro section,
5324 align the segment to the common page size.
5325 (Output_segment::set_section_addresses): Track whether we are
5326 looking at relro sections. If the last section is a relro
5327 section, align to the common page size.
5328 (Output_segment::set_section_list_addresses): Add in_relro
5329 parameter. Change all callers. Align to the page size when
5330 moving from relro to non-relro section.
5331 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5333 * output.h (class Output_section): Add is_relro_ and
5334 is_relro_local_ fields.
5335 (Output_section::is_relro): New function.
5336 (Output_section::set_is_relro): New function.
5337 (Output_section::is_relro_local): New function.
5338 (Output_section::set_is_relro_local): New function.
5339 (class Output_segment): Update declarations.
5340 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5341 * sparc.cc (Target_sparc::got_section): Likewise.
5342 * x86_64.cc (Target_x86_64::got_section): Likewise.
5343 * testsuite/relro_test_main.cc: New file.
5344 * testsuite/relro_test.cc: New file.
5345 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5346 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5347 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5348 (relro_test.so, relro_test_pic.o): New targets.
5349 * testsuite/Makefile.in: Rebuild.
5351 2008-05-16 Ian Lance Taylor <iant@google.com>
5353 * output.cc (Output_segment::add_output_section): Remove front
5355 * output.h (class Output_segment): Remove
5356 add_initial_output_section and overloaded add_output_section.
5357 Update declaration of remaining add_output_section.
5358 * layout.cc (Layout::create_interp): Call add_output_section
5359 rather than add_initial_output_section.
5360 (Layout::finish_dynamic_section): Likewise.
5362 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5363 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5364 know the dynamic type.
5365 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5366 field. Initialize it in constructor.
5367 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5368 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5369 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5372 * output.cc (Output_reloc::get_address): Change return type to
5374 * output.h (class Output_reloc): Update get_address declaration.
5375 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5376 for section addresses.
5378 2008-05-09 Ian Lance Taylor <iant@google.com>
5381 * gold.cc (gold_nomem): Use return value of write.
5383 2008-05-08 Ian Lance Taylor <iant@google.com>
5385 * symtab.c (Symbol::init_base_output_data): Add version
5386 parameter. Change all callers.
5387 (Symbol::init_base_output_segment): Likewise.
5388 (Symbol::init_base_constant): Likewise.
5389 (Symbol::init_base_undefined): Likewise.
5390 (Sized_symbol::init_output_data): Likewise.
5391 (Sized_symbol::init_output_segment): Likewise.
5392 (Sized_symbol::init_constant): Likewise.
5393 (Sized_symbol::init_undefined): Likewise.
5394 (Symbol_table::do_define_in_output_data): If the new symbol has a
5395 version, mark it as the default.
5396 (Symbol_table::do_define_in_output_segment): Likewise.
5397 (Symbol_table::do_define_as_constant): Likewise.
5398 * symtab.h (class Symbol): Update declarations.
5399 (class Sized_symbol): Likewise.
5400 * resolve.cc (Symbol::override_version): New function.
5401 (Symbol::override_base): Call override_version.
5402 (Symbol::override_base_with_special): Likewise.
5403 * testsuite/ver_script_8.script: New file.
5404 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5405 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5406 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5407 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5409 2008-05-06 Ian Lance Taylor <iant@google.com>
5412 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5414 (class General_options): Remove existing --undefined, and add
5415 --no-undefined instead. Add new --undefined as synonym for -u.
5416 * archive.cc (Archive::add_symbols): Check whether symbol was
5418 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5419 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5420 all uses. Add IS_UNDEFINED. Update declarations to split
5421 different versions of init_base. Declare init_base_undefined.
5422 (Symbol::is_defined): Handle IS_UNDEFINED.
5423 (Symbol::is_undefined): Likewise.
5424 (Symbol::is_weak_undefined): Call is_undefined.
5425 (Symbol::is_absolute): Handle IS_CONSTANT.
5426 (class Sized_symbol): Update declarations to split different
5427 versions of init. Declare init_undefined.
5428 (class Symbol_table): Declare new functions.
5429 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5431 (Symbol::init_base_output_data): Likewise.
5432 (Symbol::init_base_output_segment): Likewise.
5433 (Symbol::init_base_constant): Likewise.
5434 (Symbol::init_base_undefined): New function.
5435 (Sized_symbol::init_object): Rename from init. Change all
5437 (Sized_symbol::init_output_data): Likewise.
5438 (Sized_symbol::init_output_segment): Likewise.
5439 (Sized_symbol::init_constant): Likewise.
5440 (Sized_symbol::init_undefined): New function.
5441 (Symbol_table::add_undefined_symbols_from_command_line): New
5443 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5445 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5446 (Symbol::output_section): Likewise.
5447 (Symbol::set_output_section): Likewise.
5448 (Symbol_table::sized_finalize_symbol): Likewise.
5449 (Symbol_table::sized_write_globals): Likewise.
5450 * resolve.cc (Symbol_table::should_override): Likewise.
5451 (Symbol::override_base_with_special): Likewise.
5453 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5454 symbol, change it to have default visibility.
5455 * testsuite/protected_1.cc: New file.
5456 * testsuite/protected_2.cc: New file.
5457 * testsuite/protected_3.cc: New file.
5458 * testsuite/protected_main_1.cc: New file.
5459 * testsuite/protected_main_2.cc: New file.
5460 * testsuite/protected_main_3.cc: New file.
5461 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5462 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5463 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5464 (protected_1.so): New target.
5465 (protected_1_pic.o, protected_2_pic.o): New targets.
5466 (protected_3_pic.o): New target.
5467 (check_PROGRAMS): Add protected_2.
5468 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5469 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5470 * testsuite/Makefile.in: Rebuild.
5472 * options.h (DEFINE_var): Add set_user_set_##varname__.
5473 (DEFINE_bool_alias): New macro.
5474 (class General_options): Define -Bstatic using DEFINE_bool_alias
5475 rather than DEFINE_special. Add --undefined as an alias for -z
5477 * options.cc (General_options::parse_Bstatic): Remove.
5479 * options.h (class General_options): Add --fatal-warnings.
5480 * main.cc (main): Implement --fatal-warnings.
5481 * errors.h (Errors::warning_count): New function.
5483 * options.h (class General_options): Add -Bsymbolic-functions.
5484 * symtab.h (Symbol::is_preemptible): Check for
5485 -Bsymbolic-functions.
5487 2008-05-05 Ian Lance Taylor <iant@google.com>
5489 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5490 as noVARNAME rather than no-VARNAME.
5491 (class General_options): Add option -z combreloc.
5492 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5494 (Output_reloc::sort_before) [SHT_REL]: New function.
5495 (Output_reloc::sort_before) [SHT_RELA]: New function.
5496 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5497 Sort_relocs_comparison.
5498 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5499 parameter. Change all callers.
5500 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5501 sort_relocs parameter. Change all callers.
5502 * output.cc (Output_reloc::get_address): New function, broken out
5504 (Output_reloc::write_rel): Call it.
5505 (Output_reloc::compare): New function.
5506 (Output_data_reloc_base::do_write): Optionally sort relocs.
5508 * configure.ac: If targ_extra_obj is set, link it in.
5509 * configure.tgt: Initialize all variables.
5510 (x86_64*): Set targ_extra_obj and targ_extra_size.
5511 * configure: Rebuild.
5513 * object.cc (Sized_relobj::include_section_group): Adjust section
5514 indexes read from group data. Build vector to pass to
5516 * layout.cc (Layout::layout_group): Add flags and shndxes
5517 parameters. Remove contents parameter. Change caller. Update
5518 explicit instantiations.
5519 * layout.h (class Layout): Update layout_group declaration.
5520 * output.cc (Output_data_group::Output_data_group): Add flags and
5521 input_shndxes parameters. Remove contents parameter. Change
5523 (Output_data_group::do_write): Change input_sections_ to
5525 * output.h (class Output_data_group): Update constructor
5526 declaration. Rename input_sections_ to input_shndxes_.
5527 * testsuite/many_sections_test.cc: Add template.
5529 2008-04-30 Cary Coutant <ccoutant@google.com>
5531 * target-reloc.h (relocate_section): Fix dead-pointer bug.
5533 * layout.cc (Layout::include_section): Refactored check for debug
5535 (Layout::add_comdat): Add new parameters. Change type
5536 of signature parameter. Add object and shndx to signatures table.
5537 (Layout::find_kept_object): New function.
5538 * layout.h: Include <cstring>.
5539 (Layout::is_debug_info_section): New function.
5540 (Layout::add_comdat): Add new parameters.
5541 (Layout::find_kept_object): New function.
5542 (Layout::Kept_section): New struct.
5543 (Layout::Signatures): Change type of map range.
5544 * object.cc (Relobj::output_section_address): New function.
5545 (Sized_relobj::include_section_group): Add new parameters. Change
5546 calls to Layout::add_comdat. Change to build table of kept comdat
5547 groups and table mapping discarded sections to kept sections.
5548 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5549 (Sized_relobj::do_layout): Change calls to include_section_group and
5550 include_linkonce_section.
5551 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5552 value to zero when section is discarded.
5553 (Sized_relobj::map_to_kept_section): New function.
5554 * object.h (Relobj::output_section_address): New function.
5555 (Relobj::Comdat_group): New type.
5556 (Relobj::find_comdat_group): New function.
5557 (Relobj::Comdat_group_table): New type.
5558 (Relobj::Kept_comdat_section): New type.
5559 (Relobj::Kept_comdat_section_table): New type.
5560 (Relobj::add_comdat_group): New function.
5561 (Relobj::set_kept_comdat_section): New function.
5562 (Relobj::get_kept_comdat_section): New function.
5563 (Relobj::comdat_groups_): New field.
5564 (Relobj::kept_comdat_sections_): New field.
5565 (Symbol_value::input_value): Update comment.
5566 (Sized_relobj::map_to_kept_section) New function.
5567 (Sized_relobj::include_linkonce_section): Add new parameter.
5568 * target-reloc.h (Comdat_behavior): New type.
5569 (get_comdat_behavior): New function.
5570 (relocate_section): Add code to map a discarded section to the
5571 corresponding kept section when applying a relocation.
5573 2008-04-30 Craig Silverstein <csilvers@google.com>
5575 * dwarf_reader.cc (next_generation_count): New static var.
5576 (Addr2line_cache_entry): New struct.
5577 (addr2line_cache): New static var.
5578 (Dwarf_line_info::one_addr2line): Added caching.
5579 (Dwarf_line_info::clear_addr2line_cache): New function.
5580 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5581 cache-size parameter.
5582 (Dwarf_line_info::one_addr2line_cache): New function.
5583 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5584 new cache-size argument to one_addr2line(), and clear cache.
5586 2008-04-28 Cary Coutant <ccoutant@google.com>
5588 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5589 R_386_PC8 relocations.
5591 2008-04-23 Ian Lance Taylor <iant@google.com>
5593 * object.cc (Sized_relobj::include_section_group): Check for
5594 invalid section group.
5596 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5599 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5600 than read for file header.
5601 * archive.cc (Archive::include_member): Likewise.
5603 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
5605 * aclocal.m4: Regenerate.
5606 * configure: Regenerate.
5608 2008-04-19 Ian Lance Taylor <iant@google.com>
5610 * version.cc (version_string): Bump to 1.6.
5612 * testsuite/Makefile.am (many_sections_r_test): New target.
5613 (many_sections_r_test_SOURCES): Remove.
5614 (many_sections_r_test_DEPENDENCIES): Remove.
5615 (many_sections_r_test_LDFLAGS): Remove.
5616 (many_sections_r_test_LDADD): Remove.
5618 * object.cc (Sized_relobj::do_add_symbols): Always pass
5619 local_symbol_count_ to add_from_relobj.
5621 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5622 every thousand variables.
5623 * testsuite/Makefile.in: Rebuild.
5625 * object.cc (Xindex::initialize_symtab_xindex): New function.
5626 (Xindex::read_symtab_xindex): New function.
5627 (Xindex::sym_xindex_to_shndx): New function.
5628 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5630 (Sized_relobj::do_initialize_xindex): New function.
5631 (Sized_relobj::do_read_symbols): Adjust section links.
5632 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5633 parameter. Change all callers.
5634 (Sized_relobj::include_section_group): Adjust section links and
5635 symbol section indexes.
5636 (Sized_relobj::do_layout): Adjust section links.
5637 (Sized_relobj::do_count_local_symbols): Adjust section links and
5638 symbol section indexes.
5639 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5640 ordinary and special symbols.
5641 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5642 dynsym_xindex parameters. Change all callers. Adjust section
5643 links. Use SHN_XINDEX when needed.
5644 (Sized_relobj::get_symbol_location_info): Adjust section links.
5645 Don't get fooled by special symbols.
5646 * object.h (class Xindex): Define.
5647 (class Object): Add xindex_ parameter. Declare virtual functoin
5648 do_initialize_xindex.
5649 (Object::adjust_sym_shndx): New function.
5650 (Object::set_xindex): New protected function.
5651 (class Symbol_value): Add is_ordinary_shndx_ field.
5652 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5653 (Symbol_value::value): Assert ordinary section.
5654 (Symbol_value::initialize_input_to_output_map): Likewise.
5655 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5657 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5659 (class Sized_relobj): Update declarations.
5660 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5661 parameter. Change all callers.
5662 (Sized_relobj::adjust_shndx): New function.
5663 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5665 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5666 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5667 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5668 (Sized_dynobj::read_dynsym_section): Adjust section links.
5669 (Sized_dynobj::read_dynamic): Likewise.
5670 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5672 (Sized_dynobj::do_initialize_xindex): New function.
5673 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5674 do_initialize_xindex.
5675 (Sized_dynobj::adjust_shndx): New function.
5676 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5677 dynsym_xindex_ fields.
5678 (Layout::finalize): Add a call to set_section_indexes before
5679 creating the symtab sections.
5680 (Layout::set_section_indexes): Don't do anything if the section
5681 already has a section index.
5682 (Layout::create_symtab_sections): Add shnum parameter. Change
5683 caller. Create .symtab_shndx section if needed.
5684 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5686 (Layout::allocated_output_section_count): New function.
5687 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5689 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5690 fields. Update declarations.
5691 (Layout::symtab_xindex): New function.
5692 (Layout::dynsym_xindex): New function.
5693 (class Write_symbols_task): Add layout_ field.
5694 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5696 * output.cc (Output_section_headers::Output_section_headers): Add
5697 shstrtab_section parameter. Change all callers.
5698 (Output_section_headers::do_sized_write): Store overflow values
5699 for section count and section string table section index in
5700 section header zero.
5701 (Output_file_header::do_sized_write): Check for overflow of
5702 section count and section string table section index.
5703 (Output_symtab_xindex::do_write): New function.
5704 (Output_symtab_xindex::endian_do_write): New function.
5705 * output.h (class Output_section_headers): Add shstrtab_section_.
5706 Update declarations.
5707 (class Output_symtab_xindex): Define.
5708 (Output_section::has_out_shndx): New function.
5709 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5711 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5713 (Sized_symbol::init): Likewise.
5714 (Symbol::output_section): Check for ordinary symbol.
5715 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5716 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5718 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5719 Change all callers. Simplify handling of symbols from sections
5720 not included in the link.
5721 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5723 (Weak_alias_sorter::operator()): Assert that symbols are
5725 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5727 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5728 parameters. Change all callers.
5729 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5730 symbol distinction. Use SHN_XINDEX when needed.
5731 (Symbol_table::write_section_symbol): Add symtab_xindex
5732 parameter. Change all callers.
5733 (Symbol_table::sized_write_section_symbol): Likewise. Use
5734 SHN_XINDEX when needed.
5735 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5737 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5738 (Symbol::is_defined): Check is_ordinary.
5739 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5740 (Symbol::is_absolute, Symbol::is_common): Likewise.
5741 (class Sized_symbol): Update declarations.
5742 (class Symbol_table): Update declarations.
5743 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5744 parameters. Change all callers.
5745 (Sized_symbol::override): Likewise.
5746 (Symbol_table::override): Likewise.
5747 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5748 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5749 is_ordinary, and orig_st_shndx parameters. Change all callers.
5750 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5751 to be in an ordinary section.
5752 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5753 object and is_ordinary parameters. Change all callers.
5754 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5755 Change all callers. Don't add undefined or non-ordinary symbols
5757 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5759 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5761 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5762 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5763 (Sized_relobj::relocate_sections): Likewise.
5764 * target-reloc.h (scan_relocs): Adjust section symbol index.
5765 (scan_relocatable_relocs): Likewise.
5766 * i386.cc (Scan::local): Check for ordinary symbols.
5767 * sparc.cc (Scan::local): Likewise.
5768 * x86_64.cc (Scan::local): Likewise.
5769 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5770 to symbol_section_and_value.
5771 * testsuite/many_sections_test.cc: New file.
5772 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5773 (check_PROGRAMS): Add many_sections_test.
5774 (many_sections_test_SOURCES): Define.
5775 (many_sections_test_DEPENDENCIES): Define.
5776 (many_sections_test_LDFLAGS): Define.
5777 (BUILT_SOURCES): Add many_sections_define.h.
5778 (many_sections_define.h): New target.
5779 (BUILT_SOURCES): Add many_sections_check.h.
5780 (many_sections_check.h): New target.
5781 (check_PROGRAMS): Add many_sections_r_test.
5782 (many_sections_r_test_SOURCES): Define.
5783 (many_sections_r_test_DEPENDENCIES): Define.
5784 (many_sections_r_test_LDFLAGS): Define.
5785 (many_sections_r_test_LDADD): Define.
5786 (many_sections_r_test.o): New target.
5787 * testsuite/Makefile.in: Rebuild.
5789 2008-04-17 Cary Coutant <ccoutant@google.com>
5791 * errors.cc (Errors::info): New function.
5792 (gold_info): New function.
5793 * errors.h (Errors::info): New function.
5794 * gold.h (gold_info): New function.
5795 * object.cc (Input_objects::add_object): Print trace output.
5796 * options.cc (options::parse_set): New function.
5797 (General_options::parse_wrap): Deleted.
5798 (General_options::General_options): Deleted initializer.
5799 * options.h (options::String_set): New typedef.
5800 (options::parse_set): New function.
5801 (DEFINE_set): New macro.
5802 (General_options::wrap): Changed to use DEFINE_set. Changed
5803 callers of any_wrap_symbols and is_wrap_symbol.
5804 (General_options::trace, General_options::trace_symbol):
5806 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5807 (General_options::wrap_symbols_): Deleted.
5808 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5810 2008-04-17 David S. Miller <davem@davemloft.net>
5812 * options.cc (General_options::parse_V): New function.
5813 * options.h: Add entries for -V and -Qy.
5815 2008-04-17 Ian Lance Taylor <iant@google.com>
5817 * common.cc (Symbol_table::allocate_commons): Remove options
5818 parameter. Change caller.
5819 (Symbol_table::do_allocate_commons): Remove options parameter.
5820 Change caller. Just call do_allocate_commons_list twice.
5821 (Symbol_table::do_allocate_commons_list): New function, broken out
5822 of do_allocate_commons.
5823 * common.h (class Allocate_commons_task): Remove options_ field.
5825 * symtab.cc (Symbol_table::Symbol_table): Initialize
5827 (Symbol_table::add_from_object): Put TLS common symbols on
5829 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5830 which are IN_OUTPUT_DATA.
5831 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5832 allocate_commons and do_allocate_commons declarations. Declare
5833 do_allocate_commons_list.
5834 * gold.cc (queue_middle_tasks): Update creation of
5835 Allocate_commons_task to not pass options.
5836 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5837 (TLS_TEST_C_FLAGS): New variable.
5838 (tls_test_c_pic.o): New target.
5839 (tls_test_shared.so): Link in tls_test_c_pic.o.
5840 (tls_test_c_pic_ie.o): New target.
5841 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5842 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5843 (tls_test_c.o): New target.
5844 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5845 (tls_pic_test_LDADD): Likewise.
5846 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5847 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5848 (tls_test_c_gnu2.o): New target.
5849 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5851 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5852 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5853 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5854 * testsuite/tls_test.cc: Include "config.h".
5855 (t_last): Call t11_last.
5856 * testsuite/tls_test.h (t11, t11_last): Declare.
5857 * testsuite/tls_test_c.c: New file.
5858 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5859 * configure.ac: Check for OpenMP support.
5860 * configure, config.in, Makefile.in: Rebuild.
5861 * testsuite/Makefile.in: Rebuild.
5863 2008-04-16 Cary Coutant <ccoutant@google.com>
5865 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5866 (Target_i386::tls_base_symbol_defined_): New field.
5867 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5868 (Target_i386::Scan::global): Likewise.
5869 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5870 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5871 (Target_x86_64::tls_base_symbol_defined_): New field.
5872 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5873 (Target_x86_64::Scan::global): Likewise.
5875 2008-04-16 Cary Coutant <ccoutant@google.com>
5877 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5878 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5879 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5880 building shared libraries.
5881 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5882 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5883 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5884 * testsuite/Makefile.in: Rebuild.
5885 * testsuite/weak_undef.h: New file.
5886 * testsuite/weak_undef_file1.cc: Add extra test cases.
5887 * testsuite/weak_undef_file2.cc: Likewise.
5888 * testsuite/weak_undef_test.cc: Likewise.
5890 2008-04-16 David S. Miller <davem@davemloft.net>
5892 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5893 Add issued_non_pic_error_ field. Declare check_non_pic.
5894 (Target_sparc::Scan::check_non_pic): New function.
5895 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5896 (Target_sparc::Scan::global): Likewise.
5898 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5899 * configure: Rebuild.
5901 * options.h (DEFINE_enable): New macro.
5902 (new_dtags): New enable option.
5903 (initfirst, interpose, loadfltr, nodefaultlib,
5904 nodelete, nodlopen, nodump): New -z options.
5905 * layout.cc (Layout:finish_dynamic_section): If new
5906 dtags enabled, emit DT_RUNPATH. Also, emit a
5907 DT_FLAGS_1 containing any specified -z flags.
5909 2008-04-16 Ian Lance Taylor <iant@google.com>
5911 * copy-relocs.cc: New file.
5912 * copy-relocs.h: New file.
5913 * reloc.cc: Remove Copy_relocs code.
5914 * reloc.h: Likewise.
5915 * reloc-types.h (struct Reloc_types) [both versions]: Add
5916 get_reloc_addend_noerror.
5917 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5918 variants of add_global which take an addend which must be zero.
5919 * i386.cc: Include "copy-relocs.h".
5920 (class Target_i386): Change type of copy_relocs_ to variable,
5922 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5924 (Target_i386::do_finalize_sections): Change handling of
5926 * sparc.cc: Include "copy-relocs.h".
5927 (class Target_sparc): Change type of copy_relocs_ to variable,
5929 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5931 (Target_sparc::do_finalize_sections): Change handling of
5933 * x86_64.cc: Include "copy-relocs.h".
5934 (class Target_x86_64): Change type of copy_relocs_ to variable,
5936 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5937 class. Change all callers.
5938 (Target_x86_64::do_finalize_sections): Change handling of
5940 * Makefile.am (CCFILES): Add copy-relocs.cc.
5941 (HFILES): Add copy-relocs.h.
5943 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5945 * testsuite/script_test_4.sh: Permit leading zeroes.
5947 2008-04-15 Ian Lance Taylor <iant@google.com>
5949 * script-sections.cc (Script_sections::create_segments): Use
5950 header_size_adjustment even when there is enough room for the
5952 * testsuite/script_test_4.sh: New file.
5953 * testsuite/script_test_4.t: New file.
5954 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5955 (check_DATA): Add script_test_4.stdout.
5956 (MOSTLYCLEANFILES): Likewise.
5957 (script_test_4): New target.
5958 (script_test_4.stdout): New target.
5959 * testsuite/Makefile.in: Rebuild.
5961 * sparc.cc: Add definitions for Output_data_plt_sparc class
5964 2008-04-14 David S. Miller <davem@davemloft.net>
5966 * sparc.cc: New file.
5967 * Makefile.am (TARGETSOURCES): Add sparc.cc
5968 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5969 * configure.tgt: Document targ_extra_size and
5970 targ_extra_big_endian. Add entries for sparc-* and
5972 * configure.ac: Handle targ_extra_size and
5973 targ_extra_big_endian.
5974 * Makefile.in: Rebuild.
5975 * configure: Likewise.
5976 * po/POTFILES.in: Likewise.
5977 * po/gold.pot: Likewise.
5979 2008-04-14 Ian Lance Taylor <iant@google.com>
5981 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5982 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5983 in the name/type/flags to section mapping. Don't call
5984 allocate_output_section.
5985 (Layout::choose_output_section): Change parameter from adjust_name
5986 to is_input_section. Don't permit input sections after sections
5987 are attached to segments. Don't call allocate_output_section.
5988 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5989 not write_enable_output_section.
5990 (Layout::make_output_section): Don't push to
5991 unattached_section_list_ nor call attach_to_segment. Call
5992 attach_section_to_segment if sections are attached.
5993 (Layout::attach_sections_to_segments): New function.
5994 (Layout::attach_section_to_segment): New function.
5995 (Layout::attach_allocated_section_to_segment): Rename from
5996 attach_to_segment. Remove flags parameter.
5997 (Layout::allocate_output_section): Remove function.
5998 (Layout::write_enable_output_section): Remove function.
5999 * layout.h (class Layout): Update for above changes. Add new
6000 field sections_are_attached_.
6001 * output.h (Output_section::update_flags_for_input_section): New
6003 * output.cc (Output_section::add_input_section): Call
6004 update_flags_for_input_section.
6005 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
6007 2008-04-11 Cary Coutant <ccoutant@google.com>
6009 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
6010 thought unnecessary.
6011 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
6013 2008-04-11 Ian Lance Taylor <iant@google.com>
6015 * output.h (class Output_section_data): Remove inline definition
6017 * output.cc (Output_section_data::set_addralign): New function.
6019 2008-04-11 Cary Coutant <ccoutant@google.com>
6021 Add support for TLS descriptors for i386 and x86_64.
6022 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
6023 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
6024 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
6026 (Target_i386::got_mod_index_entry): Remove unnecessary code.
6027 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
6028 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
6030 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
6031 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
6032 Fix problem with initial-exec relocations.
6033 (Target_i386::Relocate::relocate_tls): Likewise.
6034 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
6036 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
6037 support for section-plus-offset dynamic table entries.
6038 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
6039 (Output_data_dynamic::Dynamic_entry): Add support for
6040 section-plus-offset dynamic table entries.
6041 (Output_data_dynamic::Classification): Likewise.
6042 (Output_data_dynamic::classification_): Renamed offset_.
6043 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
6044 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
6045 (Target_x86_64::make_plt_section): New function.
6046 (Target_x86_64::reserve_tlsdesc_entries): New function.
6047 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
6048 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
6049 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
6050 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
6051 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
6052 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
6053 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
6054 add extra PLT entry for TLS descriptors.
6055 (Output_data_plt_x86_64::got_): New field.
6056 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
6057 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
6059 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
6061 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
6062 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
6063 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
6064 R_386_TLS_DESC_CALL relocations.
6065 (Target_x86_64::Scan::global): Likewise.
6066 (Target_x86_64::do_finalize_sections): Add dynamic table entries
6067 for TLS descriptors.
6068 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
6069 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
6070 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
6071 GD-to-IE relaxation.
6072 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
6073 and TLS_DESCRIPTORS.
6074 * Makefile.in: Rebuild.
6075 * configure: Rebuild.
6076 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
6077 (tls_test_shared2.so): New target.
6078 (tls_shared_gd_to_ie_test_SOURCES): New variable.
6079 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
6080 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
6081 (tls_shared_gd_to_ie_test_LDADD): New variable.
6082 (tls_shared_gnu2_gd_to_ie_test): New target.
6083 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
6085 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
6086 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
6087 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
6088 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
6089 (tls_shared_gnu2_test): New target.
6090 (tls_test_gnu2_shared.so): New target.
6091 (tls_shared_gnu2_test_SOURCES): New variable.
6092 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
6093 (tls_shared_gnu2_test_LDFLAGS): New variable.
6094 (tls_shared_gnu2_test_LDADD): New variable.
6095 * testsuite/Makefile.in: Rebuild.
6096 * testsuite/Makefile.
6098 2008-04-11 Ian Lance Taylor <iant@google.com>
6100 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
6102 * testsuite/Makefile.in: Rebuild.
6104 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
6106 * testsuite/script_test_2.cc (main): Adjust test.
6108 2008-04-11 David S. Miller <davem@davemloft.net>
6109 Ian Lance Taylor <iant@google.com>
6111 * options.h (General_options): Add entries for '-Y' and
6113 * options.cc (General_options:finalize): If -Y was used, add those
6114 entries to the library path instead of the default "/lib" and
6117 2008-04-11 David S. Miller <davem@davemloft.net>
6119 * testsuite/justsyms.t: Start at 0x100.
6120 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
6121 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
6123 * testsuite/script_test_2.cc: Adjust string and section length
6126 2008-04-09 Ian Lance Taylor <iant@google.com>
6129 * script-sections.cc (Sections_element::allocate_to_segment): Add
6131 (Output_section_definition::allocate_to_segment): Likewise.
6132 (Orphan_output_section::allocate_to_segment): Likewise.
6133 (Script_sections::attach_sections_using_phdrs_clause): Don't
6134 propagate non-PT_LOAD segments to orphan sections.
6135 * testsuite/Makefile.am (script_test_3.stdout): Generate using
6136 readelf rather than objdump.
6137 * testsuite/script_test_3.sh: Adjust accordingly. Test that
6138 .interp section and PT_INTERP segment are the same size.
6139 * testsuite/Makefile.in: Rebuild.
6141 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
6142 aliases for symbols defined in the same object.
6143 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
6144 (weak_alias_test_SOURCES): New variable.
6145 (weak_alias_test_DEPENDENCIES): New variable.
6146 (weak_alias_test_LDFLAGS): New variable.
6147 (weak_alias_test_LDADD): New variable.
6148 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
6149 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
6150 (weak_alias_test_3.o): New target.
6151 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
6152 * testsuite/weak_alias_test_main.cc: New file.
6153 * testsuite/weak_alias_test_1.cc: New file.
6154 * testsuite/weak_alias_test_2.cc: New file.
6155 * testsuite/weak_alias_test_3.cc: New file.
6157 2008-04-08 Ian Lance Taylor <iant@google.com>
6159 * options.h (class General_options): Add --noinhibit-exec option.
6160 * main.cc (main): Check --noinhibit-exec.
6162 * options.h (class General_options): Define --wrap as a special
6163 option. Add wrap_symbols_ field.
6164 (General_options::any_wrap_symbols): New function.
6165 (General_options::is_wrap_symbol): New function.
6166 * options.cc (General_options::parse_wrap): New function.
6167 (General_options::General_options): Initialize wrap_symbols_.
6168 * symtab.cc (Symbol_table::wrap_symbol): New function.
6169 (Symbol_table::add_from_object): Handle --wrap.
6170 * symtab.h (class Symbol_table): Declare wrap_symbol.
6171 * target.h (Target::wrap_char): New function.
6172 (Target::Target_info): Add wrap_char field.
6173 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6174 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6175 * testsuite/testfile.cc (Target_test::test_target_info):
6178 * errors.cc (Errors::undefined_symbol): Mention symbol version if
6181 * layout.h (class Layout): Add added_eh_frame_data_ field.
6182 * layout.cc (Layout::Layout): Initialize new field.
6183 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6184 output section until we find a section we merged successfully.
6185 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6186 that the size be non-zero.
6188 * merge.cc (Object_merge_map::get_output_offset): Remove inline
6191 2008-04-08 Craig Silverstein <csilvers@google.com>
6193 * configure.ac: Export new conditional variable HAVE_ZLIB.
6194 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6196 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6197 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6199 2008-04-07 Ian Lance Taylor <iant@google.com>
6201 * version.cc (version_string): Set to "1.5".
6203 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6204 Add issued_non_pic_error_ field. Declare check_non_pic.
6205 (Target_x86_64::Scan::check_non_pic): New function.
6206 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6207 (Target_x86_64::Scan::global): Likewise.
6209 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6210 addend parameter. Change caller. Handle merge sections.
6211 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6212 Address to Addend. Don't add in the result of
6213 local_section_offset, pass down the addend and use the returned
6215 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6216 Update declarations of local_section_offset and symbol_value.
6217 * testsuite/two_file_test_1.cc (t18): New function.
6218 * testsuite/two_file_test_2.cc (f18): New function.
6219 * testsuite/two_file_test_main.cc (main): Call t18.
6220 * testsuite/two_file_test.h (t18, f18): Declare.
6222 * configure.ac: Don't test for objdump, c++filt, or readelf.
6223 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6225 (TEST_READELF): New variable.
6226 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6227 (check_PROGRAMS): Add two_file_strip_test.
6228 (two_file_strip_test): New target.
6229 (check_PROGRAMS): Add two_file_same_shared_strip_test.
6230 (two_file_same_shared_strip_test_SOURCES): New variable.
6231 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6232 (two_file_same_shared_strip_test_LDFLAGS): New variable.
6233 (two_file_same_shared_strip_test_LDADD): New variable.
6234 (two_file_shared_strip.so): New target.
6235 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6236 (ver_test_5.syms, ver_test_7.syms): Likewise.
6237 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6238 (strip_test_3.stdout): Use TEST_OBJDUMP.
6239 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6241 2008-04-04 Cary Coutant <ccoutant@google.com>
6243 * symtab.h (Symbol::is_weak_undefined): New function.
6244 (Symbol::is_strong_undefined): New function.
6245 (Symbol::is_absolute): New function.
6246 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6247 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6249 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6250 (weak_undef_test): New target.
6251 * testsuite/Makefile.in: Rebuild.
6252 * testsuite/weak_undef_file1.cc: New file.
6253 * testsuite/weak_undef_file2.cc: New file.
6254 * testsuite/weak_undef_test.cc: New file.
6256 2008-04-03 Craig Silverstein <csilvers@google.com>
6258 * compressed_output.h (class Output_compressed_section): Use
6260 * compressed_output.cc (zlib_compress): Use unsigned buffers,
6262 (zlib_compressed_suffix): Removed.
6263 (Output_compressed_section::set_final_data_size): Use unsigned
6265 * testsuite/Makefile.am (flagstest_compress_debug_sections):
6266 Fix linker invocation.
6267 (flagstest_o_specialfile_and_compress_debug_sections):
6269 * testsuite/Makefile.in: Regenerated.
6271 2008-04-02 David S. Miller <davem@davemloft.net>
6273 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6274 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6276 2008-04-02 Craig Silverstein <csilvers@google.com>
6280 2008-04-02 Ian Lance Taylor <iant@google.com>
6282 * fileread.cc (File_read::find_view): Add byteshift and vshifted
6283 parameters. Update for new key type to views_. Change all
6285 (File_read::read): Adjust for byteshift in returned view.
6286 (File_read::add_view): New function, broken out of
6288 (File_read::make_view): New function, broken out of
6290 (File_read::find_or_make_view): Add offset and aligned
6291 parameters. Rewrite accordingly. Change all callers.
6292 (File_read::get_view): Add offset and aligned parameters. Adjust
6293 for byteshift in return value.
6294 (File_read::get_lasting_view): Likewise.
6295 * fileread.h (class File_read): Update declarations.
6296 (class File_read::View): Add byteshift_ field. Add byteshift to
6297 constructor. Add byteshift method.
6298 * archive.h (Archive::clear_uncached_views): New function.
6299 (Archive::get_view): Add aligned parameter. Change all callers.
6300 * object.h (Object::get_view): Add aligned parameter. Change all
6302 (Object::get_lasting_view): Likewise.
6304 * fileread.cc (File_read::release): Don't call clear_views if
6305 there are multiple objects.
6306 * fileread.h (File_read::clear_uncached_views): New function.
6307 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6310 2008-03-31 Cary Coutant <ccoutant@google.com>
6312 Add thin archive support.
6313 * archive.cc (Archive::armagt): New const.
6314 (Archive::setup): Remove task parameter and calls to unlock.
6315 (Archive::unlock_nested_archives): New function.
6316 (Archive::read_header): Add nested_off parameter. Change
6318 (Archive::interpret_header): Likewise.
6319 (Archive::include_all_members): Change to handle thin
6321 (Archive::include_member): Likewise.
6322 * archive.h (Archive::Archive): Add new parameters and
6324 (Archive::armagt): New const.
6325 (Archive::setup): Remove task parameter.
6326 (Archive::unlock_nested_archives): New function.
6327 (Archive::read_header): Add nested_off parameter.
6328 (Archive::interpret_header): Likewise.
6329 (Archive::Nested_archive_table): New typedef.
6330 (Archive::is_thin_archive_): New field.
6331 (Archive::nested_archives_): New field.
6332 (Archive::options_): New field.
6333 (Archive::dirpath_): New field.
6334 (Archive::task_): New field.
6335 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6336 for thin archives. Pass additional parameters to
6337 Archive::Archive. Unlock the archive file after calling
6340 2008-03-29 Ian Lance Taylor <iant@google.com>
6342 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6343 version symbol to be local.
6344 * testsuite/ver_test_4.sh: New file.
6345 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6346 (check_DATA): Add ver_test_4.syms.
6347 (ver_test_4.syms): New target.
6348 * testsuite/Makefile.in: Rebuild.
6351 (Output_section::Input_section_sort_entry::has_priority): New
6353 (Output_section::Input_section_sort_entry::match_file_name): New
6355 (Output_section::Input_section_sort_entry::match_section_name):
6357 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6359 (Output_section::Input_section_sort_entry::match_section_file):
6361 (Output_section::Input_section_sort_compare::operator()): Rewrite
6362 using new Input_section_sort_entry functions. Sort crtbegin and
6363 crtend first. Sort sections with no priority before sections with
6365 * testsuite/initpri1.c (d3): Check j != 4.
6366 (cd5): New constructor/destructor function.
6367 (main): Check j != 2.
6369 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6370 new symbol when resolving, don't call set_is_default.
6371 * testsuite/ver_test_7.cc: New file.
6372 * testsuite/ver_test_7.sh: New file.
6373 * testsuite/Makefile.am (ver_test_7.so): New target.
6374 (ver_test_7.o): New target.
6375 (check_SCRIPTS): Add ver_test_7.sh.
6376 (check_DATA): Add ver_test_7.syms.
6377 (ver_test_7.syms): New target.
6379 2008-03-28 Ian Lance Taylor <iant@google.com>
6381 * layout.cc (Layout::layout): If we see an input section with a
6382 name that needs sorting, set the must_sort flag for the output
6384 (Layout::make_output_section): If the name of the output section
6385 indicates that it might require sorting, set the may_sort flag.
6386 * output.h (Output_section::may_sort_attached_input_sections): New
6388 (Output_section::set_may_sort_attached_input_sections): New
6390 (Output_section::must_sort_attached_input_sections): New
6392 (Output_section::set_must_sort_attached_input_sections): New
6394 (class Output_section): Declare Input_section_sort_entry. Define
6395 Input_section_sort_compare. Declare
6396 sort_attached_input_sections. Add new fields:
6397 may_sort_attached_input_sections_,
6398 must_sort_attached_input_sections_,
6399 attached_input_sections_are_sorted_.
6400 * output.cc (Output_section::Output_section): Initialize new
6402 (Output_section::add_input_section): Add an entry to
6403 input_sections_ if may_sort or must_sort are true.
6404 (Output_section::set_final_data_size): Call
6405 sort_attached_input_sections if necessary.
6406 (Output_section::Input_section_sort_entry): Define new class.
6407 (Output_section::Input_section_sort_compare::operator()): New
6409 (Output_section::sort_attached_input_sections): New function.
6410 * configure.ac: Check whether the compiler supports constructor
6411 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6412 * testsuite/initpri1.c: New file.
6413 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6414 CONSTRUCTOR_PRIORITY.
6415 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6416 (initpri1_LDFLAGS): New variable.
6417 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6419 2008-03-27 Ian Lance Taylor <iant@google.com>
6421 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6422 * testsuite/common_test_1.c: New file.
6423 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6424 (common_test_1_SOURCES): New variable.
6425 (common_test_1_DEPENDENCIES): New variable.
6426 (common_test_1_LDFLAGS): New variable.
6428 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6429 and commons_ correctly when NAME/VERSION does not override
6431 * testsuite/ver_test_6.c: New file.
6432 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6433 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6434 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6436 2008-03-26 Ian Lance Taylor <iant@google.com>
6438 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6439 of an undefined symbol from a version script.
6440 * testsuite/Makefile.am (ver_test_5.so): New target.
6441 (ver_test_5.o): New target.
6442 (check_SCRIPTS): Add ver_test_5.sh.
6443 (check_DATA): Add ver_test_5.syms.
6444 (ver_test_5.syms): New target.
6445 * testsuite/ver_test_5.cc: New file.
6446 * testsuite/ver_test_5.script: New file.
6447 * testsuite/ver_test_5.sh: New file.
6448 * Makefile.in, testsuite/Makefile.in: Rebuild.
6451 Fix problems building gold with gcc 4.3.0.
6452 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6453 (gold_error_at_location, gold_warning_at_location): Use it.
6454 * configure.ac: Check whether we can compile and use a template
6455 function with a printf attribute.
6456 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6457 when jumping over bytes.
6458 * object.cc: Instantiate Object::read_section_data.
6459 * debug.h: Include <cstring>
6460 * dwarf_reader.cc: Include <algorithm>
6461 * main.cc: Include <cstring>.
6462 * options.cc: Include <cstring>.
6463 * output.cc: Include <cstring>.
6464 * script.cc: Include <cstring>.
6465 * script.h: Include <string>.
6466 * symtab.cc: Include <cstring> and <algorithm>.
6467 * target-select.cc: Include <cstring>.
6468 * version.cc: Include <string>.
6469 * testsuite/testmain.cc: Include <cstdlib>.
6470 * configure, config.in: Rebuild.
6472 2008-03-25 Ian Lance Taylor <iant@google.com>
6474 * options.cc: Include "../bfd/bfdver.h".
6475 (options::help): Print bug reporting address.
6477 * version.cc (print_version): Adjust output for current value of
6482 * options.cc (options::help): Print list of supported targets.
6483 * target-select.h: Include <vector>.
6484 (class Target_selector): Make machine_, size_, and is_big_endian_
6485 fields const. Add bfd_name_ and instantiated_target_ fields.
6486 (Target_selector::Target_selector): Add bfd_name parameter.
6487 (Target_selector::recognize): Make non-virtual, call
6489 (Target_selector::recognize_by_name): Make non-virtual, call
6490 do_recognize_by_name.
6491 (Target_selector::supported_names): New function.
6492 (Target_selector::bfd_name): New function.
6493 (Target_selector::do_instantiate_target): New pure virtual
6495 (Target_selector::do_recognize): New virtual function.
6496 (Target_selector::do_recognize_by_name): New virtual function.
6497 (Target_selector::instantiate_target): New private function.
6498 (supported_target_names): Declare.
6499 * target-select.cc (Target_selector::Target_selector): Update for
6500 new parameter and fields.
6501 (select_target_by_name): Check that the name matches before
6502 calling recognize_by_name.
6503 (supported_target_names): New function.
6504 * i386.cc (class Target_selector_i386): Update Target_selector
6505 constructor call. Remove recognize and recognize_by_name. Add
6506 do_instantiate_target.
6507 * x86_64.cc (class Target_selector_x86_64): Likewise.
6508 * testsuite/testfile.cc (class Target_selector_test): Update for
6509 changes to Target_selector.
6511 * README: Rewrite, with some notes on unsupported features.
6513 2008-03-24 Cary Coutant <ccoutant@google.com>
6515 * i386.cc (Target_i386::Got_type): New enum declaration.
6516 (Target_i386::Scan::local): Updated callers of Output_data_got
6518 (Target_i386::Scan::global): Likewise.
6519 (Target_i386::Relocate::relocate): Likewise.
6520 (Target_i386::Relocate::relocate_tls): Likewise.
6521 * object.h (Got_offset_list): New class.
6522 (Sized_relobj::local_has_got_offset): Added got_type parameter.
6523 (Sized_relobj::local_got_offset): Likewise.
6524 (Sized_relobj::set_local_got_offset): Likewise.
6525 (Sized_relobj::local_has_tls_got_offset): Removed.
6526 (Sized_relobj::local_tls_got_offset): Removed.
6527 (Sized_relobj::set_local_tls_got_offset): Removed.
6528 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6529 * output.cc (Output_data_got::add_global): Added got_type parameter.
6530 (Output_data_got::add_global_with_rel): Likewise.
6531 (Output_data_got::add_global_with_rela): Likewise.
6532 (Output_data_got::add_global_pair_with_rel): New function.
6533 (Output_data_got::add_global_pair_with_rela): New function.
6534 (Output_data_got::add_local): Added got_type parameter.
6535 (Output_data_got::add_local_with_rel): Likewise.
6536 (Output_data_got::add_local_with_rela): Likewise.
6537 (Output_data_got::add_local_pair_with_rel): New function.
6538 (Output_data_got::add_local_pair_with_rela): New function.
6539 (Output_data_got::add_global_tls): Removed.
6540 (Output_data_got::add_global_tls_with_rel): Removed.
6541 (Output_data_got::add_global_tls_with_rela): Removed.
6542 (Output_data_got::add_local_tls): Removed.
6543 (Output_data_got::add_local_tls_with_rel): Removed.
6544 (Output_data_got::add_local_tls_with_rela): Removed.
6545 * output.h (Output_data_got::add_global): Added got_type parameter.
6546 (Output_data_got::add_global_with_rel): Likewise.
6547 (Output_data_got::add_global_with_rela): Likewise.
6548 (Output_data_got::add_global_pair_with_rel): New function.
6549 (Output_data_got::add_global_pair_with_rela): New function.
6550 (Output_data_got::add_local): Added got_type parameter.
6551 (Output_data_got::add_local_with_rel): Likewise.
6552 (Output_data_got::add_local_with_rela): Likewise.
6553 (Output_data_got::add_local_pair_with_rel): New function.
6554 (Output_data_got::add_local_pair_with_rela): New function.
6555 (Output_data_got::add_global_tls): Removed.
6556 (Output_data_got::add_global_tls_with_rel): Removed.
6557 (Output_data_got::add_global_tls_with_rela): Removed.
6558 (Output_data_got::add_local_tls): Removed.
6559 (Output_data_got::add_local_tls_with_rel): Removed.
6560 (Output_data_got::add_local_tls_with_rela): Removed.
6561 * resolve.cc (Symbol::override_base_with_special): Removed
6562 reference to has_got_offset_ field.
6563 * symtab.cc (Symbol::init_fields): Replaced initialization
6564 of got_offset_ with got_offsets_. Removed initialization
6566 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6567 (Symbol::got_offset): Likewise.
6568 (Symbol::set_got_offset): Likewise.
6569 (Symbol::has_tls_got_offset): Removed.
6570 (Symbol::tls_got_offset): Removed.
6571 (Symbol::set_tls_got_offset): Removed.
6572 (Symbol::got_offset_): Removed.
6573 (Symbol::tls_mod_got_offset_): Removed.
6574 (Symbol::tls_pair_got_offset_): Removed.
6575 (Symbol::got_offsets_): New field.
6576 (Symbol::has_got_offset): Removed.
6577 (Symbol::has_tls_mod_got_offset): Removed.
6578 (Symbol::has_tls_pair_got_offset): Removed.
6579 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6580 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6582 (Target_x86_64::Scan::global): Likewise.
6583 (Target_x86_64::Relocate::relocate): Likewise.
6584 (Target_x86_64::Relocate::relocate_tls): Likewise.
6586 2008-03-25 Ben Elliston <bje@au.ibm.com>
6588 * yyscript.y: Fix spelling error in comment.
6590 2008-03-24 Ian Lance Taylor <iant@google.com>
6592 * options.h (class General_options): Define build_id option.
6593 * layout.h (class Layout): Declare write_build_id, create_note,
6594 create_build_id. Add build_id_note_ member.
6595 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6596 "libiberty.h", "md5.h", "sha1.h".
6597 (Layout::Layout): Initialize eh_frame_data_,
6598 eh_frame_hdr_section_, and build_id_note_.
6599 (Layout::finalize): Call create_build_id.
6600 (Layout::create_note): New function, broken out of
6601 Layout::create_gold_note.
6602 (Layout::create_gold_note): Call create_note.
6603 (Layout::create_build_id): New function.
6604 (Layout::write_build_id): New function.
6605 (Close_task_runner::run): Call write_build_id.
6607 * x86_64.cc: Correct license to GPLv3.
6609 2008-03-23 Ian Lance Taylor <iant@google.com>
6611 * options.cc: Include "demangle.h".
6612 (parse_optional_string): New function.
6613 (parse_long_option): Handle takes_optional_argument.
6614 (parse_short_option): Update dash_z initializer. Handle
6615 takes_optional_argument.
6616 (General_options::General_options): Initialize do_demangle_.
6617 (General_options::finalize): Set do_demangle_. Handle demangling
6619 * options.h (parse_optional_string): Declare.
6620 (struct One_option): Add optional_arg field. Update constructor.
6621 Update call constructor calls. Add takes_optional_argument
6623 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6624 (DEFINE_optional_string): Define.
6625 (General_options::demangle): Change from DEFINE_bool to
6626 DEFINE_optional_string.
6627 (General_options::no_demangle): New function.
6628 (General_options::do_demangle): New function.
6629 (General_options::set_do_demangle): New function.
6630 (General_options::execstack_status_): Move definition to end of
6632 (General_options::static_): Likewise.
6633 (General_options::do_demangle_): New field.
6634 * object.cc (big_endian>::get_symbol_location_info): Call
6635 Options::do_demangle, not Options::demangle.
6636 * symtab.cc (demangle): Likewise.
6638 2008-03-22 Ian Lance Taylor <iant@google.com>
6640 * gold.h: Include <cstddef> and <sys/types.h>
6641 * options.h: Include <cstring>.
6643 2008-03-21 Ian Lance Taylor <iant@google.com>
6645 * Added source code to GNU binutils.