gdb
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
c7f3c371
DK
12010-01-25 Doug Kwan <dougkwan@google.com>
2
3 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4 Fix warning due to signed and unsigned comparison on a 32-bit host.
5
8923b24c
DK
62010-01-22 Doug Kwan <dougkwan@google.com>
7
8 * arm.cc (Target_arm::do_relax): Record an output section for section
9 offset adjustment it contains any stub table that has changed.
10 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11 offsets in an output section if necessary.
12 * output.cc (Output_section::Output_section): Initialize
13 section_offsets_need_adjustments_.
14 (Output_section::add_input_section_for_script): Renamed to
15 Output_section::add_simple_input_section.
16 (Output_section::save_states): Add a comment.
17 (Output_section::discard_states): New method defintion.
18 (Output_section::adjust_section_offsets): Same.
19 * output.h (Output_section::add_input_section_for_script): Renamed to
20 Output_section::add_simple_input_section.
21 (Output_section::discard_states): New method declaration.
22 (Output_section::adjust_section_offsets): Same.
23 (Output_section::section_offsets_need_adjustment,
24 Output_section::set_section_offsets_need_adjustment): New method
25 definitions.
26 (Output_section::section_offsets_need_adjustment_): New data member.
27 * script-sections.cc
28 (Output_section_element_input::set_section_address): Adjust code for
29 renaming of Output_section::add_input_section_for_script.
30 (Orphan_output_section::set_section_address): Same.
31
9b2fd367
DK
322010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
33
34 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
35 Fix_v4bx enum values .
36 * gold/options.h (General_options): New option definitions.
37 (General_options::fix_v4bx): New method.
38 (General_options::Fix_v4bx): New enum.
39 * gold/options.cc (General_options::parse_fix_v4bx): New method.
40 (General_options::parse_fix_v4bx_interworking): New method.
41
80d0d023
DK
422010-01-22 Doug Kwan <dougkwan@google.com>
43
44 * arm.cc (Arm_exidx_fixup): New class.
45
af2cdeae
DK
462010-01-21 Doug Kwan <dougkwan@google.com>
47
48 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
49 classes.
50 (Arm_exidx_section_offset_map): New type.
51
993d07c1
DK
522010-01-21 Doug Kwan <dougkwan@google.com>
53
54 * arm.cc (Arm_exidx_input_section): New class.
55 (Arm_relobj::exidx_input_section_by_link,
56 Arm_relobj::exidx_input_section_by_shndx,
57 Arm_relobj::make_exidx_input_section): New methods.
58 (read_arm_attributes_section): Remove.
59 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
60 information about them.
61 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
62 to here.
63
5ac169d4
DK
642010-01-20 Doug Kwan <dougkwan@google.com>
65
66 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
67 Input_section_specifier to Section_id.
68 (Target_arm::new_arm_input_section: Adjust code for change of key
69 type.
70 (Target_arm::find_arm_input_section): Ditto.
71 * gc.h (object.h): Include for Section_id nand Section_id_hash.
72 (Section_id): Remove.
73 (Garbage_collection::Section_id_hash): Remove.
74 * icf.h (object.h): Include for Section_id nand Section_id_hash.
75 (Section_id): Remove.
76 (Icf::Section_id_hash): Remove.
77 * object.h (Section_id, Const_section_id, Section_id_hash,
78 Const_section_id_hash): New type definitions.
79 * output.cc (Output_section::add_relaxed_input_section): Change to
80 use Const_section_id instead of Input_section_specifier as key type.
81 (Output_section::add_merge_input_section): Ditto.
82 (Output_section::build_relaxation_map): Change to use Section_id
83 instead of Input_section_specifier as key type.
84 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
85 Ditto.
86 (Output_section::convert_input_sections_to_relaxed_sections): Change
87 to use Const_section_id instead of Input_section_specifier as key type.
88 (Output_section::find_merge_section): Ditto.
89 (Output_section::find_relaxed_input_section): Ditto.
90 * output.h (Input_section_specifier): Remove class.
91 (Output_section::Output_section_data_by_input_section_map): Change
92 key type to Const_section_id.
93 (Output_section::Output_relaxed_input_section_by_input_section_map):
94 Ditto.
95 (Output_section::Relaxation_map): Change key type to Section_id.
96
a2162063
ILT
972010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
98
99 * gold/arm.cc: Added support for R_ARM_V4BX relocation
100 (class Arm_v4bx_stub): New class.
101 (DEF_STUBS): Updated definition to support v4_veneer_bx.
102 (Stub_factory::make_arm_v4bx_stub): New method.
103 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
104 (Stub_table::empty): Handle v4bx stubs.
105 (Stub_table::add_arm_v4bx_stub): New method.
106 (Stub_table::find_arm_v4bx_stub): New method.
107 (Arm_relocate_functions::v4bx): New method.
108 (Target_arm::fix_v4bx): New method.
109 (Target_arm::Target_arm): Handle R_ARM_V4BX.
110 (Stub_table::relocate_stubs): Likewise.
111 (Stub_table::do_write): Likewise.
112 (Stub_table::update_data_size_and_addralign): Likewise.
113 (Stub_table::finalize_stubs): Likewise.
114 (Target_arm::Scan::local): Likewise.
115 (Target_arm::Scan::global): Likewise.
116 (Target_arm::do_finalize_sections): Likewise.
117 (Target_arm::Relocate::relocate): Likewise.
118 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
119 Likewise.
120 (Target_arm::scan_reloc_for_stub): Likewise.
121 (Target_arm::scan_reloc_section_for_stubs): Likewise.
122
5696ab0b
ILT
1232010-01-19 Ian Lance Taylor <iant@google.com>
124
125 * output.cc (Output_section_headers::do_sized_write): Write large
126 segment count to sh_info field.
127 (Output_file_header::do_sized_write): For large segment count,
128 write PN_XNUM to e_phnum field.
129
800d0f56
ILT
1302010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
131
132 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
133 (Arm_relocate_functions::thm_jump8): New function.
134 (Arm_relocate_functions::thm_jump11): New function.
135 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
136 R_ARM_THM_JUMP11.
137 (Target_arm::Scan::global): Likewise.
138 (Target_arm::Relocate::relocate): Likewise.
139 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
140 Likewise.
141
41263c05
DK
1422010-01-14 Doug Kwan <dougkwan@google.com>
143
144 * arm.cc (map, utility): Include headers.
145 (Target_arm::apply_cortex_a8_workaround): New method.
146 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
147 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
148 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
149 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
150 the --[no-]fix-cortex-a8 command line options.
151 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
152 (Target_arm::relocate_stub): Use addend in instruction template.
153 * options.h (DEFINE_bool): Set the user-set flag.
154 (General_options): Add --[no-]-fix-cortex options.
155 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
156 : Update fast look-up map after conversion.
157
459e9b03
ST
1582010-01-14 Sriraman Tallam <tmsriram@google.com>
159
160 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
161 in the first pass of do_layout.
162
b521dfe4
DK
1632010-01-13 Doug Kwan <dougkwan@google.com>
164
165 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
166 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
167 apparent compiler problem of not folding static constant integral
168 data members of elfcpp::Elf_sizes<32>.
169
44272192
DK
1702010-01-13 Doug Kwan <dougkwan@google.com>
171
172 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
173 Arm_relobj::section_needs_cortex_a8_stub_scanning,
174 Arm_relobj::scan_section_for_cortex_a8_erratum,
175 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
176 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
177 sections to scan for relocation stubs into a new method
178 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
179 relocation and Cortex-A8 stub scanning.
180 (Target_arm::do_relax): Force stubs to be after stubbed sections
181 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
182 the beginning of a new relaxation pass. Update a comment.
183 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
184
44b71ece
ILT
1852010-01-12 Ian Lance Taylor <iant@google.com>
186
187 * target-reloc.h (visibility_error): New inline function.
188 (relocate_section): Call visibility_error.
189 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
190 (MOSTLYCLEANFILES): Likewise.
191 (protected_4_pic.o, protected_3.err): New targets.
192 * testsuite/protected_4.cc: New file.
193
a120bc7f
DK
1942010-01-12 Doug Kwan <dougkwan@google.com>
195
196 * arm.cc (Cortex_a8_reloc): New class.
197 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
198 and cortex_a8_relocs_info_.
199 (Target_arm::fix_cortex_a8): New method definition.
200 (Target_arm::Cortex_a8_relocs_info): New type.
201 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
202 New data member declarations.
203 (Target_arm::scan_reloc_for_stub): Record information about
204 relocations for THUMB branches that might be exempted from the
205 Cortex-A8 workaround.
206 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
207 at the beginning of a relaxation pass.
208
20138696
DK
2092010-01-12 Doug Kwan <dougkwan@google.com>
210
211 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
212 (Arm_relobj::Mapping_symbol_position,
213 Arm_reloj::Mapping_symbol_position_less,
214 Arm_relobj::Mapping_symbols_info): New types.
215 (Target_arm::is_mapping_symbol_name): New method definition.
216 (Arm_relobj::do_count_local_symbols): Save information about mapping
217 symbols.
218
089d69dc
DK
2192010-01-11 Doug Kwan <dougkwan@google.com>
220
221 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
222 Arm_relocate_functions::thumb32_branch_upper,
223 Arm_relocate_functions::thumb32_branch_lower,
224 Arm_relocate_functions::thumb32_cond_branch_offset,
225 Arm_relocate_functions::thumb32_cond_branch_upper,
226 Arm_relocate_functions::thumb32_cond_branch_lower,
227 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
228 branch offset encoding.
229 (Arm_relocate_functions::thumb_branch_common): Use new branch
230 offset encoding methods to avoid code duplication.
231 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
232 (Stub_addend_reader::operator()): Use new branch encoding method
233 to avoid code duplication.
234
99e5bff2
DK
2352010-01-11 Doug Kwan <dougkwan@google.com>
236
237 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
238 (Target_arm::do_finalize_sections): Define special EXIDX section
239 symbols only if referenced.
240 * gc.h (Garbage_collection::add_reference): New method.
241 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
242 code duplication.
243
98e090bd
ILT
2442010-01-11 Ian Lance Taylor <iant@google.com>
245
d0a91bd8
ILT
246 * script.cc (Version_script_info::build_expression_list_lookup):
247 Change complaing about duplicate wildcard match from error to
248 warning.
249
98e090bd
ILT
250 * script.cc (class Lazy_demangler): Recreate--revert part of patch
251 of 2009-12-30.
252 (Version_script_info::Version_script_info): Initialize globs_,
253 default_version_, default_is_global_, and exact_. Don't
254 initialize globals_ or locals_.
255 (Version_script_info::build_lookup_tables): Build local symbols
256 first.
257 (Version_script_info::unquote): New function.
258 (Version_script_info::add_exact_match): New function.
259 (Version_script_info::build_expression_list_lookup): Remove lookup
260 parameter. Add is_global parameter. Change all callers. Handle
261 wildcard pattern specially. Unquote pattern. Call
262 add_exact_match.
263 (Version_script_info::get_name_to_match): New function.
264 (Version_script_info::get_symbol_version): New function.
265 (Version_script_info::get_symbol_version_helper): Remove.
266 (Version_script_info::check_unmatched_names): Call unquote.
267 * script.h (class Version_script_info): Change get_symbol_version
268 to be non-inline and add is_global parameter; change all callers.
269 Rewrite symbol_is_local. Update declarations. Define struct
270 Version_tree_match, Exact, Globs. Don't define struct Lookup.
271 Remove globals_ and locals_ members. Add exact_, globs_,
272 default_version_, is_global_.
273 (Version_script_info::Glob): Remove pattern, add expression and
274 is_global. Update constructor. Change all callers.
275 * dynobj.cc (Versions::finalize): Mark the version symbol as the
276 default version.
277 (Versions::symbol_section_contents): If a symbol is undefined, or
278 defined in a dynamic object, set the version index to
279 VER_NDX_LOCAL.
280 * symtab.cc (Symbol_table::add_from_relobj): Don't call
281 symbol_is_local.
282 (Symbol_table::add_from_pluginobj): Likewise.
283 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
284
d56962d3
DK
2852010-01-11 Doug Kwan <dougkwan@google.com>
286
287 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
288 (incremental_dump_LDADD): Add linking option for libintl.
289 * Makefile.in: Regenerate.
290
94e6ee91
L
2912010-01-11 H.J. Lu <hongjiu.lu@intel.com>
292
293 PR gold/11144
294 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
295 instead of -Ds.
296 * testsuite/Makefile.in: Regenerated.
297
e96c574b
DK
2982010-01-10 Doug Kwan <dougkwan@google.com>
299
300 * options.h (DEFINE_var): Use parentheses around argument varname__
301 in macro body to avoid any unintended subsequent substitutions.
302
7198066b
ILT
3032010-01-10 Ian Lance Taylor <iant@google.com>
304
ba4d53bf
ILT
305 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
306 candidates before doing symbol resolution.
307
7198066b
ILT
308 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
309 ODR candidates if only one is weak.
310
a2beed37
ILT
3112010-01-08 Ian Lance Taylor <iant@google.com>
312
313 * script.cc (Version_script_info::build_expression_list_lookup):
314 Don't warn about ambiguous version, just record the ambiguity.
315 (Version_script_info::get_symbol_version_helper): Give error if
316 version is ambiguous.
317
2fb7225c
DK
3182010-01-08 Doug Kwan <dougkwan@google.com>
319
320 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
321 prev_data_size_ and prev_addralign_. Remove initializer for
322 deleted data member has_been_changed_.
323 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
324 to determine if the table is empty.
325 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
326 Remove.
327 (Stub_table::add_reloc_stub): Define method in class definition
328 instead of just declaring it there.
329 (Stub_table::add_cortex_a8_stub): New method definition.
330 (Stub_table::update_data_size_and_addralign): Ditto.
331 (Stub_table::finalize_stubs): Ditto.
332 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
333 (Stub_table::do_addralign_): Return address alignment in the
334 (Stub_table::do_reset_address_and_file_offset): Define method in
335 class definition instead of declaring it there. Set current data
336 size to be the data size of the previous pass.
337 (Stub_table::set_final_data_size): Use current data size as the
338 final data size.
339 (Stub_table::relocate_stub): Change parameter type of stub from
340 Reloc_stub pointer to Stub pointer.
341 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
342 (Stub_table::Cortex_a8_stub_list): New typedef.
343 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
344 Stub_table::prev_addralign_): New data member.
345 (Arm_relobj::Arm_relobj): Initialize data member
346 section_has_cortex_a8_workaround_.
347 (Arm_relobj::section_has_cortex_a8_workaround,
348 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
349 definitions.
350 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
351 declarations.
352 (Target_arm::relocate_stub): Change parameter type of stub from
353 Reloc_stub pointer to Stub pointer.
354 (Insn_template::size, Insn_template::alignment): Handle
355 THUMB16_SPECIAL_TYPE.
356 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
357 Stub_table::update_data_size_and_addralign,
358 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
359 definitions.
360 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
361 (Stub_table::do_write): Ditto.
362 (Target_arm::do_relax): Adjust code for changes in Stub_table.
363
880cd20d
ILT
3642010-01-08 Ian Lance Taylor <iant@google.com>
365
366 PR 11108
367 * symtab.h (class Symbol): Remove fields is_target_special_ and
368 has_plt_offset_. Add field is_defined_in_discarded_section_.
369 (Symbol::is_defined_in_discarded_section): New function.
370 (Symbol::set_is_defined_in_discarded_section): New function.
371 (Symbol::has_plt_offset): Rewrite.
372 (Symbol::set_plt_offset): Verify that new offset is not -1U.
373 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
374 Don't initialize is_target_special_ or has_plt_offset_.
375 Initialize is_defined_in_discarded_section_.
376 (Symbol_table::add_from_relobj): If appropriate, set
377 is_defined_in_discarded_section.
378 * resolve.cc (Symbol::override_base_with_special): Don't test
379 is_target_special_. Change has_plt_offset_ to has_plt_offset().
380 * target-reloc.h (relocate_section): Do special handling for
381 symbols defined in discarded sections for global symbols as well
382 as local symbols.
383
2703e3eb
ILT
3842010-01-08 Ian Lance Taylor <iant@google.com>
385
386 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
387 the SHT_SYMTAB case.
388
339d40a3
ILT
3892010-01-08 Ian Lance Taylor <iant@google.com>
390
391 * object.cc (Sized_relobj::do_layout): Don't get confused if
392 layout_eh_frame returns NULL.
393
abecea76
ILT
3942010-01-08 Ian Lance Taylor <iant@google.com>
395
396 PR 11084
397 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
398 dynamic symbol table, use the normal symbol table.
399 (Sized_dynobj::do_read_symbols): Remove assertion about type of
400 symbol table.
401
6b7dd3f3
ILT
4022010-01-08 Ian Lance Taylor <iant@google.com>
403
404 PR 11072
405 * layout.cc (Layout::include_section): Remove .gnu_debuglink
406 sections.
407
36c50e63
L
4082010-01-08 H.J. Lu <hongjiu.lu@intel.com>
409
410 * version.cc (print_version): Change to "Copyright 2010".
411
e291e7b9
ILT
4122010-01-08 Ian Lance Taylor <iant@google.com>
413
414 PR 10287
415 PR 11063
416 * i386.cc (class Target_i386): Change return type of plt_section
417 to be non-const.
418 (class Output_data_plt_i386): Add tls_desc_rel_ field.
419 (Output_data_plt_i386::Output_data_plt_i386): Initialize
420 tls_desc_rel_ field.
421 (Output_data_plt_i386::rel_tls_desc): New function.
422 (Target_i386::rel_tls_desc_section): New function.
423 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
424 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
425 R_386_TLS_DESC reloc in rel_tls_desc_section.
426 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
427 Define struct Tlsdesc_info.
428 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
429 (Target_x86_64::do_reloc_symbol_index): New function.
430 (Target_x86_64::add_tlsdesc_info): New function.
431 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
432 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
433 tlsdesc_rel_ field.
434 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
435 all callers.
436 (Output_data_plt_x86_64::rela_tlsdesc): New function.
437 (Target_x86_64::rela_tlsdesc_section): New function.
438 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
439 handling.
440 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
441 (Target_x86_64::do_reloc_addend): New function.
442 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
443 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
444 declarations. Define TARGET_CODE. Add arg field to u1_ union.
445 (Output_reloc::type): New function.
446 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
447 (Output_reloc::is_target_specific): New function.
448 (Output_reloc::target_arg): New function.
449 (class Output_reloc) [SHT_RELA]: Add four new constructors for
450 absolute relocs and target specific relocs.
451 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
452 add_target_specific.
453 (class Output_data_reloc) [SHT_RELA]: Likewise.
454 * output.cc (Output_reloc::Output_reloc): Add four new versions
455 for absolute relocs and target specific relocs.
456 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
457 (Output_reloc::get_symbol_index): Likewise.
458 (Output_reloc::local_section_offset): Check that local_sym_index_
459 is not TARGET_CODE or 0.
460 (Output_reloc::symbol_value): Likewise.
461 (Output_reloc::write) [SHT_RELA]: Call target for target specific
462 reloc.
463 * target.h (class Target): Add reloc_symbol_index and reloc_addend
464 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
465 functions.
466 * layout.cc (add_target_dynamic_tags): Use output section for
467 DT_PLTRELSZ and DT_JMPREL.
468
3a44184e
ILT
4692010-01-07 Ian Lance Taylor <iant@google.com>
470
471 PR 11061
472 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
473 function.
474 (class Output_data_reloc_generic): Define.
475 (class Output_data_reloc_base): Change base class to
476 Output_data_reloc_generic. Change add() method to call
477 bump_relative_reloc_count for a relative reloc. Remove
478 sort_relocs_ field.
479 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
480 to sort_relocs().
481 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
482 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
483 appropriate.
484 * layout.h (class Layout): Update declaration.
485
ea715a34
ILT
4862010-01-07 Ian Lance Taylor <iant@google.com>
487
488 * output.h (class Output_data): Add const version of
489 output_section and do_output_section.
490 (class Output_section_data): Add const version of
491 do_output_section.
492 (class Output_section): Likewise.
493 * layout.cc (Layout::add_target_dynamic_tags): New function.
494 * layout.h (class Layout): Update declarations.
495 * arm.cc (Target_arm::do_finalize_sections): Use
496 add_target_dynamic_tags.
497 * i386.cc (Target_i386::do_finalize_sections): Likewise.
498 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
499 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
500 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
501
659948a4
ILT
5022010-01-07 Ian Lance Taylor <iant@google.com>
503
504 PR 11042
505 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
506 object as needed.
507
9d3b86f6
ILT
5082010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
509 Ian Lance Taylor <iant@google.com>
510
511 PR 11019
512 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
513 Xindex::read_symtab_xindex.
514
bb0d3eb0
DK
5152010-01-07 Doug Kwan <dougkwan@google.com>
516
517 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
518 (Insn_template::thumb16_bcond_insn): New method declaration.
519 (Insn_template): Fix spelling.
520 (Stub::thumb16_special): New method declaration.
521 (Stub::do_write): Define virtual method which was previously pure
522 virtual.
523 (Stub::do_thumb16_special): New method declaration.
524 (Stub::do_fixed_endian_write): New template member.
525 (Reloc_stub::do_write): Remove.
526 (Reloc_stub::do_fixed_endian_write): Remove.
527 (Cortex_a8_stub): New class definition.
528 (Stub_factory::make_cortex_a8_stub): New method definition.
529 (Stub_factory::Stub_factory): Add missing static storage class
530 qualifier for elf32_arm_stub_a8_veneer_blx.
531
ffeef7df
ILT
5322010-01-07 Ian Lance Taylor <iant@google.com>
533
dc3f80fe
ILT
534 PR 10980
535 * options.h (class General_options): Add --warn-unresolved-symbols
536 and --error-unresolved-symbols.
537 * errors.cc (Errors::undefined_symbol): Implement
538 --warn-unresolved-symbols.
539
ffeef7df
ILT
540 * options.h (class General_options): Add -z text and -z textoff.
541 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
542
f1ec9ded
ST
5432010-01-06 Sriraman Tallam <tmsriram@google.com>
544
545 * gc.h (Garbage_collection::Cident_section_map): New typedef.
546 (Garbage_collection::cident_sections): New function.
547 (Garbage_collection::add_cident_section): New function.
548 (Garbage_collection::cident_sections_): New member.
549 (gc_process_relocs): Add references to sections whose names are C
550 identifiers.
551 * gold.h (cident_section_start_prefix): New constant.
552 (cident_section_stop_prefix): New constant.
553 (is_cident): New function.
554 * layout.cc (Layout::define_section_symbols): Replace string constants
555 with the newly defined constants.
556 * object.cc (Sized_relobj::do_layout): Track sections whose names are
557 C identifiers.
558 * testsuite/Makefile.am: Add gc_orphan_section_test.
559 * testsuite/Makefile.in: Regenerate.
560 * testsuite/gc_orphan_section_test.cc: New file.
561 * testsuite/gc_orphan_section_test.sh: New file.
562
6eda8c29
ILT
5632010-01-06 Ian Lance Taylor <iant@google.com>
564
b9674e17
ILT
565 PR 10980
566 * options.h (class General_options): Add --warn-shared-textrel.
567 * layout.cc (Layout::finish_dynamic_section): Implement
568 --warn-shared-textrel.
569
6eda8c29
ILT
570 PR 10980
571 * options.h (class General_options): Add --warn-multiple-gp.
572
32dcd44e
ILT
5732010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
574
575 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
576 $(THREADSLIB) and $(LIBDL).
577 * Makefile.in: Rebuild.
578
a192ba05
ILT
5792010-01-06 Ian Lance Taylor <iant@google.com>
580
581 PR 10980
582 * options.cc (General_options::parse_section_start): New function.
583 (General_options::section_start): New function.
584 (General_options::General_options): Initialize all members.
585 * options.h: Include <map>
586 (class General_options): Add --section-start. Add section_starts_
587 member.
588 * layout.cc (Layout::attach_allocated_section_to_segment): If
589 --section-start was used, set the address of the segment. Remove
590 local sort_sections.
591 (Layout::relaxation_loop_body): If the address of the load segment
592 has been set by --section-start, don't use it.
593 * output.h (Output_segment::update_flags_for_output_section): New
594 function.
595 * output.cc (Output_segment::add_output_section): Call
596 update_flags_for_output_section.
597
dde3f402
ILT
5982010-01-05 Ian Lance Taylor <iant@google.com>
599
62dfdd4d
ILT
600 PR 10980
601 * options.h (class General_options): Add --undefined-version.
602 * script.cc (struct Version_expression): Add was_matched_by_symbol
603 field.
604 (Version_script_info::matched_symbol): New function.
605 (Version_script_info::get_symbol_version_helper): Call
606 matched_symbol.
607 (Version_script_info::check_unmatched_names): New function.
608 * script.h (class Version_script_info): Update declarations.
609 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
610
9c4ae156
ILT
611 * options.h (class General_options): Use DEFINE_bool_alias for
612 allow_multiple_definition.
613 * resolve.cc (Symbol_table::should_override): Don't test
614 allow_multiple_definition.
615
dde3f402
ILT
616 PR 10980
617 * options.h (class General_options): Add --cref.
618 * main.cc (main): Print cref table if --cref. Don't close mapfile
619 until after printing cref table.
620 * cref.cc: Include "symtab.h".
621 (class Cref_inputs): Define Cref_table_compare and Cref_table.
622 (Cref_table_compare::operator()): New function.
623 (Cref_inputs::gather_cref): New function.
624 (filecol): New static const.
625 (Cref_inputs::print_cref): New function.
626 (Cref::print_cref): New function.
627 * cref.h: Include <cstdio>.
628 (class Cref): Update declarations.
629 * mapfile.h (Mapfile::file): New function.
630 * object.h (class Object): Define Symbols. Declare virtual
631 do_get_global_symbols.
632 (Object::get_global_symbols): New function.
633 * object.cc (Input_objects::add_object): Pass object to cref_ if
634 --cref.
635 (Input_objects::archive_start): Likewise.
636 (Input_objects::archive_stop): Likewise.
637 (Input_objects::print_cref): New function.
638 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
639 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
640 --cref.
641 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
642 function.
643 * plugin.h (class Sized_pluginobj): Update declarations.
644
8781f709
ILT
6452010-01-05 Ian Lance Taylor <iant@google.com>
646
647 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
648 to is_default_version. Rename insdef to insdefault.
649 (Symbol_table::add_from_relobj): Rename def to is_default_version
650 and local to is_forced_local.
651 (Symbol_table::add_from_pluginobj): Likewise.
652 (Symbol_table::add_from_dynobj): Likewise.
653 (Symbol_table::define_special_symbol): Rename insdef to
654 insdefault.
655
fe35d28d
ILT
6562010-01-04 Ian Lance Taylor <iant@google.com>
657
30bc8c46
ILT
658 PR 10980
659 * options.h (class General_options): Add
660 --allow-multiple-definition and -z muldefs.
661 * resolve.cc (Symbol_table::should_override): Don't warn about a
662 multiple symbol definition if --allow-multiple-definition or -z
663 muldefs.
664
7eaea549
ILT
665 PR 10980
666 * options.h (class General_options): Add --add-needed and
667 --copy-dt-needed-entries. Tweak --as-needed help entry.
668 * object.cc (Input_objects::check_dynamic_dependencies): Give an
669 error if --copy-dt-needed-entries aka --add-needed is used and
670 would cause a change in behaviour.
671
fe35d28d
ILT
672 PR 10980
673 * options.h (class General_options): Add -G as a short version of
674 --shared. Add no-op options -assert, -g, and -i.
675
55a2bb35
ST
6762010-01-04 Sriraman Tallam <tmsriram@google.com>
677
678 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
679 check for .text or .gnu.linkonce.t sections.
680 * icf.cc (Icf::find_identical_sections): Ditto.
681 Change the detection for mangled function name within the section
682 name.
683 * icf.h (is_section_foldable_candidate): New function.
684
719328e1
ILT
6852009-12-30 Ian Lance Taylor <iant@google.com>
686
687 PR 10980
688 * options.h (class General_options): Permit two dashes with
689 --retain-symbols-file.
690
d7bb5745
ILT
6912009-12-30 Ian Lance Taylor <iant@google.com>
692
403a15dd
ILT
693 PR 10979
694 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
695 don't put the file header and segment headers in the text
696 segment.
697
eda294df
ILT
698 PR 10979
699 * common.cc (Sort_commons::operator()): Stabilize sort when both
700 entries are NULL.
701 (Symbol_table::do_allocate_commons_list): When allocating common
702 symbols, skip a symbol which is no longer common.
703 * symtab.h (Symbol::is_common): Test whether the symbol comes from
704 an object before checking its type.
705 * testsuite/common_test_2.c: New file.
706 * testsuite/common_test_3.c: New file.
707 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
708 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
709 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
710 (common_test_2_pic.o, common_test_2.so): New targets.
711 (common_test_3_pic.o, common_test_3.so): New targets.
712 * testsuite/Makefile.in: Rebuild.
713
d7bb5745
ILT
714 PR 10979
715 * script.cc (read_input_script): If we see a new SECTIONS clause,
716 and we have added an input section, give an error.
717 * layout.h (class Layout): Add have_added_input_section function.
718 Add have_added_input_section_ field.
719 * layout.cc (Layout::Layout): Initialize
720 have_added_input_section_.
721 (Layout::layout): Set have_added_input_section_.
722 (Layout::layout_eh_frame): Likewise.
723
fc59c572
ILT
7242009-12-30 Ian Lance Taylor <iant@google.com>
725
726 PR 10931
727 * options.h (class General_options): Add --sort-common option.
728 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
729 * common.cc (Sort_common): Add sort_order parameter to
730 constructor. Add sort_order_ field.
731 (Sort_commons::operator): Check sort_order_.
732 (Symbol_table::allocate_commons): Determine the sort order.
733 (Symbol_table::do_allocate_commons): Add sort_order parameter.
734 Change all callers.
735 (Symbol_table::do_allocate_commons_list): Likewise.
736
1c74fab0
ILT
7372009-12-30 Ian Lance Taylor <iant@google.com>
738
739 PR 10916
740 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
741 symbols from this object, don't change the visibility of an
742 undefined symbol.
743 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
744
6affe781
ILT
7452009-12-30 Ian Lance Taylor <iant@google.com>
746
747 PR 10861
748 * script.h (class Version_script_info): Define Language enum.
749 Update declarations. Define Glob, Exact, and Lookup types. Add
750 new fields globals_, locals_, and is_finalized_.
751 * script.cc: Various formatting fixes.
752 (class Parser_closure): Change language_stack_ from a vector of
753 std::string to one of Version_script_info::Language. Adjust all
754 uses accordingly.
755 (class Lazy_demangler): Remove.
756 (struct Version_expression): Change language from std::string to
757 Version_script_info::Language.
758 (Version_script_info::Version_script_info): New function.
759 (Version_script_info::~Version_script_info): Don't call clear.
760 (Version_script_info::finalize): New function.
761 (Version_script_info::build_lookup_tables): New function.
762 (Version_script_info::build_expression_list_lookup): New
763 function.
764 (Version_script_info::get_symbol_version_helper): Rewrite to use
765 lookup tables.
766 (Version_script_info::print_expression_list): Adjust to use
767 Version_script_info::Language.
768 (script_push_lex_into_version_mode): Check that the version script
769 has not been finalized.
770 (version_script_push_lang): Change language string to
771 Version_script_info::Language.
772 * options.cc (Command_line::version_script): New function.
773 * options.h (class General_options): Add finalize_dynamic_list
774 function. Change version_script from declaration to definition.
775 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
776 * testsuite/version_script.map: Remove duplicate def of foo.
777 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
778 version_script.map.
779 * testsuite/Makefile.in: Rebuild.
780
818bf354
ILT
7812009-12-30 Ian Lance Taylor <iant@google.com>
782
783 PR 10843
784 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
785 if the input symbol index is 0, make the output symbol index 0.
786
ebcc8304
ILT
7872009-12-30 Ian Lance Taylor <iant@google.com>
788
789 PR 10670
790 * options.h (class General_options): Add -x/--discard-all.
791 * object.cc (Sized_relobj::do_count_local_symbols): Handle
792 --discard-all. If the local symbol needs a dynamic entry, check
793 that before handling --discard-locals.
794
176fe33f
ILT
7952009-12-30 Ian Lance Taylor <iant@google.com>
796
bb321bb1
ILT
797 PR 10450
798 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
799 flags to PF_R.
800 (Output_segment::add_output_section): Don't change the flags if
801 the type is PT_TLS.
802
176fe33f
ILT
803 PR 10450
804 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
805 GNU hash table if they need a dynamic value. Otherwise, don't add
806 them if they are defined in a dynamic object or are forced local.
807
e8cd95c7
ILT
8082009-12-29 Ian Lance Taylor <iant@google.com>
809
1b81fb71
ILT
810 PR 10450
811 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
812 .gnu.hash table for a 32-bit target.
813
8d6d383d
ILT
814 PR 10450
815 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
816 regular and a dynamic object only needs a dynamic symbol table
817 entry if it is externally visible.
818
e785ec03
ILT
819 PR 10450
820 * i386.cc (class Target_i386): Initialize global_offset_table_ in
821 constructor. Add global_offset_table_ field.
822 (Target_i386::got_section): Set global_offset_table_.
823 (Target_i386::do_finalize_sections): Set global_offset_table_
824 size.
825 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
826 in constructor. Add global_offset_table_ field.
827 (Target_x86_64::got_section): Set global_offset_table_.
828 (Target_x86_64::do_finalize_sections): Set global_offset_table_
829 size.
830
1a2dff53
ILT
831 * layout.cc (Layout::Layout): Initialize increase_relro_.
832 (Layout::get_output_section): Add is_relro, is_last_relro, and
833 is_first_non_relro parameters. Change all callers.
834 (Layout::choose_output_section): Likewise.
835 (Layout::add_output_section_data): Likewise.
836 (Layout::make_output_section): Likewise.
837 (Layout::set_segment_offsets): Clear increase_relro when using a
838 linker script.
839 * layout.h (class Layout): Add increase_relro method. Add
840 increase_relro_ field. Update declarations.
841 * output.cc (Output_section::Output_section): Initialize
842 is_last_relro_ and is_first_non_relro_.
843 (Output_segment::add_output_section): Group relro sections is
844 do_sort is true. Handle is_last_relro and is_first_non_relro.
845 (Output_segment::maximum_alignment): Remove relro handling.
846 (Output_segment::set_section_addresses): Add increase_relro
847 parameter. Change all callers. Add initial alignment to align
848 relro sections on separate page. Remove old relro handling.
849 (Output_segment::set_section_list_addresses): Remove in_relro
850 parameter. Change all callers.
851 (Output_segment::set_offset): Add increase parameter. Change all
852 callers. Remove old relro handling.
853 * output.h (class Output_section): Add new methods: is_last_relro,
854 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
855 Add is_last_relro_ and is_first_non_relro_ fields.
856 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
857 Create separate .got.plt section. Call increase_relro.
858 * x86_64.cc (Target_x86_64::got_section): Likewise.
859 * testsuite/relro_script_test.t: Add .got.plt.
860
f0ba79e2
ILT
861 PR 10450
862 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
863 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
864 (Layout::finalize): Call set_dynamic_symbol_size.
865 (Layout::set_dynamic_symbol_size): New function.
866 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
867 set_dynamic_symbol_size.
868
e8cd95c7
ILT
869 PR 10450
870 * output.h (class Output_section): Add is_entsize_zero_ field.
871 * output.cc (Output_section::Output_section): Initialize
872 is_entsize_zero_.
873 (Output_section::set_entsize): If two different entsizes are
874 requested, force it to zero.
875 (Output_section::add_input_section): Set flags for .debug_str
876 before updating section flags. Set entsize.
877 (Output_section::update_flags_for_input_section): Set SHF_MERGE
878 and SHF_STRING if all input sections have those flags.
879
3e1b9a8a
RÁE
8802009-12-29 Rafael Espindola <espindola@google.com>
881
882 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
883 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
884 reporting.
3e1b9a8a 885
3dcad376
ST
8862009-12-29 Sriraman Tallam <tmsriram@google.com>
887
888 * options.cc (General_options::parse_version): Allow -v to exit
889 without an error if there is nothing to link.
890
084e2665
ILT
8912009-12-29 Ian Lance Taylor <iant@google.com>
892
893 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
894 using a version of gcc before 4.1.
895 * configure: Rebuild.
896
250acde3
CD
8972009-12-28 Chris Demetriou <cgd@google.com>
898
899 * attributes.cc (Output_attributes_section_data::do_write): Use
900 std::vector::front rather than std::vector::data.
901
99fff23b
ILT
9022009-12-28 Ian Lance Taylor <iant@google.com>
903
904 * symtab.h (class Symbol_table): Add enum Defined.
905 * resolve.cc (Symbol_table::should_override): Add defined
906 parameter. Change all callers. Test whether object is NULL
907 before calling a method on it.
908 (Symbol_table::report_resolve_problem): Add defined parameter.
909 Change all callers.
910 (Symbol_table::should_override_with_special): Likewise.
911 * symtab.cc (Symbol_table::define_in_output_data): Add defined
912 parameter. Change all callers.
913 (Symbol_table::do_define_in_output_data): Likewise.
914 (Symbol_table::define_in_output_segment): Likewise.
915 (Symbol_table::do_define_in_output_segment): Likewise.
916 (Symbol_table::define_as_constant): Likewise.
917 (Symbol_table::do_define_as_constant): Likewise.
918 * script.h (class Symbol_assignment): Add is_defsym parameter to
919 constructor; change all callers.
920 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
921 parameter. Change all callers. Add is_defsym_ field.
922 (class Parser_closure): Add parsing_defsym parameter to
923 constructor; change all callers. Add parsing_defsym accessor
924 function. Add parsing_defsym_ field.
925
556bd683
ILT
9262009-12-28 Ian Lance Taylor <iant@google.com>
927
928 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 929 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 930
1782c879
ILT
9312009-12-23 Ian Lance Taylor <iant@google.com>
932
933 * i386.cc (Target_i386::do_calls_non_split): Recognize
934 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
935 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
936 -fsplit-stack prologue when using %r11.
1782c879 937
329ca2b1
ST
9382009-12-21 Sriraman Tallam <tmsriram@google.com>
939
940 * options.cc (General_options::parse_version): Make -v continue and do
941 the link like GNU ld does.
942
d675ff46
RÁE
9432009-12-17 Rafael Avila de Espindola <espindola@google.com>
944
945 * Makefile.am (CCFILES): Add timer.cc.
946 (HFILES): Add timer.h.
947 * configure.ac: Check for sysconf and times.
948 * main.cc: include timer.h.
949 (main): Use Timer instead of get_run_time.
950 * timer.cc: New.
951 * timer.h: New.
952 * workqueue.cc: include timer.h.
953 (Workqueue::find_and_run_task):
954 Report user, sys and wall time.
955 * Makefile.in: Regenerate.
956 * config.in: Regenerate.
957 * configure: Regenerate.
958
d6344fb5
DK
9592009-12-16 Doug Kwan <dougkwan@google.com>
960
961 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
962 sections.
963 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
964 relaxed input sections.
965 * output.cc (Output_section::find_relaxed_input_section): Change
966 return type to Output_relaxed_input_section pointer. Adjust code
967 for new type of relaxed_input_section_map_.
968 * output.h (Output_section::find_relaxed_input_section): Change
969 return type to Output_relaxed_input_section pointer.
970 (Output_section::Output_relaxed_input_section_by_input_section_map):
971 New type.
972 (Output_section::relaxed_input_section_map_): Change type to
973 Output_section::Output_relaxed_input_section_by_input_section_map.
974 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
975 input section.
976
0e0d5469
ILT
9772009-12-15 Ian Lance Taylor <iant@google.com>
978
979 * layout.cc (Layout::create_shstrtab): Only write out after input
980 sections if we are compressing debug sections.
981
0649a889
ILT
9822009-12-15 Ian Lance Taylor <iant@google.com>
983
984 * archive.cc (Archive::add_symbols): Only look up a symbol without
985 a version if there is, in fact, a version.
986
2ea97941
ILT
9872009-12-14 Ian Lance Taylor <iant@google.com>
988
989 Revert -Wshadow changes, all changes from:
990 2009-12-11 Doug Kwan <dougkwan@google.com>
991 2009-12-11 Nick Clifton <nickc@redhat.com>
992 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
993
b0eec2cc
DK
9942009-12-11 Doug Kwan <dougkwan@google.com>
995
996 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
997 due to -Wshadow.
998 * attributes.cc (Object_attribute::size): Ditto.
999 (Attributes_section_data::size): Ditto.
1000 (Attributes_section_data::Attributes_section_data): Ditto.
1001 (Output_attributes_section_data::do_write): Ditto.
1002 * attributes.h (Object_attribute::set_type): Ditto.
1003 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1004
91d6fa6a
NC
10052009-12-11 Nick Clifton <nickc@redhat.com>
1006
1007 * archive.cc: Fix shadowed variable warnings.
1008 * arm.cc: Likewise.
1009 * compressed_output.cc: Likewise.
1010 * compressed_output.h: Likewise.
1011 * configure: Likewise.
1012 * dwarf_reader.cc: Likewise.
1013 * dynobj.cc: Likewise.
1014 * dynobj.h: Likewise.
1015 * ehframe.cc: Likewise.
1016 * ehframe.h: Likewise.
1017 * errors.cc: Likewise.
1018 * expression.cc: Likewise.
1019 * fileread.cc: Likewise.
1020 * fileread.h: Likewise.
1021 * freebsd.h: Likewise.
1022 * i386.cc: Likewise.
1023 * icf.cc: Likewise.
1024 * incremental.h: Likewise.
1025 * layout.cc: Likewise.
1026 * layout.h: Likewise.
1027 * mapfile.cc: Likewise.
1028 * merge.cc: Likewise.
1029 * merge.h: Likewise.
1030 * object.cc: Likewise.
1031 * object.h: Likewise.
1032 * options.h: Likewise.
1033 * output.cc: Likewise.
1034 * output.h: Likewise.
1035 * parameters.cc: Likewise.
1036 * plugin.cc: Likewise.
1037 * powerpc.cc: Likewise.
1038 * reduced_debug_output.cc: Likewise.
1039 * reduced_debug_output.h: Likewise.
1040 * reloc.cc: Likewise.
1041 * reloc.h: Likewise.
1042 * resolve.cc: Likewise.
1043 * script-sections.cc: Likewise.
1044 * script.cc: Likewise.
1045 * script.h: Likewise.
1046 * sparc.cc: Likewise.
1047 * symtab.cc: Likewise.
1048 * symtab.h: Likewise.
1049 * target-select.cc: Likewise.
1050 * target-select.h: Likewise.
1051 * token.h: Likewise.
1052 * workqueue.cc: Likewise.
1053 * workqueue.h: Likewise.
1054 * x86_64.cc: Likewise.
1055
a0351a69
DK
10562009-12-10 Doug Kwan <dougkwan@google.com>
1057
1058 * arm.cc (attributes.h): New include.
1059 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1060 (Arm_relobj::~Arm_relobj): Delete object pointed by
1061 attributes_section_data_.
1062 (Arm_relobj::attributes_section_data): New method definition.
1063 (Arm_relobj::attributes_section_data_): New data member declaration.
1064 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1065 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1066 attributes_section_data_.
1067 (Arm_dynobj::attributes_section_data): New method definition.
1068 (Arm_dynobj::attributes_section_data_): New data member declaration.
1069 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
1070 initialization value of may_use_blx_ to false.
1071 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1072 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1073 object attributes to compute results instead of hard-coding.
1074 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1075 Target_arm::get_secondary_compatible_arch,
1076 Target_arm::set_secondary_compatible_arch
1077 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1078 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1079 New method declarations.
1080 (Target_arm::get_aeabi_object_attribute): New method definition.
1081 (Target_arm::attributes_section_data_): New data member declaration.
1082 (read_arm_attributes_section): New template definition.
1083 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1084 (Arm_dynobj::do_read_symbols): Ditto.
1085 (Target_arm::do_finalize_sections): Merge attributes sections from
1086 input. Check for BLX use after attributes section merging.
1087 Fix __exidx_start and __exidx_end visibility. Create an
1088 .ARM.attributes section if necessary.
1089 (Target_arm::get_secondary_compatible_arch,
1090 Target_arm::set_secondary_compatible_arch,
1091 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1092 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1093 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
1094 New method definitions.
1095
b59befec
ILT
10962009-12-09 Ian Lance Taylor <iant@google.com>
1097
1098 * plugin.cc (Plugin::load): Don't cast from void* to a function
1099 pointer.
1100
1276bc89
ILT
11012009-12-09 Ian Lance Taylor <iant@google.com>
1102
1103 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1104 information fields.
1105
2f2de248
L
11062009-12-09 H.J. Lu <hongjiu.lu@intel.com>
1107
1108 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1109 Replace two_file_shared_1.so with two_file_shared_2.so.
1110 * testsuite/Makefile.in: Regenerated.
1111
4f787271
DK
11122009-12-08 Doug Kwan <dougkwan@google.com>
1113
1114 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1115 (HFILES): Add attributes.h and int_encoding.h.
1116 * Makefile.in: Regenerate.
1117 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1118 function definitions to int_encoding.cc
1119 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1120 prototypes to int_encoding.h
1121 * reduced_debug_output.cc (int_encoding.h): New include.
1122 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1123 function definitions to int_encoding.cc
1124 (insert_into_vector, read_from_pointer): Move template definitions to
1125 int_encoding.h
1126 * attributes.cc: New file.
1127 * attributes.h: New file.
1128 * int_encoding.cc: New file.
1129 * int_encoding.h: New file.
1130
20b52f1a
RÁE
11312009-12-07 Rafael Avila de Espindola <espindola@google.com>
1132
1133 PR gold/11055
1134 * incremental-dump.cc (dump_incremental_inputs): New.
1135 (main): Use dump_incremental_inputs.
1136
53d7974c
L
11372009-12-07 H.J. Lu <hongjiu.lu@intel.com>
1138
1139 PR gold/10893
1140 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1141 checking elfcpp::STT_FUNC.
1142 (Target_i386::Relocate::relocate): Likewise.
1143 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1144
1145 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1146 symbols from shared libraries into normal FUNC symbols.
1147
1148 * symtab.h (Symbol): Add is_func and use it.
1149
05a352e6
DK
11502009-12-05 Doug Kwan <dougkwan@google.com>
1151
1152 * arm.cc (Target_arm::arm_info): Initialize new fields
1153 attributes_section and attributes_vendor.
1154 * i386.cc (Target_i386::i386_info): Same.
1155 * object.cc (Sized_relobj::do_layout): Skip attribute section.
1156 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1157 fields attributes_section and attributes_vendor.
53d7974c 1158 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
1159 * target.h (Target::attributes_section, Target::attributes_vendor,
1160 Target::is_attributes_section, Target::attribute_arg_type,
1161 Target::attributes_order): New method definitions.
1162 (Target::Target_info::attributes_section,
1163 Target::Target_info::attributes_vendor): New fields.
1164 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1165 virtual method definitions.
1166 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1167 attributes_section and attributes_vendor.
1168 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1169
f4e5969c
DK
11702009-12-05 Doug Kwan <dougkwan@google.com>
1171
1172 * arm.cc: Update comments about interworking and stub generation.
1173 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1174 considered as non-PIC.
1175 (Arm_relocate_functions::base_abs): Fix formatting.
1176 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1177 of function to use GOT entry address instead of offset.
1178 (Target_arm::Scan::global): Issue an error if a symbol would need a
1179 PLT does not get one because it is untyped. Remove code to create
1180 dynamic symbols for relative branches.
1181 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1182 takes unsigned integer instead of boolean.
1183
1abce4a6
L
11842009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1185
1186 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1187 (two_file_test_LDADD): Likewise.
1188 (common_test_1_LDADD): Likewise.
1189 (exception_test_LDADD) Likewise.
1190 (weak_test_LDADD): Likewise.
1191 (many_sections_test_LDADD): Likewise.
1192 (initpri1_LDADD): Likewise.
1193 (script_test_1_LDADD): Likewise.
1194 (script_test_2_LDADD): Likewise.
1195 (justsyms_LDADD): Likewise.
1196 (binary_test_LDADD): Likewise.
1197 (large_LDADD): Likewise.
1198 * testsuite/Makefile.in: Regenerated.
1199
adcf2816 12002009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 1201
adcf2816
L
1202 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1203 (Symbol_table::override_with_special): Likewise.
1204 (Symbol_table::add_from_object): Likewise.
1205
28e67f5d
RÁE
12062009-12-04 Rafael Avila de Espindola <espindola@google.com>
1207
1208 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1209 Don't set the data_offset twice.
1210
ae10a101
RÁE
12112009-12-04 Rafael Avila de Espindola <espindola@google.com>
1212
1213 * testsuite/Makefile.in: Regenerate.
1214
f59f41f3
DK
12152009-12-03 Doug Kwan <dougkwan@google.com>
1216
1217 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1218 (Target_arm::do_finalize_sections): Add parameter for symbol table
1219 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1220 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1221 parameter for symbol table pointer.
1222 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1223 an additional parameter for a pointer to symbol table.
1224 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1225 parameter for a symbol table pointer.
1226 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1227 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1228 Ditto.
1229 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1230 parameter for a symbol table pointer.
1231
ca55d848
RÁE
12322009-12-03 Rafael Avila de Espindola <espindola@google.com>
1233
1234 * incremental.cc (Incremental_inputs_header)
1235 (Incremental_inputs_header_write, Incremental_inputs_entry)
1236 (Incremental_inputs_entry_write): Move ...
1237 * incremental.h (Incremental_inputs_header)
1238 (Incremental_inputs_header_write, Incremental_inputs_entry)
1239 (Incremental_inputs_entry_write): here.
1240
3aec4f9c
RÁE
12412009-12-02 Rafael Avila de Espindola <espindola@google.com>
1242
1243 * incremental.cc (make_sized_incremental_binary): Set the target.
1244 Error if it is incompatible.
1245 * output.h (Output_file): Add filename method.
1246
9c0ae74d
RÁE
12472009-12-02 Rafael Avila de Espindola <espindola@google.com>
1248
1249 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1250 from the get_* methods.
1251
a45500ae
RÁE
12522009-12-02 Rafael Avila de Espindola <espindola@google.com>
1253
1254 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1255 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1256 Write 0 for the data_offset of scripts.
1257
325e6408
RÁE
12582009-12-02 Rafael Avila de Espindola <espindola@google.com>
1259
1260 * testsuite/Makefile.am: Add the incremental_test.sh test.
1261 * testsuite/incremental_test.sh: New.
1262 * testsuite/incremental_test_1.c: New.
1263 * testsuite/incremental_test_2.c: New.
1264
954c3e2e
RÁE
12652009-12-01 Rafael Avila de Espindola <espindola@google.com>
1266
1267 * incremental-dump.cc (main): Fix typos.
1268
f8086623
RÁE
12692009-11-27 Rafael Avila de Espindola <espindola@google.com>
1270
1271 PR gold/11025
1272 * incremental-dump.cc (main): Use llu to print 64 bit values.
1273
3b0dd6ac
L
12742009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1275 H.J. Lu <hongjiu.lu@intel.com>
1276
1277 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1278 $(LIBDL).
1279 (incremental_dump_LDADD): Likewise.
1280 * Makefile.in: Regenerated.
1281
a6d1ef57
DK
12822009-11-25 Doug Kwan <dougkwan@google.com>
1283
1284 Revert:
1285
1286 2009-11-25 Doug Kwan <dougkwan@google.com>
1287
1288 * arm.cc (Target_arm::Target_arm): Move method definition
1289 outside of class definition. Add code to handle
1290 --target1-rel, --target1-abs and --target2= options.
1291 (Target_arm::get_reloc_reloc_type): Change method to be
1292 non-static and const.
1293 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1294 New data member declaration.
1295 (Target_arm::Scan::local, Target_arm::Scan::global,
1296 Target_arm::Relocate::relocate,
1297 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1298 Adjust call to Target_arm::get_real_reloc_type.
1299 (Target_arm::get_real_reloc_type): Use command line options
1300 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1301 * options.h (--target1-rel, --target1-abs, --target2): New
1302 ARM-only options.
1303
50aeb7d4
DK
13042009-11-25 Doug Kwan <dougkwan@google.com>
1305
1306 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1307 class definition. Add code to handle --target1-rel, --target1-abs
1308 and --target2= options.
1309 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1310 and const.
1311 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1312 member declaration.
1313 (Target_arm::Scan::local, Target_arm::Scan::global,
1314 Target_arm::Relocate::relocate,
1315 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1316 call to Target_arm::get_real_reloc_type.
1317 (Target_arm::get_real_reloc_type): Use command line options to
1318 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1319 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1320 options.
1321
51938283
DK
13222009-11-25 Doug Kwan <dougkwan@google.com>
1323
1324 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1325 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1326 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1327 formatting.
1328 (Arm_relocate_functions::thm_call): Replace body with a call to
1329 Arm_relocate_functions::thumb_branch_common.
1330 (Arm_relocate_functions::thm_jump24,
1331 Arm_relocate_functions::thm_xpc22): New method definitions.
1332 (Arm_relocate_functions::thumb_branch_common): New method definition.
1333 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1334 operator.
1335 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1336 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1337
e2b8f3c4
RÁE
13382009-11-24 Rafael Avila de Espindola <espindola@google.com>
1339
1340 * Makefile.am: Build incremental-dump
1341 * Makefile.in: Regenerate.
1342 * incremental-dump.cc: New.
1343 * incremental.cc (Incremental_inputs_header_data,
1344 Incremental_inputs_entry_data): Move to incremental.h
1345 * incremental.h: (Incremental_inputs_header_data,
1346 Incremental_inputs_entry_data): Move from incremental.cc
1347
bcba9aec
RÁE
13482009-11-24 Rafael Avila de Espindola <espindola@google.com>
1349
1350 * incremental.cc (Incremental_inputs_header,
1351 Incremental_inputs_header_write, Incremental_inputs_entry,
1352 Incremental_inputs_entry_write): Add a typedef with the data type.
1353
7c3afe08
RÁE
13542009-11-24 Rafael Avila de Espindola <espindola@google.com>
1355
1356 * incremental.cc (Incremental_inputs_header,
1357 Incremental_inputs_header_write, Incremental_inputs_entry,
1358 Incremental_inputs_entry_write): Update comment about which
1359 type has the filed descriptions.
1360
d204b6e9
DK
13612009-11-15 Doug Kwan <dougkwan@google.com>
1362
1363 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1364 (Arm_relocate_functions::arm_branch_common): Change method defintion
1365 in class definition to a method declaration and update list of formal
1366 parameters.
1367 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1368 Arm_relocation_functions::jump24): Adjust call to
1369 Arm_relocate_functions::arm_branch_common. Update list of formal
1370 parameters.
1371 (Arm_relocate_functions::xpc25): New method definition.
1372 (Arm_relocate_functions::arm_branch_common): Move method defintion
1373 out from class definition. Use stubs for mode-switching and extending
1374 branch ranges.
1375 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1376 specially. Change code to enable use of stubs in ARM branches.
1377
43d12afe
DK
13782009-11-10 Doug Kwan <dougkwan@google.com>
1379
1380 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1381 in method declaration.
1382 (Target_arm::relocate_stub): New method declaration.
1383 (Target_arm::default_target): Change to return a pointer instead of
1384 a const reference.
1385 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1386 Target_arm::default_target.
1387 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1388 method definition.
1389 (Target_arm::relocate_section): Adjust view.
1390 (Target_arm::relocate_stub): New method definition.
1391
ac33a407
DK
13922009-11-10 Doug Kwan <dougkwan@google.com>
1393
1394 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1395 a format warning.
1396 * incremental.cc (open_incremental_binary): Initialized local
1397 variables to avoid warnings.
1398 * object.cc (make_elf_object): Ditto.
1399 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1400 a format warning.
1401
88ee28e9
L
1402009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1403
1404 PR gold/10930
1405 * testsuite/plugin_test.c: Include "config.h".
1406
2daedcd6
DK
14072009-11-09 Doug Kwan <dougkwan@google.com>
1408
1409 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1410 (arm_symbol_value): Remove.
1411 (Arm_relocate_functions::arm_branch_common,
1412 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1413 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1414 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1415 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1416 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1417 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1418 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1419 Arm_relocate_functions::thm_mobw_abs_nc,
1420 Arm_relocate_functions::thm_mov_abs,
1421 Arm_relocate_functions::movw_prel_nc,
1422 Arm_relocate_functions::thm_movt_abs,
1423 Arm_relocate_functions::movt_prel,
1424 Arm_relocate_functions::thm_movw_prel_nc,
1425 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1426 (Target_arm::Relocate::relocate): Only decompose address into two
1427 parts if relocation type uses the thumb-bit and pass the actual
1428 bit instead of a flag indicating that the thumb-bit is used. Adjust
1429 calls to methods in Arm_relocate_functions for this change.
1430
1276bc89 14312009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
1432
1433 PR 10925
1434 * reloc.cc: Instantiate
1435 Sized_relobj::initialize_input_to_output_maps and
1436 Sized_relobj:free_input_to_output_maps.
1437
e53ad1b5
ILT
14382009-11-06 Ian Lance Taylor <iant@google.com>
1439
1440 PR 10876
1441 * defstd.cc (in_segment): Set only_if_ref true for "end".
1442
eb44217c
DK
14432009-11-06 Doug Kwan <dougkwan@google.com>
1444
1445 * arm.cc (class Reloc_stub): Correct a comment.
1446 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1447 (Target_arm::scan_section_for_stubs): New method declaration.
1448 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1449 Change methods from private to protected.
1450 (Target_arm::do_may_relax): New method definition.
1451 (Target_arm::do_relax, Target_arm::group_sections,
1452 Target_arm::scan_reloc_for_stub,
1453 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1454 (Target_arm::arm_input_section_map_): New data member declaration.
1455 (Target_arm::scan_reloc_for_stub,
1456 Target_arm::scan_reloc_section_for_stubs,
1457 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1458 Target_arm::do_relax): New method definitions.
1459
5d329b7d
ILT
14602009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1461
1462 * configure.ac: Check for (struct stat)::st_mtim
1463 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1464 * config.in: Regenerate.
1465 * configure: Regenerate.
1466
96a0d71b
ILT
14672009-11-05 Ian Lance Taylor <iant@google.com>
1468
1469 PR 10910
1470 * output.cc (Output_segment::add_output_section): Add missing
1471 return statement.
1472
594c8e5e
ILT
14732009-11-04 Ian Lance Taylor <iant@google.com>
1474
1475 PR 10880
1476 * object.h (class Object): Add is_needed and set_is_needed
1477 methods. Add is_needed_ field. Make bool fields into bitfields.
1478 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1479 defined in a dynamic object and referenced by a regular object,
1480 set is_needed for the dynamic object.
1481 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1482 if the file is marked with as_needed and it is not needed.
1483
22b127cc
ILT
14842009-11-04 Ian Lance Taylor <iant@google.com>
1485
1486 PR 10887
1487 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1488 tags if data is discarded by linker script.
1489 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1490 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1491 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1492 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1493
f5c870d2
ILT
14942009-11-04 Ian Lance Taylor <iant@google.com>
1495
1496 * layout.cc (Layout::get_output_section): Add is_interp and
1497 is_dynamic_linker_section parameters. Change all callers.
1498 (Layout::choose_output_section): Likewise.
1499 (Layout::make_output_section): Likewise.
1500 (Layout::add_output_section_data): Add is_dynamic_linker_section
1501 parameter. Change all callers.
1502 * layout.h (class Layout): Update declarations.
1503 * output.h (class Output_section): Add is_interp, set_is_interp,
1504 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1505 Add is_interp_, is_dynamic_linker_section_ fields. Change
1506 generate_code_fills_at_write_ to a bitfield.
1507 * output.cc (Output_section::Output_sections): Initialize new
1508 fields.
1509 (Output_segment::add_output_section): Add do_sort parameter.
1510 Change all callers.
1511
1ae4d23b
ILT
15122009-11-03 Ian Lance Taylor <iant@google.com>
1513
1514 PR 10860
1515 * options.h (class General_options): Add --warn-common.
1516 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1517 merging two common symbols.
1518 (Symbol_table::should_override): Handle --warn-common when merging
1519 a common symbol with a defined symbol. Use report_resolve_problem
1520 for multiple definitions.
1521 (Symbol_table::report_resolve_problem): New function.
1522 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1523
55da9579
DK
15242009-11-03 Doug Kwan <dougkwan@google.com>
1525
1526 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1527 stub_factory_.
1528 (Target_arm::stub_factory): New method definition.
1529 (Target_arm::new_arm_input_section,
1530 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1531 Target_arm::reloc_uses_thumb_bit): New method declarations.
1532 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1533 New type definitions.
1534 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1535 member declarations.
1536 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1537 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1538 New method definitions.
1539
37a9ac43
ILT
15402009-11-03 Ian Lance Taylor <iant@google.com>
1541
1542 * options.h (class General_options): Add --warn_constructors.
1543
b3d6a3d4
ILT
15442009-11-03 Ian Lance Taylor <iant@google.com>
1545
1546 PR 10893
1547 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1548 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1549
934b01dd
ILT
15502009-11-03 Ian Lance Taylor <iant@google.com>
1551
1552 PR 10895
1553 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1554 --msgid-bugs-address.
1555 (install-pdf): New target.
1556 (install-data_yes): Look up one directory to find mkinstalldirs.
1557
03c1939b
L
15582009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1559
1560 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1561 tree.
1562
ebd95253
DK
15632009-10-30 Doug Kwan <dougkwan@google.com>
1564
1565 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1566
e9bbb538
DK
15672009-10-30 Doug Kwan <dougkwan@google.com>
1568
1569 * arm.cc (Stub_addend_reader): New struct template definition
1570 and partial specializations.
1571 (Stub_addend_reader::operator()): New method definition for a
1572 partially specialized template.
1573
d5b40221
DK
15742009-10-30 Doug Kwan <dougkwan@google.com>
1575
1576 * arm.cc (Arm_relobj::processor_specific_flags): New method
1577 definition.
1578 (Arm_relobj::do_read_symbols): New method declaration.
1579 (Arm_relobj::processor_specific_flags_): New data member declaration.
1580 (Arm_dynobj): New class definition.
1581 (Target_arm::do_finalize_sections): Add input_objects parameter.
1582 (Target_arm::do_adjust_elf_header): New method declaration.
1583 (Target_arm::are_eabi_versions_compatible,
1584 (Target_arm::merge_processor_specific_flags): New method declaration.
1585 (Target_arm::do_make_elf_object): New overloaded method definitions
1586 and declaration.
1587 (Arm_relobj::do_read_symbols): New method definition.
1588 (Arm_dynobj::do_read_symbols): Ditto.
1589 (Target_arm::do_finalize_sections): Add input_objects parameters.
1590 Merge processor-specific flags from all input objects.
1591 (Target_arm::are_eabi_versions_compatible,
1592 Target_arm::merge_processor_specific_flags,
1593 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1594 New method definitions.
1595 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1596 Input_objects pointer type parameter.
1597 * layout.cc (Layout::finalize): Pass input objects to target's.
1598 finalize_sections function.
1599 * output.cc (Output_file_header::do_sized_write): Set ELF file
1600 header's processor-specific flags.
1601 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1602 Input_objects pointer type parameter.
1603 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1604 * target.h (Input_objects): New forward class declaration.
1605 (Target::processor_specific_flags,
1606 Target::are_processor_specific_flags_sect): New method definitions.
1607 (Target::finalize_sections): Add input_objects parameter.
1608 (Target::Target): Initialize processor_specific_flags_ and
1609 are_processor_specific_flags_set_.
1610 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1611 parameter.
1612 (Target::set_processor_specific_flags): New method definition.
1613 (Target::processor_specific_flags_,
1614 Target::are_processor_specific_flags_set_): New data member
1615 declarations.
1616 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1617 Input_objects pointer type parameter.
1618
ebabffbd
DK
16192009-10-30 Doug Kwan <dougkwan@google.com>
1620
1621 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1622
ad0f2072
ILT
16232009-10-28 Ian Lance Taylor <iant@google.com>
1624
1625 * object.h (class Relobj): Drop options parameter from
1626 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1627 do_scan_relocs, do_relocate. Change all callers.
1628 (class Sized_relobj): Drop options parameters from
1629 do_gc_process_relocs, do_scan_relocs, do_relocate,
1630 do_relocate_sections, relocate_sections, emit_relocs_scan,
1631 emit_relocs_scan_reltype. Change all callers.
1632 (struct Relocate_info): Remove options field and all references to
1633 it.
1634 * reloc.h (class Read_relocs): Remove options constructor
1635 parameter and options_ field. Change all callers.
1636 (class Gc_process_relocs, class Scan_relocs): Likewise.
1637 (class Relocate_task): Likewise.
1638 * target-reloc.h (scan_relocs): Remove options parameter. Change
1639 all callers.
1640 (scan_relocatable_relocs): Likewise.
1641 * target.h (class Sized_target): Remove options parameter from
1642 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1643 all callers.
1644 * gc.h (gc_process_relocs): Remove options parameter. Change all
1645 callers.
1646 * arm.cc: Update functions to remove options parameters.
1647 * i386.cc: Likewise.
1648 * powerpc.cc: Likewise.
1649 * sparc.cc: Likewise.
1650 * x86_64.cc: Likewise.
1651 * testsuite/testfile.cc: Likewise.
1652
8ffa3667
DK
16532009-10-28 Doug Kwan <dougkwan@google.com>
1654
1655 * arm.cc (Arm_relobj): New class definition.
1656 (Arm_relobj::scan_sections_for_stubs,
1657 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1658 New method definitions.
1659
40f36857
CC
16602009-10-28 Cary Coutant <ccoutant@google.com>
1661
1662 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1663 (Plugin::cleanup_done_): New member.
1664 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1665 (Plugin_manager::cleanup_done_): Remove.
1666 (Plugin_manager::add_input_file): Edit error message.
1667 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1668 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1669
2c849493
ILT
16702009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1671
1672 * fileread.cc: (File_read::View::~View): Use the new
1673 data_ownership_ filed.
1674 (File_read::~File_read): Dispose the new whole_file_view_.
1675 (File_read::open): Mmap the whole file if needed.
1676 (File_read::open): Use whole_file_view_ instead of contents_.
1677 (File_read::find_view): Use whole_file_view_ if applicable.
1678 (File_read::do_read): Use whole_file_view_ instead of contents_.
1679 (File_read::make_view): Use whole_file_view_ instead of contents_,
1680 update File_read::View::View call.
1681 (File_read::find_or_make_view): Update File_read::View::View
1682 call.
1683 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1684 remove contents_
1685 (File_read::View::Data_ownership): New enum.
1686 (File_read::View::View): Replace bool mapped_ with Data_ownership
1687 argument.
1688 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1689 (File_read::View::data_ownership_): New field.
1690 (File_read::contents_): Remove (replaced by whole_file_view_).
1691 (File_read::whole_file_view_): New field.
1692 * options.h (class General_options): Add --keep-files-mapped.
1693
24998053
CC
16942009-10-27 Cary Coutant <ccoutant@google.com>
1695
1696 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1697 * testsuite/Makefile.am (plugin_test_5): New test case.
1698 * testsuite/Makefile.in: Regenerate.
1699
72adc4fa
DK
17002009-10-25 Doug Kwan <dougkwan@google.com>
1701
1702 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1703 from private to protected to allow access by child class.
1704 (Sized_relobj::do_relocate_sections): New method declaration.
1705 (Sized_relobj::relocate_sections): Virtualize.
1706 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1707 Sized_relobj::relocate_sections. Instantiate template explicitly
1708 for different target sizes and endianity.
1709
07f508a2
DK
17102009-10-24 Doug Kwan <dougkwan@google.com>
1711
1712 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1713 (Arm_input_section::as_arm_input_section): New method.
1714 (Arm_output_section): New class definition.
1715 (Arm_output_section::create_stub_group,
1716 Arm_output_section::group_sections): New method definitions.
1717
10ad9fe5
DK
17182009-10-22 Doug Kwan <dougkwan@google.com>
1719
1720 * arm.cc (Arm_input_section): New class definition.
1721 (Arm_input_section::init, Arm_input_section:do_write,
1722 Arm_input_section::set_final_data_size,
1723 Arm_input_section::do_reset_address_and_file_offset): New method
1724 definitions.
1725
56ee5e00
DK
17262009-10-21 Doug Kwan <dougkwan@google.com>
1727
1728 * arm.cc (Stub_table, Arm_input_section): New forward class
1729 declarations.
1730 (Stub_table): New class defintion.
1731 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1732 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1733 New method definition.
1734
b569affa
DK
17352009-10-21 Doug Kwan <dougkwan@google.com>
1736
1737 * arm.cc: Update copyright comments.
1738 (Target_arm): New forward class template declaration.
1739 (Arm_address): New type.
1740 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1741 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1742 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1743 constants.
1744 (Insn_template): Same.
1745 (DEF_STUBS): New macro.
1746 (Stub_type): New enum type.
1747 (Stub_template): New class definition.
1748 (Stub): Same.
1749 (Reloc_stub): Same.
1750 (Stub_factory): Same.
1751 (Target_arm::Target_arm): Initialize may_use_blx_ and
1752 should_force_pic_veneer_.
1753 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1754 Target_arm::should_force_pic_veneer,
1755 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1756 Target_arm::using_thumb_only, Target_arm:;default_target): New
1757 method defintions.
1758 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1759 New data member declarations.
1760 (Insn_template::size, Insn_template::alignment): New method defintions.
1761 (Stub_template::Stub_template): New method definition.
1762 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1763 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1764 (Stub_factory::Stub_factory): New method definition.
1765 * gold.h (string_hash): New template.
1766 * output.h (Input_section_specifier::hash_value): Use
1767 gold::string_hash.
1768 (Input_section_specifier::string_hash): Remove.
1769 * stringpool.cc (Stringpool_template::string_hash): Use
1770 gold::string_hash.
1771
6c172549
DK
17722009-10-20 Doug Kwan <dougkwan@google.com>
1773
1774 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1775 symbols of relaxed input sections.
1776 * output.h (Output_section::find_relaxed_input_section): Make
1777 method public.
1778
c5617f2f
DK
17792009-10-16 Doug Kwan <dougkwan@google.com>
1780
1781 * dynobj.cc (Versions::Versions): Initialize version_script_.
1782 Only insert base version symbol definition for a shared object
1783 if version script defines any version versions.
1784 (Versions::define_base_version): New method definition.
1785 (Versions::add_def): Check that base version is not needed.
1786 (Versions::add_need): Define base version lazily.
1787 * dynobj.h (Versions::define_base_version): New method declaration.
1788 (Versions::needs_base_version_): New data member declaration.
1789 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1790 (check_DATA): Add no_version_test.stdout.
1791 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1792 New make rules.
1793 * testsuite/Makefile.in: Regenerate.
1794 * testsuite/no_version_test.c: New file.
1795 * testsuite/no_version_test.sh: Ditto.
1796
3c12dcdb
DK
17972009-10-16 Doug Kwan <dougkwan@google.com>
1798
1799 * expression.cc (class Segment_start_expression): New class definition.
1800 (Segment_start_expression::value): New method definition.
1801 (script_exp_function_segment_start): Return a new
1802 Segment_start_expression.
1803 * gold/script-c.h (script_saw_segment_start_expression): New function
1804 prototype.
1805 * script-sections.cc (Script_sections::Script_sections): Initialize
1806 SAW_SEGMENT_START_EXPRESSION_ to false.
1807 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1808 and -Tbbs options to specify section addresses if given in
1809 command line and no SEGMENT_START expression is seen in a script.
1810 * script-sections.h (Script_sections::saw_segment_start_expression,
1811 Script_sections::set_saw_segment_start_expression): New method
1812 definition.
1813 (Script_sections::saw_segment_start_expression_): New data member
1814 declaration.
1815 * script.cc (script_saw_segment_start_expression): New function.
1816 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1817 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1818 script_test_7.sh and script_test_8.sh.
1819 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1820 script_test_8.stdout.
1821 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1822 (script_test_6, script_test_6.stdout, script_test_7,
1823 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1824 * Makefile.in: Regenerate.
1825 * testsuite/script_test_6.sh: New file.
1826 * testsuite/script_test_6.t: Same.
1827 * testsuite/script_test_7.sh: Same.
1828 * testsuite/script_test_7.t: Same.
1829 * testsuite/script_test_8.sh: Same.
1830
64b1ae37
DK
18312009-10-16 Doug Kwan <dougkwan@google.com>
1832
1833 * output.cc (Output_segment::set_section_list_address): Cast
1834 expressions to unsigned long long type to avoid format warnings.
1835
661be1e2
ILT
18362009-10-15 Ian Lance Taylor <iant@google.com>
1837
12edd763 1838 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 1839 dot assignment to script_sections_.
12edd763
ILT
1840 * script-sections.cc (Script_sections::add_dot_assignment):
1841 Initialize if necessary.
1842
68b6574b
ILT
1843 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1844 program headers with no load segment if there is a linker script.
1845
661be1e2
ILT
1846 * layout.cc (Layout::set_segment_offsets): Align the file offset
1847 to the segment aligment for -N or -n with no load segment.
1848 * output.cc (Output_segment::add_output_section): Don't crash if
1849 the first section is a TLS section.
1850 (Output_segment::set_section_list_addresses): Print an error
1851 message if the address moves backward in a linker script.
1852 * script-sections.cc
1853 (Output_section_element_input::set_section_addresses): Don't
1854 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1855 (Orphan_output_section::set_section_addresses): Likewise.
1856
f15f61a7
DK
18572009-10-15 Doug Kwan <dougkwan@google.com>
1858
1859 * layout.cc (Layout::finish_dynamic_section): Generate tags
1860 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1861 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1862 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1863
82bb573a
ILT
18642009-10-14 Ian Lance Taylor <iant@google.com>
1865
1866 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1867 fields.
1868 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1869 data_shdr fields of relinfo.
1870 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1871 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
1872 R_386_TLS_LDO_32, adjust based on section flags.
1873 (Target_i386::Relocate::fix_up_ldo): Remove.
1874
374ad285
ILT
18752009-10-13 Ian Lance Taylor <iant@google.com>
1876
1877 Add support for -pie.
1878 * options.h (class General_options): Add -pie and
1879 --pic-executable.
1880 (General_options::output_is_position_independent): Test -pie.
1881 (General_options::output_is_executable): Return true if not shared
1882 and not relocatable.
1883 (General_options::output_is_pie): Remove.
1884 * options.cc (General_options::finalize): Reject incompatible uses
1885 of -pie.
1886 * gold.cc (queue_middle_tasks): A -pie link is not static.
1887 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1888 * symtab.cc (Symbol::final_value_is_known): Return false if
1889 output_is_position_independent.
1890 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1891 output_is_position_independent.
1892 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1893 output_is_position_independent.
1894 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1895 output_is_position_independent.
1896 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1897 two_file_pie_test.
1898 (basic_pie_test.o, basic_pie_test): New targets.
1899 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1900 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1901 (two_file_pie_test): New target.
1902 * testsuite/Makefile.in: Rebuild.
1903 * README: Remove note saying that -pie is not supported.
1904
c6585162
ILT
19052009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
1906
1907 * options.h (class General_options): Add -init and -fini.
1908 * layout.cc (Layout::finish_dynamic_section): Emit
1909 given init and fini functions.
1910
032ce4e9
ST
19112009-10-13 Sriraman Tallam <tmsriram@google.com>
1912
1913 * gc.h (gc_process_relocs): Check if icf is enabled using new
1914 function.
1915 * gold.cc (queue_initial_tasks): Likewise.
1916 (queue_middle_tasks): Likewise.
1917 * object.cc (do_layout): Likewise.
1918 * symtab.cc (is_section_folded): Likewise.
1919 * main.cc (main): Likewise.
1920 * reloc.cc (Read_relocs::run): Likewise.
1921 (Sized_relobj::do_scan_relocs): Likewise.
1922 * icf.cc (is_function_ctor_or_dtor): New function.
1923 (Icf::find_identical_sections): Check if function is ctor or dtor when
1924 safe icf is chosen.
1925 * options.h (General_options::icf): Change option to be an enum.
1926 (Icf_status): New enum.
1927 (icf_enabled): New method.
1928 (icf_safe_folding): New method.
1929 (set_icf_status): New method.
1930 (icf_status_): New variable.
1931 * (options.cc) (General_options::finalize): Set icf_status_.
1932 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
1933 icf_test and icf_keep_unique_test to use the --icf enum flag.
1934 * testsuite/icf_safe_test.sh: New file.
1935 * testsuite/icf_safe_test.cc: New file.
1936
f345227a
ST
19372009-10-12 Sriraman Tallam <tmsriram@google.com>
1938
1939 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
1940 includes to gc.h and icf.h.
1941 * arm.cc: Include gc.h.
1942 * gold.cc: Likewise.
1943 * i386.cc: Likewise.
1944 * powerpc.cc: Likewise.
1945 * sparc.cc: Likewise.
1946 * x86_64.cc: Likewise.
1947 * gc.h: Include icf.h.
1948
1c7814ed
ILT
19492009-10-11 Ian Lance Taylor <iant@google.com>
1950
1951 * plugin.cc: Include "gold.h" before other header files.
1952
ae3b5189
CD
19532009-10-10 Chris Demetriou <cgd@google.com>
1954
1955 * options.h (Input_file_argument::Input_file_type): New enum.
1956 (Input_file_argument::is_lib_): Replace with...
1957 (Input_file_argument::type_): New member.
1958 (Input_file_argument::Input_file_argument): Take Input_file_type
1959 'type' rather than boolean 'is_lib' as second argument.
1960 (Input_file_argument::is_lib): Use type_.
1961 (Input_file_argument::is_searched_file): New function.
1962 (Input_file_argument::may_need_search): Handle is_searched_file.
1963 * options.cc (General_options::parse_library): Support -l:filename.
1964 (General_options::parse_just_symbols): Update for Input_file_argument
1965 changes.
1966 (Command_line::process): Likewise.
1967 * archive.cc (Archive::get_file_and_offset): Likewise.
1968 * plugin.cc (Plugin_manager::release_input_file): Likewise.
1969 * script.cc (read_script_file, script_add_file): Likewise.
1970 * fileread.cc (Input_file::Input_file): Likewise.
1971 (Input_file::will_search_for): Handle is_searched_file.
1972 (Input_file::open): Likewise.
1973 * readsyms.cc (Read_symbols::get_name): Likewise.
1974 * testsuite/Makefile.am (searched_file_test): New test.
1975 * testsuite/Makefile.in: Regenerate.
1976 * testsuite/searched_file_test.cc: New file.
1977 * testsuite/searched_file_test_lib.cc: New file.
1978
f3048a1d
ILT
19792009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1980 Ian Lance Taylor <iant@google.com>
1981
1982 * descriptor.cc: Include <cstdio> and "binary-io.h".
1983 (Descriptors::open): Open the files in binary mode always.
1984 * script.cc (Lex::get_token): Treat \r as whitespace.
1985
d4780e57
ILT
19862009-10-09 Ian Lance Taylor <iant@google.com>
1987
1988 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1989
d9a893b8
ILT
19902009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1991 Ian Lance Taylor <iant@google.com>
1992
1993 * configure.ac: Check for readv function also.
1994 * fileread.cc (readv): Define if not HAVE_READV.
1995 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1996 does not exist.
1997 * config.in: Regenerate.
1998 * configure: Regenerate.
1999
c0a62865
DK
20002009-10-09 Doug Kwan <dougkwan@google.com>
2001
2002 * layout.cc (Layout::make_output_section): Call target hook to make
2003 ordinary output section.
2004 (Layout::finalize): Adjust parameter list of call the
2005 Target::may_relax().
2006 * layout.h (class Layout::section_list): New method.
2007 * merge.h (Output_merge_base::entsize): Change visibility to public.
2008 (Output_merge_base::is_string, Output_merge_base::do_is_string):
2009 New methods.
2010 (Output_merge_string::do_is_string): New method.
2011 * object.cc (Sized_relobj::do_setup): renamed from
2012 Sized_relobj::set_up.
2013 * object.h (Sized_relobj::adjust_shndx,
2014 Sized_relobj::initializ_input_to_output_maps,
2015 Sized_relobj::free_input_to_output_maps): Change visibilities to
2016 protected.
2017 (Sized_relobj::setup): Virtualize.
2018 (Sized_relobj::do_setup): New method declaration.
2019 (Sized_relobj::invalidate_section_offset,
2020 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2021 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2022 * options.cc (parse_int): New function.
2023 * options.h (parse_int): New declaration.
2024 (DEFINE_int): New macro.
2025 (stub_group_size): New option.
2026 * output.cc (Output_section::Output_section): Initialize memebers
2027 merge_section_map_, merge_section_by_properties_map_,
2028 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2029 (Output_section::add_input_section): Handled deferred code-fill
2030 generation and remove an old comment.
2031 (Output_section::add_relaxed_input_section): New method definition.
2032 (Output_section::add_merge_input_section): Use merge section by
2033 properties map to speed to search. Update merge section maps
2034 as appropriate.
2035 (Output_section::build_relaxation_map): New method definition.
2036 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2037 Same.
2038 (Output_section::relax_input_section): Renamed to
2039 Output_section::convert_input_sections_to_relaxed_sections and change
2040 interface to take a vector of pointers to relaxed sections.
2041 (Output_section::find_merge_section,
2042 Output_section::find_relaxed_input_section): New method definitions.
2043 (Output_section::is_input_address_mapped,
2044 Output_section::output_offset, Output_section::output_address):
2045 Use output section data maps to speed up searching.
2046 (Output_section::find_starting_output_address): Add comments.
2047 (Output_section::do_write,
2048 Output_section::write_to_postprocessing_buffer): Do code-fill
2049 generation as appropriate.
2050 (Output_section::get_input_sections): Invalidate relaxed input section
2051 map.
2052 (Output_section::restore_states): Adjust type of checkpoint .
2053 Invalidate relaxed input section map.
2054 * output.h (Output_merge_base): New class declaration.
2055 (Input_section_specifier): New class defintion.
2056 (class Output_relaxed_input_section) Change base class to
2057 Output_section_data_build.
2058 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2059 base class initializer.
2060 (Output_section::add_relaxed_input_section): New method declaration.
2061 (Output_section::Input_section): Change visibility to protected.
2062 (Output_section::Input_section::relobj,
2063 Output_section::Input_section::shndx): Handle relaxed input sections.
2064 Output_section::input_sections) Change visibility to protected. Also
2065 define overload to return a non-const pointer.
2066 (Output_section::Merge_section_properties): New class defintion.
2067 (Output_section::Merge_section_by_properties_map,
2068 Output_section::Output_section_data_by_input_section_map,
2069 Output_section::Relaxation_map): New types.
2070 (Output_section::relax_input_section): Rename method to
2071 Output_section::convert_input_sections_to_relaxed_sections and change
2072 interface to take a vector of relaxed section pointers.
2073 (Output_section::find_merge_section,
2074 Output_section::find_relaxed_input_section,
2075 Output_section::build_relaxation_map,
2076 Output_section::convert_input_sections_in_list_to_relaxed_sections):
2077 New method declarations.
2078 (Output_section::merge_section_map_
2079 Output_section::merge_section_by_properties_map_,
2080 Output_section::relaxed_input_section_map_,
2081 Output_section::is_relaxed_input_section_map_valid_,
2082 Output_section::generate_code_fills_at_write_): New data members.
2083 * script-sections.cc
2084 (Output_section_element_input::set_section_addresses): Call
2085 current_data_size and addralign methods of relaxed input sections.
2086 (Orphan_output_section::set_section_addresses): Call current_data_size
2087 and addralign methods of relaxed input sections.
2088 * symtab.cc (Symbol_table::compute_final_value): Extract template
2089 from the body of Symbol_table::sized_finalize_symbol.
2090 (Symbol_table::sized_finalized_symbol): Call
2091 Symbol_table::compute_final_value.
2092 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2093 (Symbol_table::compute_final_value): New templated method declaration.
2094 * target.cc (Target::do_make_output_section): New method defintion.
2095 * target.h (Target::make_output_section): New method declaration.
2096 (Target::relax): Add more parameters for input objects, symbol table
2097 and layout. Adjust call to do_relax.
2098 (Target::do_make_output_section): New method declaration.
2099 (Target::do_relax): Add parameters for input objects, symbol table
2100 and layout.
2101
d446d6c4
ILT
21022009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2103
2104 * pread.c: Include stdio.h.
2105
bc06c745
ILT
21062009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2107
2108 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2109 defined.
2110
75aea3d0
ILT
21112009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2112
2113 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2114 Change read_shndx type to unsigned int.
2115 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2116 int.
2117 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2118 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2119 Change read_shndx type to unsigned int.
2120 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2121 int.
2122 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2123 * layout.cc (Layout::create_symtab_sections): Cast the result of
2124 local_symcount * symsize to off_t in the gold_assert.
2125
be8fcb75
ILT
21262009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2127
2128 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2129 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2130 R_ARM_BASE_ABS.
2131 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2132 (Arm_relocate_functions::thm_abs5): New function.
2133 (Arm_relocate_functions::abs12): New function.
2134 (Arm_relocate_functions::abs16): New function.
2135 (Arm_relocate_functions::base_abs): New function.
2136 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2137 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
2138 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2139 R_ARM_BASE_ABS.
2140 (Scan::global): Likewise.
2141 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2142 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2143 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2144 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2145 R_ARM_BASE_ABS.
2146
c2a122b6
ILT
21472009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2148
2149 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2150 (Arm_relocate_functions::movt_prel): New function.
2151 (Arm_relocate_functions::thm_movw_prel_nc): New function.
2152 (Arm_relocate_functions::thm_movt_prel): New function.
2153 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2154 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2155 (Scan::global, Relocate::relocate): Likewise.
2156 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2157
c4aa1e2d
ILT
21582009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2159
2160 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2161 Incremental_checker.
2162 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2163 unsigned int.
2164 (class Incremental_inputs_header): New class.
2165 (Incremental_inputs_header_writer): Edit comment.
2166 (Incremental_inputs_entry): New class.
2167 (Incremental_inputs_entry_writer): Edit comment.
2168 (Sized_incremental_binary::do_find_incremental_inputs_section):
2169 Add *strtab_shndx parameter, fill it.
2170 (Sized_incremental_binary::do_check_inputs): New method.
2171 (Incremental_checker::can_incrementally_link_output_file): Use
2172 Sized_incremental_binary::check_inputs.
2173 (Incremental_inputs::report_command_line): Save command line in
2174 command_line_.
2175 * incremental.h:
2176 (Incremental_binary::find_incremental_inputs_section): New
2177 method.
2178 (Incremental_binary::do_find_incremental_inputs_section): Add
2179 strtab_shndx parameter.
2180 (Incremental_binary::do_check_inputs): New pure virtual method.
2181 (Sized_incremental_binary::do_check_inputs): Declare.
2182 (Incremental_checker::Incremental_checker): Add incremental_inputs
2183 parameter, use it to initialize incremental_inputs_.
2184 (Incremental_checker::incremental_inputs_): New field.
2185 (Incremental_checker::command_line): New method.
2186 (Incremental_checker::inputs): New method.
2187 (Incremental_checker::command_line_): New field.
2188
c549a694
ILT
21892009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2190
2191 * incremental.cc: Include <cstdarg> and "target-select.h".
2192 (vexplain_no_incremental): New function.
2193 (explain_no_incremental): New function.
2194 (Incremental_binary::error): New method.
2195 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2196 method.
2197 (make_sized_incremental_binary): New function.
2198 (open_incremental_binary): New function.
2199 (can_incrementally_link_file): Add checks if output is ELF and has
2200 inputs section.
2201 * incremental.h: Include "elfcpp_file.h" and "output.h".
2202 (Incremental_binary): New class.
2203 (Sized_incremental_binary): New class.
2204 (open_incremental_binary): Declare.
2205 * object.cc (is_elf_object): Use
2206 elfcpp::Elf_recognizer::is_elf_file.
2207 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2208 * output.h (Output_file::filesize): New method.
2209
fd3c5f0b
ILT
22102009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2211
2212 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2213 New function.
2214 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2215 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2216 function.
2217 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2218 function.
2219 (Arm_relocate_functions::movw_abs_nc): New function.
2220 (Arm_relocate_functions::movt_abs): New function.
2221 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2222 (Arm_relocate_functions::thm_movt_abs): New function.
2223 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2224 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2225 (Scan::global): Likewise.
2226 (Relocate::relocate): Likewise.
2227 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2228
7f5309a5
ILT
22292009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2230
2231 * arm.cc (Arm_relocate_functions::got_prel) New function.
2232 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2233 (Relocate::relocate): Likewise.
2234 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2235
364c7fa5
ILT
22362009-10-06 Ian Lance Taylor <iant@google.com>
2237
2238 * options.h (class General_options): Define
2239 split_stack_adjust_size parameter.
2240 * object.h (class Object): Add uses_split_stack_ and
2241 has_no_split_stack_ fields. Add uses_split_stack and
2242 has_no_split_stack accessor functions. Declare
2243 handle_split_stack_section.
2244 (class Reloc_symbol_changes): Define.
2245 (class Sized_relobj): Define Function_offsets. Declare
2246 split_stack_adjust, split_stack_adjust_reltype, and
2247 find_functions.
2248 * object.cc (Object::handle_split_stack_section): New function.
2249 (Sized_relobj::do_layout): Call handle_split_stack_section.
2250 * dynobj.cc (Sized_dynobj::do_layout): Call
2251 handle_split_stack_section.
2252 * reloc.cc (Sized_relobj::relocate_sections): Call
2253 split_stack_adjust for executable sections in split_stack
2254 objects. Pass reloc_map to relocate_section.
2255 (Sized_relobj::split_stack_adjust): New function.
2256 (Sized_relobj::split_stack_adjust_reltype): New function.
2257 (Sized_relobj::find_functions): New function.
2258 * target-reloc.h: Include "object.h".
2259 (relocate_section): Add reloc_symbol_changes parameter. Change
2260 all callers.
2261 * target.h (class Target): Add calls_non_split method. Declare
2262 do_calls_non_split virtual method. Declare match_view and
2263 set_view_to_nop.
2264 * target.cc: Include "elfcpp.h".
2265 (Target::do_calls_non_split): New function.
2266 (Target::match_view): New function.
2267 (Target::set_view_to_nop): New function.
2268 * gold.cc (queue_middle_tasks): Give an error if mixing
2269 split-stack and non-split-stack objects with -r.
2270 * i386.cc (Target_i386::relocate_section): Add
2271 reloc_symbol_changes parameter.
2272 (Target_i386::do_calls_non_split): New function.
2273 * x86_64.cc (Target_x86_64::relocate_section): Add
2274 reloc_symbol_changes parameter.
2275 (Target_x86_64::do_calls_non_split): New function.
2276 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2277 parameter.
2278 * powerpc.cc (Target_powerpc::relocate_section): Add
2279 reloc_symbol_changes parameter.
2280 * sparc.cc (Target_sparc::relocate_section): Add
2281 reloc_symbol_changes parameter.
2282 * configure.ac: Call AM_CONDITIONAL for the default target.
2283 * configure: Rebuild.
2284 * testsuite/Makefile.am (TEST_AS): New variable.
2285 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2286 (check_DATA): Add split_i386 and split_x86_64 files.
2287 (SPLIT_DEFSYMS): Define.
2288 (split_i386_[1234n].o): New targets.
2289 (split_i386_[124]): New targets.
2290 (split_i386_[1234r].stdout): New targets.
2291 (split_x86_64_[1234n].o): New targets.
2292 (split_x86_64_[124]): New targets.
2293 (split_x86_64_[1234r].stdout): New targets.
2294 (MOSTLYCLEANFILES): Add new executables.
2295 * testsuite/split_i386.sh: New file.
2296 * testsuite/split_x86_64.sh: New file.
2297 * testsuite/split_i386_1.s: New file.
2298 * testsuite/split_i386_2.s: New file.
2299 * testsuite/split_i386_3.s: New file.
2300 * testsuite/split_i386_4.s: New file.
2301 * testsuite/split_i386_n.s: New file.
2302 * testsuite/split_x86_64_1.s: New file.
2303 * testsuite/split_x86_64_2.s: New file.
2304 * testsuite/split_x86_64_3.s: New file.
2305 * testsuite/split_x86_64_4.s: New file.
2306 * testsuite/split_x86_64_n.s: New file.
2307 * testsuite/testfile.cc (Target_test): Update relocation_section
2308 function.
2309 * testsuite/Makefile.in: Rebuild.
2310
e8a9fcda
ILT
23112009-10-06 Ian Lance Taylor <iant@google.com>
2312
2313 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2314 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2315 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2316 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2317 the address on ldo_addrs_.
2318 (Target_i386::Relocate::fix_up_ldo): New function.
2319
e99daf92
ILT
23202009-10-06 Rafael Espindola <espindola@google.com>
2321
2322 * plugin.cc (add_input_library): New.
2323 (Plugin::load): Add add_input_library to tv.
2324 (Plugin_manager::add_input_file): Add the is_lib argument.
2325 (add_input_file): Update call to Plugin_manager::add_input_file.
2326 (add_input_library): New.
2327 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2328
966d4097
DK
23292009-09-30 Doug Kwan <dougkwan@google.com>
2330
2331 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2332 symbol and call Symbol::may_need_copy_reloc to determine if
2333 a copy reloc is needed.
2334 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2335 nocopyreloc is given in command line.
2336 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2337 given in command line.
2338 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2339 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2340 of the removed Target_i386::may_need_copy_reloc.
2341 * options.h (copyreloc): New option with default value false.
2342 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2343 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2344 instead of the removed Target_powerpc::may_need_copy_reloc.
2345 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2346 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2347 instead of the removed Target_sparc::may_need_copy_reloc.
2348 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2349 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2350 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2351 instead of the removed Target_x86_64::may_need_copy_reloc.
2352
029ba973
ILT
23532009-09-30 Ian Lance Taylor <iant@google.com>
2354
2355 * object.h (class Object): Remove target_ field, and target,
2356 sized_target, and set_target methods.
2357 (Object::sized_target): Remove.
2358 (class Sized_relobj): Update declarations. Remove sized_target.
2359 * object.cc (Sized_relobj::setup): Remove target parameter.
2360 Change all callers.
2361 (Input_objects::add_object): Don't do anything with the target.
2362 (make_elf_sized_object): Add punconfigured parameter. Change all
2363 callers. Set or test parameter target.
2364 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2365 Change all callers.
2366 * parameters.cc (Parameters::set_target): Change parameter type to
2367 be non-const.
2368 (Parameters::default_target): Remove.
2369 (set_parameters_target): Change parameter type to be non-const.
2370 (parameters_force_valid_target): New function.
2371 (parameters_clear_target): New function.
2372 * parameters.h (class Parameters): Update declarations. Remove
2373 default_target method. Add sized_target and clear_target
2374 methods. Change target_ to be non-const.
2375 (set_parameters_target): Update declaration.
2376 (parameters_force_valid_target): Declare.
2377 (parameters_clear_target): Declare.
2378 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2379 as NULL if we aren't searching.
2380 (Add_symbols::run): Don't check for compatible target.
2381 * fileread.cc (Input_file::open_binary): Call
2382 parameters_force_valid_target.
2383 * gold.cc (queue_middle_tasks): Likewise.
2384 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
2385 set_target on object.
2386 * dynobj.h (class Sized_dynobj): Update declarations.
2387 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2388 make_elf_object returns NULL.
2389 (Archive::include_member): Don't check whether object target is
2390 compatible.
2391 * output.cc (Output_section::add_input_section): Get target from
2392 parameters.
2393 (Output_section::relax_input_section): Likewise.
2394 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2395 parameters.
2396 (Sized_relobj::do_scan_relocs): Likewise.
2397 (Sized_relobj::relocate_sections): Likewise.
2398 * resolve.cc (Symbol_table::resolve): Likewise.
2399 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2400 parameter. Change all callers.
2401 (Symbol_table::add_from_object): Get target from parameters.
2402 (Symbol_table::add_from_relobj): Don't check object target.
2403 (Symbol_table::add_from_dynobj): Likewise.
2404 (Symbol_table::define_special_symbol): Get target from
2405 parameters.
2406 * symtab.h (class Symbol_table): Update declaration.
2407 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2408 parameter. Change all callers. Clear parameter target.
2409 (Binary_test): Test target here.
2410 * testsuite/object_unittest.cc (gold_testsuite): Remove
2411 target_test_pointer parameter. Change all callers.
2412 (Object_test): Test target here.
2413
a6a22b83
ILT
24142009-09-26 Ian Lance Taylor <iant@google.com>
2415
2416 * testsuite/initpri1.c: Don't try to use constructor priorities if
2417 compiling with gcc before 4.3.
2418
6a8f49fe
ILT
24192009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2420
2421 * testsuite/retain_symbols_file_test.sh (check_present): Change
2422 output file name to retain_symbols_file_test.stdout.
2423 (check_absent): Likewise.
2424
8c604651
CS
24252009-09-18 Craig Silverstein <csilvers@google.com>
2426
2427 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2428 * options.cc: Include <cerrno> and <fstream>.
2429 (General_options::finalize): Parse -retain-symbols-file tag.
2430 * options.h: New flag.
2431 (General_options): New method should_retain_symbol, new
2432 variable symbols_to_retain.
2433 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2434 should_retain_symbol map.
2435 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2436 * testsuite/Makefile.in: Regenerate.
2437 * testsuite/retain_symbols_file_test.sh: New file.
2438
ca58b19f
NC
24392009-09-18 Nick Clifton <nickc@redhat.com>
2440
2441 * po/es.po: Updated Spanish translation.
2442
20e6d0d6
DK
24432009-09-17 Doug Kwan <dougkwan@google.com>
2444
2445 * debug.h (DEBUG_RELAXATION): New constant.
2446 (DEBUG_ALL): Add DEBUG_RELAXATION.
2447 (debug_string_to_enum): Add relaxation debug option.
2448 * layout.cc
2449 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2450 Layout::Relaxation_debug_check::read_sections,
2451 Layout::Relaxation_debug_check::read_sections): New method definitions.
2452 (Layout::Layout): Initialize data members
2453 record_output_section_data_from_scrips_,
2454 script_output_section_data_list_ and relaxation_debug_check_.
2455 (Layout::save_segments, Layout::restore_segments,
2456 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2457 Layout::relaxation_loop_body): New method definitions.
2458 (Layout::finalize): Support relaxation. Move section layout code to
2459 Layout::relaxation_loop_body.
2460 (Layout::set_asection_address_from_script): Move code for orphan
2461 section placement out.
2462 (Layout::place_orphan_sections_in_script): New method definition.
2463 * layout.h (Output_segment_headers, Output_file_header):
2464 New forward class declarations.
2465 (Layout::~Layout): Define.
2466 (Layout::new_output_section_data_from_script): New method definition.
2467 (Layout::place_orphan_sections_in_script): New method declaration.
2468 (Layout::Segment_states): New type declaration.
2469 (Layout::save_segments, Layout::restore_segments,
2470 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2471 Layout::relaxation_loop_body): New method declarations.
2472 (Layout::Output_section_data_list): New type declaration.
2473 (Layout::Relaxation_debug_check): New class definition.
2474 (Layout::record_output_section_data_from_script_,
2475 Layout::script_output_section_data_list_, Layout::segment_states_,
2476 Layout::relaxation_debug_check_): New data members.
2477 * output.cc: (Output_section_headers::do_size): New method definition.
2478 (Output_section_headers::Output_section_headers): Move size
2479 computation to Output_section_headers::do_size.
2480 (Output_segment_headers::do_size): New method definition.
2481 (Output_file_header::Output_file_header): Move size computation to
2482 Output_file_header::do_size and call it.
2483 (Output_file_header::do_size): New method definition.
2484 (Output_data_group::Output_data_group): Adjust call to
2485 Output_section_data.
2486 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2487 (Output_symtab_xindex::do_write): Add array bound check.
2488 (Output_section::Input_section::print_to_mapfile): Handle
2489 RELAXED_INPUT_SECTION_CODE.
2490 (Output_section::Output_section): Initialize data member checkpoint_.
2491 (Output_section::~Output_section): Delete checkpoint object pointed
2492 by checkpoint_.
2493 (Output_section::add_input_section): Always add an Input_section if
2494 relaxing.
2495 (Output_section::add_merge_input_section): Add assert.
2496 (Output_section::relax_input_section): New method definition.
2497 (Output_section::set_final_data_size): Set load address to zero for
2498 an unallocated section.
2499 (Output_section::do_address_and_file_offset_have_reset_values):
2500 New method definition.
2501 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2502 Handle relaxed input section.
2503 (Output_section::sort_attached_input_sections): Checkpoint input
2504 section list lazily.
2505 (Output_section::get_input_sections): Change type of input_sections to
2506 list of Simple_input_section pointers. Checkpoint input section list
2507 lazily. Also handle relaxed input sections.
2508 (Output_section::add_input_section_for_script): Take a reference to
2509 a Simple_input_section object instead of Relobj pointer and section
2510 index as parameter. Handle relaxed input sections.
2511 (Output_section::save_states, Output_section::restore_states): New
2512 method definitions.
2513 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2514 (Output_data::is_data_size_fixed): New method definition.
2515 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2516 if it is fixed.
2517 (Output_data::address_and_file_offset_have_reset_values): New method
2518 definition.
2519 (Output_data::do_address_and_file_offset_have_reset_values): New method
2520 definition.
2521 (Output_data::set_data_size): Check that data size is not fixed.
2522 (Output_data::fix_data_size): New method definition.
2523 (Output_data::is_data_size_fixed_): New data member.
2524 (Output_section_headers::set_final_data_size): New method definition.
2525 (Output_section_headers::do_size): New method declaration.
2526 (Output_segment_headers::set_final_data_size): New method definition.
2527 (Output_segment_headers::do_size): New method declaration.
2528 (Output_file_header::set_final_data_size)::New method definition.
2529 (Output_file_header::do_size)::New method declaration.
2530 (Output_section_data::Output_section_data): Add new parameter
2531 is_data_size_fixed and use it to fix data size.
2532 (Output_data_const::Output_data_const): Adjust call to base class
2533 constructor and fix data size.
2534 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2535 base class constructor and fix data size.
2536 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2537 base class constructor and fix data size.
2538 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2539 class constructor and fix data size.
2540 (Output_data_group::set_final_data_size): New method definition.
2541 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2542 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2543 class constructor and fix data size.
2544 (Output_relaxed_input_section): New class definition.
2545 (Output_section::Simple_input_section): New class definition.
2546 (Output_section::get_input_sections): Adjust parameter list.
2547 (Output_section::add_input_section_for_script): Same.
2548 (Output_section::save_states, Output_section::restore_states,
2549 Output_section::do_address_and_file_offset_have_reset_values,
2550 (Output_section::Input_section::Input_section): Handle
2551 RELAXED_INPUT_SECTION_CODE. Add new overload for
2552 Output_relaxed_input_section.
2553 (Output_section::Input_section::is_input_section,
2554 Output_section::Input_section::set_output_section): Handle relaxed
2555 input section.
2556 (Output_section::Input_section::is_relaxed_input_section,
2557 Output_section::Input_section::output_section_data,
2558 Output_section::Input_section::relaxed_input_section): New method
2559 definitions.
2560 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2561 value.
2562 (Output_section::Input_section::u1_): Update comments.
2563 (Output_section::Input_section::u2_): Add new union member poris.
2564 (Output_section::Checkpoint_output_section): New classs definition.
2565 (Output_section::relax_input_section): New method declaration.
2566 (Output_section::checkpoint_): New data member.
2567 (Output_segment): Update comments.
2568 (Output_segment::Output_segment): Un-privatize copy constructor.
2569 (Output_segment::operator=): Un-privatize.
2570 * script-sections.cc (Output_section_element::Input_section_list):
2571 Change element type to Output_section::Simple_input_section.
2572 (Output_section_element_dot_assignment::set_section_addresses):
2573 Register output section data for relaxation clean up.
2574 (Output_data_exression::Output_data_expression): Adjust call to base
2575 constructor to fix data size.
2576 (Output_section_element_data::set_section_addresses): Register
2577 Output_data_expression object for relaxation clean up.
2578 (struct Input_section_info): Replace Relobj pointer and section index
2579 pair with Output_section::Simple_input_section and Convert struct to a
2580 class.
2581 (Input_section_sorter::operator()): Adjust access to
2582 Input_section_info data member to use accessors.
2583 (Output_section_element_input::set_section_addresses): Use layout
2584 parameter. Adjust code to use Output_section::Simple_input_section
2585 and Input_secction_info classes. Register filler for relaxation
2586 clean up.
2587 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2588 and section index pair with Output_section::Simple_input_section
2589 class. Adjust code accordingly.
2590 (Phdrs_element::release_segment): New method definition.
2591 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2592 segment list.
2593 (Script_sections::release_segments): New method definition.
2594 * gold/script-sections.h (Script_sections::release_segments): New
2595 method declaration.
2596 * gold/target.h (Target::may_relax, Target::relax,
2597 Target::do_may_relax, Target::do_relax): New method definitions.
2598
5e445df6
ILT
25992009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2600
2601 * arm.cc (has_signed_unsigned_overflow): New function.
2602 (Arm_relocate_functions::abs8): New function.
2603 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2604 (Target_arm::Scan::global): Likewise.
2605 (Target_arm::relocate::relocate): Likewise.
2606 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2607 Likewise.
2608
8c604651 26092009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
2610
2611 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2612 * testsuite/Makefile.in: Regenerate.
2613
1e9cc1c2
NC
26142009-09-11 Nick Clifton <nickc@redhat.com>
2615
2616 * po/gold.pot: Updated by the Translation project.
2617
6a89f575
CC
26182009-09-08 Cary Coutant <ccoutant@google.com>
2619
2620 * output.cc (Output_file::open): Add execute permission to empty file.
2621 * testsuite/Makefile.am (permission_test): New test.
2622 * testsuite/Makefile.in: Regenerate.
2623
fdcac5af
ILT
26242009-09-02 Ian Lance Taylor <iant@google.com>
2625
2626 * output.cc (Output_file::resize): Call map_no_anonymous rather
2627 than map.
2628
44453f85
ILT
26292009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2630
2631 * gold.cc: Include "incremental.h".
2632 (queue_initial_tasks): Call Incremental_checker methods.
2633 * incremental.cc: Include "output.h".
2634 (Incremental_checker::can_incrementally_link_output_file): New
2635 method.
2636 * incremental.h (Incremental_checker): New class.
2637
2638 * output.cc (Output_file::open_for_modification): New method.
2639 (Output_file::map_anonymous): Changed return type to bool. Record
2640 map in base_ field.
2641 (Output_file::map_no_anonymous): New method, broken out of map.
2642 (Output_file::map): Use map_no_anonymous and map_anonymous.
2643 * output.h (class Output_file): Update declarations.
2644
293c1386
CC
26452009-08-24 Cary Coutant <ccoutant@google.com>
2646
2647 * options.h (Command_line::Pre_options): New class.
2648 (Command_line::pre_options): New member.
2649 * options.cc (gold::options::ready_to_register): New variable.
2650 (One_option::register_option): Do nothing if not registering options.
2651 Assert if same short option registered twice.
2652 (General_options::General_options): Turn off option registration when
2653 done constructing.
2654 (Command_line::Pre_options::Pre_options): New constructor.
2655
f773f3d2
CC
26562009-08-24 Cary Coutant <ccoutant@google.com>
2657
06a73cfe
CC
2658 * options.h (General_options::no_keep_memory): Remove incorrect
2659 short option.
f773f3d2 2660
a15af8e2
RW
26612009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2662
2663 * Makefile.am (am__skiplex, am__skipyacc): New.
2664 * Makefile.in: Regenerate.
2665
c462b41b
RW
26662009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2667
14ec8efd
RW
2668 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2669 (INCLUDES): ... this.
2670 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2671 (AM_CPPFLAGS): Renamed from ...
2672 (INCLUDE): ... this.
2673 * Makefile.in, testsuite/Makefile.in: Regenerate.
2674
81ecdfbb
RW
2675 * Makefile.in: Regenerate.
2676 * aclocal.m4: Likewise.
2677 * config.in: Likewise.
2678 * configure: Likewise.
2679 * testsuite/Makefile.in: Likewise.
2680
c462b41b
RW
2681 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2682 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2683 * Makefile.in: Regenerate.
2684 * testsuite/Makefile.in: Regenerate.
2685
2da73f13
CC
26862009-08-19 Cary Coutant <ccoutant@google.com>
2687
2688 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2689 symbols in shared libraries overridden by hidden or internal symbols
2690 in the main program.
2691
2db70501
CD
26922009-08-19 Chris Demetriou <cgd@google.com>
2693
2694 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2695 checking source file names in error messages.
2696
f733487b
DK
26972009-08-18 Doug Kwan <dougkwan@google.com>
2698
2699 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2700 an elcpp::Ehdr as parameter. Adjust call to set_target.
2701 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2702 an elfcpp::Ehdr as parameter.
2703 * object.cc (Object::set_target): Remove the version that looks up
2704 a target and sets it.
2705 (Sized_relobj::setup): Take a Target object instead of
2706 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2707 (make_elf_sized_object): Find target and ask target to
2708 make an ELF object.
2709 * object.h: (Object::set_target): Remove the version that looks up
2710 a target and sets it.
2711 (Sized_relobj::setup): Take a Target object instead of
2712 an elfcpp:Ehdr as parameter.
2713 * target.cc: Include dynobj.h.
2714 (Target::do_make_elf_object_implementation): New.
2715 (Target::do_make_elf_object): New.
2716 * target.h (Target::make_elf_object): New template declaration.
2717 (Target::do_make_elf_object): New method declarations.
2718 (Target::do_make_elf_object_implementation): New template declaration.
2719
cc70f101
ILT
27202009-08-14 Ian Lance Taylor <iant@google.com>
2721
2722 * gold.h (FUNCTION_NAME): Define.
2723 (gold_unreachable): Use FUNCTION_NAME.
2724
ef5e0cb1
ST
27252009-08-12 Sriraman Tallam <tmsriram@google.com>
2726
2727 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2728 symbol in the --keep-unique list is not found.
2729
48c187ce
ST
27302009-08-12 Sriraman Tallam <tmsriram@google.com>
2731
2732 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2733 been maked as --keep-unique.
2734 (Icf::unfold_section): New function.
2735 * icf.h (Icf::unfold_section): New function.
2736 * options.h (General_options::keep_unique): New option.
2737 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2738 * testsuite/Makefile.in: Regenerate.
2739 * testsuite/icf_keep_unique_test.sh: New file.
2740 * testsuite/icf_keep_unique_test.cc: New file.
2741
645afe0c
CC
27422009-08-12 Cary Coutant <ccoutant@google.com>
2743
2744 PR 10471
2745 * resolve.cc (Symbol_table::resolve): Check for references from
2746 dynamic objects to hidden and internal symbols.
2747 * testsuite/Makefile.am (hidden_test.sh): New test.
2748 * testsuite/Makefile.in: Regenerate.
2749 * testsuite/hidden_test.sh: New script.
2750 * testsuite/hidden_test_1.c: New test source.
2751 * testsuite/hidden_test_main.c: New test source.
2752
11af873f
DK
27532009-08-11 Doug Kwan <dougkwan@google.com>
2754
2755 * arm.cc: Update comments.
2756 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2757 segment to locate the .ARM.exidx section if present.
2758
b9f7d72d
DK
27592009-08-09 Doug Kwan <dougkwan@google.com>
2760
2761 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2762 patch.
2763
ddd3c53c
ST
27642009-08-07 Sriraman Tallam <tmsriram@google.com>
2765 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2766 compiler warnings.
2767
27721062
ST
27682009-08-06 Sriraman Tallam <tmsriram@google.com>
2769
2770 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2771 valid tls_segment only for non-debug-section relocations.
2772 * testsuite/Makefile.am: Add gc_tls_test.
2773 * testsuite/Makefile.in: Regenerate.
2774 * testsuite/gc_tls_test.cc: New file.
2775 * testsuite/gc_tls_test.sh: New file.
2776
ef15dade
ST
27772009-08-05 Sriraman Tallam <tmsriram@google.com>
2778
2779 * icf.cc: New file.
2780 * icf.h: New file.
2781 * Makefile.am (CCFILES): Add icf.cc.
2782 (HFILES): Add icf.h
2783 * Makefile.in: Regenerate.
2784 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2785 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2786 section, symbol and addend information for the relocs.
2787 * gold.cc (queue_middle_tasks): Call identical code folding.
2788 * gold.h: Add defines for multimap.
2789 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2790 to the call of finalize_local_symbols.
2791 * main.cc (main): Create object of class Icf.
2792 * object.cc (Sized_relobj::do_layout): Allow this function to be
2793 called twice during icf.
2794 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2795 to sections marked as identical by icf.
2796 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2797 when available.
2798 (Sized_relobj::do_section_entsize): New function.
2799 * object.h (Object::section_entsize): New function.
2800 (Object::do_section_entsize): New pure virtual function.
2801 (Relobj::finalize_local_symbols): Add new parameter.
2802 (Relobj::do_section_entsize): New function.
2803 * options.h (General_options::icf): New option.
2804 (General_options::icf_iterations): New option.
2805 (General_options::print_icf_sections): New option.
2806 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2807 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2808 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2809 icf.
2810 * symtab.cc (Symbol_table::is_section_folded): New function.
2811 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2812 to sections marked as identical by icf.
2813 * symtab.h (Symbol_table::set_icf): New function.
2814 (Symbol_table::icf): New function.
2815 (Symbol_table::is_section_folded): New function.
2816 (Symbol_table::icf_): New data member.
2817 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2818 * testsuite/Makefile.am: Add commands to build icf_test.
2819 * testsuite/Makefile.in: Regenerate.
2820 * testsuite/icf_test.sh: New file.
2821 * testsuite/icf_test.cc: New file.
2822
c3b65ac4
CD
28232009-07-24 Chris Demetriou <cgd@google.com>
2824
2825 * layout.cc (is_compressible_debug_section): Fix incorrect
2826 comment about compressed section names.
2827
1caf2c51
ILT
28282009-07-20 Ian Lance Taylor <ian@airs.com>
2829
2830 PR 10419
2831 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2832
1ef4d87f
ILT
28332009-07-16 Ian Lance Taylor <iant@google.com>
2834
2835 PR 10400
2836 * layout.h: #include <map>.
2837 (class Kept_section): Change from struct to class. Add accessors
2838 and setters. Add section size to Comdat_group mapping. Change
2839 Comdat_group to std::map. Add is_comdat_ field. Add
2840 linkonce_size field in union.
2841 (class Layout): Update declaration of find_or_add_kept_section.
2842 Don't declare find_kept_object.
2843 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2844 parameter. Add object, shndx, is_comdat, and is_group_name
2845 parameters. Change all callers. Adjust for new Kept_section.
2846 (Layout::find_kept_object): Remove.
2847 * object.cc (Sized_relobj::include_section_group): Update use of
2848 Kept_section. Rename secnum to shndx. Only record
2849 Kept_comdat_section if sections are the same size.
2850 (Sized_relobj::include_linkonce_section): Update use of
2851 Kept_section. Only record Kept_comdat_section if sections are the
2852 same size. Set size of linkonce section.
2853 (Sized_relobj::map_to_kept_section): Update call to
2854 get_kept_comdat_section.
2855 * object.h (class Sized_relobj): Rename fields in
2856 Kept_comdat_section to drop trailing underscores; change object
2857 field to Relobj*. Change Kept_comdat_section_table to store
2858 struct rather than pointer.
2859 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2860 Add kept_object and kept_shndx parameters. Change all callers.
2861 (Sized_relobj::get_kept_comdat_section): Change return type to
2862 bool. Add kept_object and kept_shndx parameters. Change all
2863 callers.
2864 * plugin.cc (Pluginobj::include_comdat_group): Update call to
2865 Layout::find_or_add_kept_section.
2866
37c3b7b0
ILT
28672009-07-09 Ian Lance Taylor <iant@google.com>
2868
2869 * merge.cc (Object_merge_map::initialize_input_to_output_map):
2870 Reserve space in the hash table.
2871
98fa85cb
ILT
28722009-07-06 Mikolaj Zalewski <mikolajz@google.com>
2873
2874 * fileread.cc (File_read::get_mtime): New method.
2875 * fileread.h (Timespec): New structure.
2876 (File_read::get_mtime): New method.
2877 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2878 Renamed from timestamp_nsec.
2879 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2880 Elf_Xword.
2881 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
2882 timestamp_nsec.
2883 (Incremental_inputs::report_archive): Save mtime; style fix.
2884 (Incremental_inputs::report_obejct): Save mtime; style fix.
2885 (Incremental_inputs::report_script): Save mtime; style fix.
2886 (Incremental_inputs::finalize_inputs): Style fix.
2887 (Incremental_inputs::finalize): Style fix.
2888 (Incremental_inputs::create_input_section_data): Store inputs
2889 mtime.
2890 * incremental.h (Incremental_inputs::report_script): Add mtime
2891 argument.
2892 (Incremental_inputs::Input_info::Input_info): Intialize only one
2893 union member.
2894 (Incremental_inputs::Input_info::archive): Move to nameless
2895 union.
2896 (Incremental_inputs::Input_info::obejct): Move to nameless union.
2897 (Incremental_inputs::Input_info::script): Move to nameless union.
2898 (Incremental_inputs::mtime): New field.
2899 * script.cc (read_input_script): Pass file mtime to
2900 Incremental_input.
2901 * script.h (Script_info::inputs): Style fix.
2902
c9d70757
ILT
29032009-07-01 Ian Lance Taylor <ian@airs.com>
2904
2905 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2906 instead of 32.
2907
9c547ec3
ILT
29082009-06-24 Ian Lance Taylor <iant@google.com>
2909
2910 PR 10156
2911 * layout.cc (Layout::choose_output_section): If we find an
2912 existing section, update the flags.
2913 (Layout::create_notes): New function, broken out of
2914 Layout::finalize.
2915 (Layout::finalize): Don't create note sections.
2916 (Layout::create_note): Don't crash if linker script discards
2917 section.
2918 (Layout::create_gold_note): Likewise.
2919 (Layout::create_build_id): Likewise. Don't set
2920 after_input_sections on the section.
2921 (Layout::create_executable_stack_info): Remove target parameter.
2922 Change caller.
2923 * layout.h (class Layout): Declare create_notes. Update
2924 declaration of create_executable_stack_info.
2925 * gold.cc (queue_middle_tasks): Call create_notes.
2926 * output.cc (Output_section::update_flags_for_input_section): Move
2927 here from output.h. If SHF_ALLOC flag is newly set, mark address
2928 invalid.
2929 * output.h (Output_data::mark_address_invalid): New function.
2930 (class Output_section): Only declare, not define,
2931 update_flags_for_input_section. Remove set_flags.
2932
55458500
ILT
29332009-06-24 Ian Lance Taylor <iant@google.com>
2934
2935 * script-sections.cc (Output_section_definition::
2936 set_section_addresses): Rename shadowing local load_address to
2937 laddr.
2938
1307d6cd
ILT
29392009-06-24 Ian Lance Taylor <iant@google.com>
2940
2941 PR 10244
2942 * reloc.cc (relocate_sections): Skip empty relocation sections.
2943
ec3f783e
ILT
29442009-06-23 Ian Lance Taylor <iant@google.com>
2945
2946 PR 10156
2947 * layout.cc (Layout::create_note): Use choose_output_section
2948 rather than make_output_section.
2949
459c9f1c
ILT
29502009-06-23 Ian Lance Taylor <iant@google.com>
2951
2952 PR 10237
2953 * options.cc (General_options::parse_V): Set printed_version_.
2954 (General_options::General_options): Initialize printed_version_.
2955 * options.h (class General_options): Add printed_version_ field.
2956 * gold.cc (queue_initial_tasks): If there are no input files,
2957 don't give a fatal error if we printed the version information.
2958 (queue_middle_tasks): If using -r with a shared object, give a
2959 fatal error rather than an ordinary error.
2960
1518dc8f
ILT
29612009-06-23 Ian Lance Taylor <iant@google.com>
2962
2963 PR 10219
2964 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
2965 (Layout::make_output_section): Set have_stabstr_section_ if we see
2966 a .stab*str section.
2967 (Layout::finalize): Call link_stabs_sections.
2968 (Layout::link_stabs_sections): New file.
2969 * layout.h (class Layout): Add have_stabstr_section_ field.
2970 Declare link_stabs_sections.
2971
3d857b98
DK
29722009-06-23 Doug Kwan <dougkwan@google.com>
2973
2974 * Makefile.am (libgold_a_LIBADD): New.
2975 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2976 * Makefile.in: Regenerate.
2977 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
2978 * configure: Regenerate.
2979 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
2980 * fileread.cc: Include sys/state.h
2981 * gold.h: Declare memmem and strndup if found missing.
2982 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2983
0639a6f6
ILT
29842009-06-23 Ian Lance Taylor <iant@google.com>
2985
2986 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2987 * configure: Rebuild.
2988
8d63875c
ILT
29892009-06-23 Ian Lance Taylor <iant@google.com>
2990
2991 PR 10147
2992 * object.cc (Object::section_contents): Don't try to get a view if
2993 the section has length zero.
2994 (Object::handle_gnu_warning_section): If the section is empty, use
2995 the name of the section as the warning.
2996
f7c8a183
ILT
29972009-06-23 Ian Lance Taylor <iant@google.com>
2998
2999 PR 10133
3000 * stringpool.h (class Stringpool_template): Add optimize_ field.
3001 (Stringpool_template::set_optimize): New function.
3002 * stringpool.cc (Stringpool_template::Stringpool_template):
3003 Initialize optimize_ field.
3004 (Stringpool_template::set_string_offsets): Test local optimize
3005 fild rather than parameter.
3006 * layout.cc (Layout::Layout): Call set_optimize on the section
3007 name stringpool.
3008
e6a307ba
ILT
30092009-06-22 Ian Lance Taylor <iant@google.com>
3010
3011 PR 10030
3012 * yyscript.y: Parse TARGET.
3013 * script.cc (script_set_target): New function.
3014 * script-c.h (script_set_target): Declare.
3015 * options.cc (General_options::string_to_object_format): Rename
3016 from string_to_object_format in anonymous namespace. Change
3017 callers.
3018 * options.h (class General_options): Declare
3019 string_to_object_format.
3020
3ee173de
ILT
30212009-06-22 Ian Lance Taylor <iant@google.com>
3022
3023 * script-sections.cc (Script_sections::create_segments): Don't put
3024 program headers in a PT_LOAD segment if -n or -N.
3025
30262009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
3027
3028 PR 10141
3029 * options.h (class General_options): Add -z lazy and -z now. Sort
3030 -z options into alphabetical order.
3031 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3032
cd6739a1 30332009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
3034
3035 * layout.cc (Layout::make_output_section): Call
3036 Target::new_output_section.
3037 (Layout::attach_allocated_section_to_segment): Put large section
3038 sections in a separate load segment with the large segment flag
3039 set.
3040 (Layout::segment_precedes): Sort large data segments after other
3041 load segments.
3042 (align_file_offset): New static function.
3043 (Layout::set_segment_offsets): Use align_file_offset.
3044 * output.h (class Output_section): Add is_small_section_ and
3045 is_large_section_ fields.
3046 (Output_section::is_small_section): New function.
3047 (Output_section::set_is_small_section): New function.
3048 (Output_section::is_large_section): New function.
3049 (Output_section::set_is_large_section): New function.
3050 (Output_section::is_large_data_section): New function.
3051 (class Output_segment): Add is_large_data_segment_ field.
3052 (Output_segment::is_large_data_segment): New function.
3053 (Output_segment::set_is_large_data_segment): New function.
3054 * output.cc (Output_section::Output_section): Initialize new
3055 fields.
3056 (Output_segment::Output_segment): Likewise.
3057 (Output_segment::add_output_section): Add assertion that large
3058 data sections always go in large data segments. Force small data
3059 sections to the end of the list of data sections. Force small BSS
3060 sections to the start of the list of BSS sections. For large BSS
3061 sections to the end of the list of BSS sections.
3062 * symtab.h (class Symbol): Declare is_common_shndx.
3063 (Symbol::is_defined): Check Symbol::is_common_shndx.
3064 (Symbol::is_common): Likewise.
3065 (class Symbol_table): Define enum Commons_section_type. Update
3066 declarations. Add small_commons_ and large_commons_ fields.
3067 * symtab.cc (Symbol::is_common_shndx): New function.
3068 (Symbol_table::Symbol_table): Initialize new fields.
3069 (Symbol_table::add_from_object): Put small and large common
3070 symbols in the right list.
3071 (Symbol_table::sized_finalized_symbol): Check
3072 Symbol::is_common_shndx.
3073 (Symbol_table::sized_write_globals): Likewise.
3074 * common.cc (Symbol_table::do_allocate_commons): Allocate new
3075 common symbol lists. Don't call do_allocate_commons_list if the
3076 list is empty.
3077 (Symbol_table::do_allocate_commons_list): Remove is_tls
3078 parameter. Add comons_section_type parameter. Change all
3079 callers. Handle small and large common symbols.
3080 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3081 Symbol::is_common_shndx.
3082 * resolve.cc (symbol_to_bits): Likewise.
3083 * target.h (Target::small_common_shndx): New function.
3084 (Target::small_common_section_flags): New function.
3085 (Target::large_common_shndx): New function.
3086 (Target::large_common_section_flags): New function.
3087 (Target::new_output_section): New function.
3088 (Target::Target_info): Add small_common_shndx, large_common_shndx,
3089 small_common_section_flags, and large_common_section_flags
3090 fields.
3091 (Target::do_new_output_section): New virtual function.
3092 * arm.cc (Target_arm::arm_info): Initialize new fields.
3093 * i386.cc (Target_i386::i386_info): Likewise.
3094 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3095 Likewise.
3096 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3097 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3098 (Target_x86_64::do_new_output_section): New function.
3099 * configure.ac: Define conditional MCMODEL_MEDIUM.
3100 * testsuite/Makefile.am (check_PROGRAMS): Add large.
3101 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3102 (large_LDFLAGS): Define.
3103 * testsuite/large.c: New file.
3104 * testsuite/testfile.cc (Target_test::test_target_info):
3105 Initialize new fields.
3106 * configure, testsuite/Makefile.in: Rebuild.
3107
bb04269c
DK
31082009-06-05 Doug Kwan <dougkwan@google.com>
3109
3110 * Makefile.am (CCFILES): Add target.cc.
3111 * Makefile.in: Regenerate.
3112 * i386.cc (class Target_i386): Define new virtual method to
3113 override do_is_local_label_name in parent.
3114 * object.cc (Sized_relobj::do_count_local_symbols): Discard
3115 local symbols if --discard-locals or -X is given.
3116 * options.h (class General_options): Declare new options
3117 '--discard-locals' and '-X' for discarding locals.
3118 * target.h (class Target): Define new methods is_local_label_name.
3119 Declare new virtual method do_is_local_label_name.
3120 * target.cc: New file.
3121 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3122 (check_SCRIPTS): Add discard_locals_test.sh.
3123 (check_DATA): Add discard_local_tests.syms.
3124 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3125 (discard_local_tests.syms, discard_locals_test.o): New make rules.
3126 * testsuite/Makefile.in: Regenerate.
3127 * testsuite/discard_locals_test.c: New file.
3128 * testsuite/discard_locals_test.sh: Same.
3129
805bb01c
DK
31302009-06-05 Doug Kwan <dougkwan@google.com>
3131
3132 * object.cc (Sized_relobj::Sized_relobj): Initialize
3133 discarded_eh_frame_shndx_ to -1U.
3134 (Sized_relobj::do_layout): Record index of a discard .eh_frame
3135 section.
3136 (Sized_relobj::do_count_local_symbols): Skip local symbols in
3137 a discarded .eh_frame section.
3138 (Sized_relobj::do_finalize_local_symbols): Ditto.
3139 * object.h (class Sized_relobj): Declare new member
3140 discarded_eh_frame_shndx_.
3141 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3142 (local_labels_test.o, local_labels_test): New rules.
3143 * testsuite/Makefile.in: Regenerate.
3144
1dcd334d
DK
31452009-06-04 Doug Kwan <dougkwan@google.com>
3146
3147 * layout.cc (Layout::section_name_mapping): Add mapping for
3148 special ARM sections.
3149
96d49306
DK
31502009-06-03 Doug Kwan <dougkwan@google.com>
3151
3152 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3153 (utils::has_overflow): Same.
3154
dff16297
ILT
31552009-06-03 Ian Lance Taylor <iant@google.com>
3156
3157 * layout.cc (Layout::section_name_mapping): New array, replacing
3158 Layout::linkonce_mapping.
3159 (Layout::section_name_mapping_count): New variable, replacing
3160 Layout::linkonce_mapping_count.
3161 (Layout::linkonce_output_name): Remove.
3162 (Layout::output_section_name): Rewrite.
3163 * layout.h (class Layout): Rename Linkonce_mapping to
3164 Section_name_mapping, linkonce_mapping to section_name_mapping,
3165 linkonce_mapping_count to section_name_mapping_count. Don't
3166 declare linkonce_output_name.
3167
c121c671
DK
31682009-06-03 Doug Kwan <dougkwan@google.com>
3169
3170 * gold/arm.cc (namespace utils): New.
3171 (Target_arm::reloc_is_non_pic): Define new method.
3172 (class Arm_relocate_functions): New.
3173 (Target_arm::Relocate::relocate): Handle relocation types used by
3174 Android.
3175
07800fab
ILT
31762009-06-03 Ian Lance Taylor <iant@google.com>
3177
3178 * arm.cc (Target_arm::scan::global): Use || instead of |.
3179
c121c671
DK
31802009-06-02 Doug Kwan <dougkwan@google.com>
3181
3182 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3183 issued_non_pic_error_.
3184 (class Target_arm::Scan): Declare new method check_non_pic.
3185 Define new method symbol_needs_plt_entry.
3186 Declare new data member issued_non_pic_error_.
3187 (class Target_arm::Relocate): Declare new method
3188 should_apply_static_reloc.
3189 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3190 (Target_arm::Scan::check_non_pic): Define new method.
3191 (Target_arm::Scan::local): Handle a small subset of reloc types used
3192 by Android.
3193 (Target_arm::Scan::local): Same.
3194 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3195
b19b0c6d
ILT
31962009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3197
3198 * incremental.cc (Incremental_inputs::report_command_line): Filter
3199 out --incremental-* options.
3200
94cdfcff
DK
32012009-05-29 Doug Kwan <dougkwan@google.com>
3202
3203 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3204 template class.
3205 (class Target_arm): Update comment.
3206 (Target_arm::Target_arm): Initialize new data members GOT_,
3207 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3208 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3209 and Target_arm::rel_dyn_section.
3210 Declare new_enum Target_arm::Got_type.
3211 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3212 and DYNBSS_.
3213 Update commments for member do_dynsym_value.
3214 (Target_arm::got_size, Target_arm::plt_section,
3215 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3216 new methods inside class defintion.
3217 (Target_arm::got_section): Define new method.
3218 (Target_arm::rel_dyn_section): Same.
3219 (Output_data_plt_arm): New template class.
3220 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3221 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3222 (Output_data_plt_arm::add_entry): Same.
3223 (Output_data_plt_arm::first_plt_entry): Define new
3224 static data member for PLT instruction template.
3225 (Output_data_plt_arm::plt_entry): Same.
3226 (Output_data_plt_arm::do_write): Define new method.
3227 (Target_arm::make_plt_entry): Same.
3228 (Target_arm::do_finalize_sections): Same.
3229 (Target_arm::do_dynsym_value): Same.
3230
4a657b0d
DK
32312009-05-28 Doug Kwan <dougkwan@google.com>
3232
3233 * Makefile.am (TARGETSOURCES): Add arm.cc.
3234 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3235 * Makefile.in: Regenerate.
3236 * arm.cc: New file.
3237 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3238
e7ae8c36
DK
32392009-05-26 Doug Kwan <dougkwan@google.com>
3240
3241 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3242 (General_options::check_excluded_libs): Strip off directories in
3243 archive name before matching like GNU ld does.
3244 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3245 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3246 (exclude_libs_test_LDFLAGS): Add linker option
3247 -Wl,--exclude-libs,libexclude_libs_test_3
3248 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3249 an explicit archive without using -l.
3250 (alt/libexclude_libs_test_3.a): New make rule.
3251 * testsuite/Makefile.in: Regenerate.
3252 * testsuite/exclude_libs_test.c : Declare lib3_default().
3253 (main): Call it.
3254 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3255 * exclude_libs_test_3.c: New file.
3256
f12e7348
NC
32572009-05-26 Nick Clifton <nickc@redhat.com>
3258
3259 * po/id.po: New Indonesian translation.
3260 * po/gold.pot: Updated template file.
3261
4daadc0d
ST
32622009-05-22 Sriraman Tallam <tmsriram@google.com>
3263
3264 * testsuite/Makefile.am: Add -ffunction-sections to compile
3265 gc_comdat_test files. Add -Wl,--gc-sections to build
3266 gc_comdat_test.
3267 * testsuite/Makefile.in: Regenerate.
3268 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3269
531813ad
ST
32702009-05-21 Sriraman Tallam <tmsriram@google.com>
3271
3272 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3273 kept comdat section was garbage collected.
3274 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3275 * testsuite/Makefile.in: Regenerate.
3276 * testsuite/gc_comdat_test.sh: New file.
3277 * testsuite/gc_comdat_test_1.cc: New file.
3278 * testsuite/gc_comdat_test_2.cc: New file.
3279
65514900
CC
32802009-05-19 Doug Kwan <dougkwan@google.com>
3281
3282 * archive.cc (Archive::Archive): Move constructor from archive.h
3283 to here. Initialize no_export_.
3284 (Archive::get_elf_object_for_member): Set no_export flag of object.
3285 * archive.h (Archive::Archive): Move constructor body to
3286 archive.cc.
3287 (Archive::no_export): New method.
3288 (Archive::no_export_): New field.
3289 * object.h (Object::Object): Initialize no_export_ to false.
3290 (Object::no_export, Object::set_no_export): New methods.
3291 (Object::no_export_): New field.
3292 * options.cc (General_options::parse_exclude_libs): New method.
3293 (General_options::check_excluded_libs) Same.
3294 * options.h (exclude_libs): New option.
3295 (General_options::check_excluded_libs): New method declaration.
3296 (General_options::excluded_libs_): New field.
3297 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3298 default or protected visibility if an object has no-export flag set.
3299 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3300 (check_SCRIPTS): Add exclude_libs_test.sh.
3301 (check_DATA): Add exclude_libs_test.syms.
3302 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3303 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3304 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3305 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3306 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3307 libexclude_libs_test_2.a): New rules.
3308 * testsuite/Makefile.in: Regenerate.
3309 * testsuite/exclude_libs_test.c: New file.
3310 * testsuite/exclude_libs_test.sh: Ditto.
3311 * testsuite/exclude_libs_test_1.c: Ditto.
3312 * testsuite/exclude_libs_test_2.c: Ditto.
3313
1b77ea50
ILT
33142009-05-15 Ian Lance Taylor <iant@google.com>
3315
3316 * configure.ac: Check for declarations for cases where libiberty.h
3317 checks HAVE_DECL_xxx.
3318 * configure, config.in: Rebuild.
3319
072fe7ce
ILT
33202009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3321
3322 * gold.h (Incremental_argument_list): Remove (invalid) forward
3323 declaration.
3324 * incremental.cc (Incremental_inputs::report_achive): New method.
3325 (Incremental_inputs::report_object): New method.
3326 (Incremental_inputs::report_script): New method.
3327 (Incremental_inputs::finalize_inputs): New method.
3328 (Incremental_inputs::finalize): Call finalize_inputs().
3329 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3330 Create inputs entries.
3331 * incremental.h (Incremental_input_type): New enum.
3332 (Incremental_inputs::Incremental_input): Initialize new fields.
3333 (Incremental_inputs::report_inputs): New method.
3334 (Incremental_inputs::report_achive): New method.
3335 (Incremental_inputs::report_object): New method.
3336 (Incremental_inputs::report_script): New method.
3337 (Incremental_inputs::finalize_inputs): New method.
3338 (Incremental_inputs::Input_info): New struct.
3339 (Incremental_inputs::Input_info_map): New typedef.
3340 (Incremental_inputs::lock_): New field.
3341 (Incremental_inputs::Inputs_): New field.
3342 (Incremental_inputs::Inputs_map): New field.
3343 * main.cc (main): Call Incremental_input::report_inputs.
3344 * options.h (Input_argument_list): Typedef moved from
3345 Input_arguments.
3346 (Input_file_group::Files): Remove, use ::Input_argument_list.
3347 (Input_file_group::Input_argument_list): Remove, use
3348 ::Input_argument_list.
3349 * plugin.cc (Plugin_manager::add_input_file): Add error in
3350 incremental build.
3351 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3352 functions.
3353 * script.cc (read_input_script): Call
3354 Incremental_input::report_script.
3355 * script.h (Script_info): New class.
3356
b0481b0b
ILT
33572009-04-27 Ian Lance Taylor <iant@google.com>
3358
3359 * x86_64.cc (do_adjust_output_section): Set entsize to
3360 plt_entry_size.
3361
b22a5a41 33622009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
3363
3364 * output.cc (Output_file::close): After short writes, continue
3365 writing from the correct offset in the buffer being written.
3366
40fde488
CD
33672009-04-23 Chris Demetriou <cgd@google.com>
3368
3369 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3370 * configure: Regenerate.
3371 * config.in: Regenerate.
3372 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3373 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3374
3ce2c28e
ILT
33752009-04-21 Mikolaj Zalewski <mikolajz@google.com>
3376
3377 * incremental.cc (Incremental_inputs_header_data): Renamed from
3378 Incremental_input_header_data.
3379 (Incremental_inputs_header_data::data_size): New field.
3380 (Incremental_inputs_header_data::put_input_file_count): Renamed
3381 from input_file_count.
3382 (Incremental_inputs_header_data::put_command_line_offset): Renamed
3383 from command_line_offset.
3384 (Incremental_inputs_header_data::put_reserved): Renamed from
3385 put_reserved.
3386 (Incremental_inputs_entry_data): Renamed from
3387 Incremental_input_entry_data.
3388 (Incremental_inputs_entry_data::data_size): New field.
3389 (Incremental_inputs::report_command_line): New method.
3390 (Incremental_inputs::finalize): New method.
3391 (Incremental_inputs::create_incremental_inputs_data): New method.
3392 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3393 * incremental.h: New file.
3394 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3395 (Layout::finalize): Create incremental inputs section in
3396 incremental builds.
3397 (Layout::create_incremental_info_sections): New method.
3398 * layout.h (Layout::incremental_inputs): New method.
3399 (Layout::create_incremental_info_sections): New method.
3400 (Layout::incremental_inputs_): New field.
3401 * main.cc (main): Notify Incremental_input of the command line.
3402
e55bde5e
ILT
34032009-04-01 Ian Lance Taylor <iant@google.com>
3404 Mikolaj Zalewski <mikolajz@google.com>
3405
3406 * gold.h (reserve_unordered_map): Define, three versions, one for
3407 each version of Unordered_map.
3408 * layout.cc (Layout::Layout): Remove options parameter. Add
3409 number_of_input_files parameter. Don't initialize options_.
3410 Initialize number_of_input_files_ and resized_signatures_. Move
3411 sections_are_attached_.
3412 (Layout::layout_group): Reserve space for group_signatures_.
3413 (Layout::find_or_add_kept_section): Change name parameter to be a
3414 reference. Resize signatures_ map when it gets large enough.
3415 (Layout::layout_eh_frame): Use parameters->options() instead of
3416 this->options_.
3417 (Layout::make_output_section): Likewise.
3418 (Layout::attach_allocated_section_to_segment): Likewise.
3419 (Layout::finalize, Layout::create_executable_stack): Likewise.
3420 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3421 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3422 * layout.h (class Layout): Update declarations. Remove options_
3423 field. Add number_of_input_files_ and resized_signatures_
3424 fields. Move sections_are_attached_ field.
3425 * main.cc (main): Pass number of input files to Layout
3426 constructor. Don't pass options.
3427
154b857c
ILT
34282009-03-30 Ian Lance Taylor <iant@google.com>
3429
3430 * ffsll.c (ffsll): Correct implementation.
3431
2f35ab9b
ILT
34322009-03-27 Ian Lance Taylor <iant@google.com>
3433
fd03461a
ILT
3434 * ffsll.c: New file.
3435 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3436 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3437 * ftruncate.c (ftruncate): Declare before definition.
3438 * mremap.c (mremap): Likewise.
3439 * pread.c (pread): Likewise.
3440 * configure, Makefile.in, config.in: Rebuild.
3441
2f35ab9b
ILT
3442 * mremap.c: New file.
3443 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3444 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3445 (mremap): Declare if HAVE_MREMAP is not defined.
3446 * configure, Makefile.in, config.in: Rebuild.
3447
33aea2fd
CC
34482009-03-27 Cary Coutant <ccoutant@google.com>
3449
3450 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3451 position independent.
3452 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3453 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3454
6d479619
CC
34552009-03-24 Cary Coutant <ccoutant@google.com>
3456
3457 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3458 an executable.
3459 (needs_dynamic_reloc): Likewise.
3460
afc06bb8
ILT
34612009-03-24 Ian Lance Taylor <iant@google.com>
3462
3463 * yyscript.y (file_cmd): Recognize EXTERN.
3464 (extern_name_list, extern_name_list_body): New nonterminals.
3465 * script.cc (script_add_extern): Define.
3466 * script-c.h (script_add_extern): Declare.
3467
f6060a4d
ILT
34682009-03-24 Rafael Avila de Espindola <espindola@google.com>
3469
3470 * object.cc (is_elf_object): Define.
3471 * object.h (is_elf_object): Declare.
3472 * archive.cc (Archive::get_elf_object_for_member): Call
3473 is_elf_object.
33aea2fd 3474 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 3475
26736d8e
ILT
34762009-03-24 Elliott Hughes <enh@google.com>
3477
3478 * output.cc (Output_file::map_anonymous): Define.
3479 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3480 try an anonymous one. Report the size if the mmap fails.
3481 * output.h (class Output_file): Declare map_anonymous.
3482
22fd9730
ILT
34832009-03-24 Ian Lance Taylor <iant@google.com>
3484
3485 * target-select.cc (instantiate_target): Don't acquire the lock if
3486 the instantiated_target_ field has already been set.
3487
cb010894
ILT
34882009-03-23 Ian Lance Taylor <iant@google.com>
3489
7f055c20
ILT
3490 * gold-threads.h (class Initialize_lock): Define.
3491 * gold-threads.cc (class Initialize_lock_once): Define.
3492 (initialize_lock_control): New static variable.
3493 (initialize_lock_pointer): New static variable.
3494 (initialize_lock_once): New static function.
3495 (Initialize_lock::Initialize_lock): Define.
3496 (Initialize_lock::initialize): Define.
3497 * target-select.h: Include "gold-threads.h".
3498 (class Target_selector): Add lock_ and initialize_lock_ fields.
3499 Don't define instantiate_target, just declare it.
3500 * target-select.cc (Target_selector::Target_selector): Initialize
3501 new fields.
3502 (Target_selector::instantiate_target): Define.
3503 * descriptors.h: Include "gold-threads.h".
3504 (class Descriptors): Add initialize_lock_ field.
3505 * descriptors.cc (Descriptors::Descriptors): Initialize new
3506 field.
3507 (Descriptors::open): Use initialize_lock_ field
3508 * errors.h (class Errors): Add initialize_lock_ field.
3509 * errors.cc (Errors::Errors): Initialize new field.
3510 (Errors::initialize_lock): Use initialize_lock_ field.
3511 * powerpc.cc (class Target_selector_powerpc): Remove
3512 instantiated_target_ field. In do_recognize call
3513 instantiate_target rather than do_instantiate_target. In
3514 do_instantiate_target just allocate a new target.
3515 * sparc.cc (class Target_selector_sparc): Likewise.
3516
36959681
ILT
3517 * freebsd.h: New file.
3518 * i386.cc: Include "freebsd.h".
3519 (Target_i386): Derive from Target_freebsd rather than
3520 Sized_target.
3521 (Target_selector_i386): Derive from Target_selector_freebsd rather
3522 than Target_selector.
3523 * x86_64.cc: Include "freebsd.h".
3524 (Target_x86_64): Derive from Target_freebsd rather than
3525 Sized_target.
3526 (Target_selector_x86_64): Derive from Target_selector_freebsd
3527 rather than Target_selector.
3528 * target.h (class Target): Add adjust_elf_header and
3529 do_adjust_elf_header.
3530 * output.cc (Output_file_header:: do_sized_write): Call target
3531 adjust_elf_header routine.
3532 * configure.tgt: Set targ_osabi.
3533 * configure.ac: Define GOLD_DEFAULT_OSABI.
3534 * parameters.cc (Parameters::default_target): Pass
3535 GOLD_DEFAULT_OSABI to select_target.
3536 * target-select.h (class Target_selector): Make instantiate_target
3537 protected rather than private.
3538 * Makefile.am (HFILES): Add freebsd.h.
3539 * configure, Makefile.in, config.in: Rebuild.
3540
cb010894
ILT
3541 * merge.cc (do_add_input_section): Correct pend value. Change
3542 message about last entry not being null terminated from error to
3543 warning.
3544
0e879927
ILT
35452009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3546
3547 * incremental.cc: New file.
3548 * Makefile.am (CCFILES): Add incremental.cc.
3549 * Makefile.in: Rebuild.
3550
41105937
PP
35512009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3552
3553 * layout.cc (Layout::output_section_name): Preserve names
3554 of '.note.' sections.
3555
60439920
ILT
35562009-03-19 Ian Lance Taylor <iant@google.com>
3557
3558 * descriptors.cc (Descriptors::open): Check that the options are
3559 valid before using them.
3560
0d371ad3
ILT
35612009-03-18 Ian Lance Taylor <iant@google.com>
3562
3563 * script-sections.h: Include <list>.
3564 (class Script_sections): Change Sections_elements from std::vector
3565 to std::list. Typedef public Elements_iterator. Add
3566 orphan_section_placement_, data_segment_align_start_, and
3567 saw_data_segment_align_ fields. Remove data_segment_align_index_
3568 field.
3569 * script-sections.cc (class Orphan_section_placement): New class.
3570 (class Sections_element): Add virtual functions is_relro and
3571 orphan_section_init. Remove virtual function place_orphan_here.
3572 (class Output_section_definition): Add is_relro and
3573 orphan_section_init. Remove place_orphan_here.
3574 (class Orphan_output_section): Likewise.
3575 (Script_sections::Script_sections): Update for field changes.
3576 (Script_sections::data_segment_align): Set saw_data_segment_align_
3577 and data_segment_align_start_, not data_segment_align_index.
3578 (Script_sections::data_segment_relro_end): Check
3579 saw_data_segment_align_. Use data_segment_align_start_ rather
3580 than data_segment_align_index_.
3581 (Script_sections::place_orphan): Rewrite to use
3582 Orphan_section_placement.
3583
9201d894
ILT
35842009-03-17 Ian Lance Taylor <iant@google.com>
3585
9c5b8369
ILT
3586 * archive.cc (Archive::add_symbols): Check for a version attached
3587 to the symbol name in the archive map.
3588 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3589 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3590 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3591 (ver_test_11.a): New target.
3592 * testsuite/Makefile.in: Rebuild.
3593
9201d894
ILT
3594 * configure.ac: Check for chsize and posix_fallocate. Replace
3595 ftruncate.
3596 * ftruncate.c: New file, from gnulib.
3597 * output.cc (posix_fallocate): Define dummy version if not
3598 HAVE_POSIX_FALLOCATE.
3599 (Output_file::map): Call posix_fallocate rather than lseek and
3600 write.
3601 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3602 * configure, Makefile.in, config.in: Rebuild.
3603
ef4ab7a8
PP
36042009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3605
3606 * layout.h (Layout::create_note): Add section_name parameter.
3607 * layout.cc (Layout::create_note): Likewise.
3608 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3609
8c500701
ILT
36102009-03-17 Ian Lance Taylor <iant@google.com>
3611
e85b18e1
ILT
3612 * descriptors.cc: Include "options.h".
3613 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3614 (Descriptors::open): Always use O_CLOEXEC when opening a new
3615 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3616 then set FD_CLOEXEC.
3617
9efe6174
ILT
3618 * sparc.cc (class Target_sparc): Add has_got_section.
3619 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3620 make sure we have a GOT section.
3621
3622 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3623 (Target_sparc::Scan::local): Likewise.
3624 (Target_sparc::Scan::global): Likewise.
3625 (Target_sparc::Relocate::relocate): Likewise.
3626 (Target_sparc::Relocate::relocate_tls): Likewise.
3627
8c500701
ILT
3628 * symtab.cc (Symbol_table::define_default_version): New function,
3629 broken out of add_from_object.
3630 (Symbol_table::add_from_object): Call define_default_version.
3631 (Symbol_table::define_special_symbol): Add resolve_oldsym
3632 parameter. Change all callers. If the version for a symbol comes
3633 from a version script, resolve it with the symbol with the same
3634 name with no version. Also add the symbol without a version if
3635 appropriate.
3636 (do_define_in_output_data): If resolving with oldsym, don't delete
3637 sym.
3638 (do_define_in_output_segment): Likewise.
3639 (do_define_as_constant): Likewise.
3640 * symtab.h (class Symbol_table): Update declarations.
3641
f1ed28fb
ILT
36422009-03-13 Ian Lance Taylor <iant@google.com>
3643
15f8229b
ILT
3644 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3645 (Read_symbols::requeue): New function.
3646 (Read_symbols::do_read_symbols): If make_elf_object fails because
3647 the target type is not configured, and the file was searched for,
3648 issue a warning and retry with the next directory.
3649 (Add_symbols::run): If the file has an incompatible format, and
3650 it was searched for, requeue the Read_symbols task. On error,
3651 release the object.
3652 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3653 dirindex parameter to constructor. Change all callers. Declare
3654 incompatible_warning and requeue.
3655 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3656 input_argument_ and input_group_ fields. Add them to
3657 constructor. Change all callers.
3658 (class Read_script): Add dirindex_ field. Add it to constructor.
3659 Change all callers.
3660 * archive.cc (Archive::setup): Remove input_objects parameter.
3661 Change all callers.
3662 (Archive::get_file_and_offset): Likewise.
3663 (Archive::read_all_symbols): Likewise.
3664 (Archive::read_symbols): Likewise.
3665 (Archive::get_elf_object_for_member): Remove input_objects
3666 parameter. Add punconfigured parameter. Change all callers.
3667 (Archive::add_symbols): Change return type to bool. Check return
3668 value of include_member.
3669 (Archive::include_all_members): Likewise.
3670 (Archive::include_member): Change return type to bool. Return
3671 false if first included object has incompatible target. Set
3672 included_member_ field.
3673 (Add_archive_symbols::run): If add_symbols returns false, requeue
3674 Read_symbols task.
3675 * archive.h (class Archive): Add included_member_ field.
3676 Initialize it in constructor. Add input_file and searched_for
3677 methods. Update declarations.
3678 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3679 input_argument_ fields. Add them to constructor. Change all
3680 callers.
3681 * script.cc: Include "target-select.h".
3682 (class Parser_closure): Add skip_on_incompatible_target_ and
3683 found_incompatible_target_ fields. Add
3684 skip_on_incompatible_target parameter to constructor. Change all
3685 callers. Add methods skip_on_incompatible_target,
3686 clear_skip_on_incompatible_target, found_incompatible_target, and
3687 set_found_incompatible_target.
3688 (read_input_script): Add dirindex parameter. Change all callers.
3689 If parser finds an incompatible target, requeue Read_symbols
3690 task.
3691 (script_set_symbol): Clear skip_on_incompatible_target in
3692 closure.
3693 (script_add_assertion, script_parse_option): Likewise.
3694 (script_start_sections, script_add_phdr): Likewise.
3695 (script_check_output_format): New function.
3696 * script.h (read_input_script): Update declaration.
3697 * script-c.h (script_check_output_format): Declare.
3698 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3699 (ignore_cmd): Remove OUTPUT_FORMAT.
3700 * fileread.cc (Input_file::Input_file): Add explicit this.
3701 (Input_file::will_search_for): New function.
3702 (Input_file::open): Add pindex parameter. Change all callers.
3703 * fileread.h (class Input_file): Add input_file_argument method.
3704 Declare will_search_for. Update declarations.
3705 * object.cc (make_elf_object): Add punconfigured parameter.
3706 Change all callers.
3707 * object.h (class Object): Make input_file public. Add
3708 searched_for method.
3709 (make_elf_object): Update declaration.
3710 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3711 restart search.
3712 * dirsearch.h (class Dirsearch): Update declaration.
3713 * options.h (class General_options): Add --warn-search-mismatch.
3714 * parameters.cc (Parameters::is_compatible_target): New function.
3715 * parameters.h (class Parameters): Declare is_compatible_target.
3716 * workqueue.cc (Workqueue::add_blocker): New function.
3717 * workqueue.h (class Workqueue): Declare add_blocker.
3718
f1ed28fb
ILT
3719 * fileread.cc (Input_file::open): Remove options parameter.
3720 Change all callers.
3721 (Input_file::open_binary): Likewise.
3722 * script.cc (read_input_script): Likewise.
3723 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3724 options parameter from constructor. Change all callers.
3725 (class Read_script): Likewise.
3726 * fileread.h (class Input_file): Update declarations.
3727 * script.h (read_input_script): Update declaration.
3728
34dd024a
NC
37292009-03-10 Nick Clifton <nickc@redhat.com>
3730
3731 * po/es.po: New Spanish translation.
3732
6d71b17c
CC
37332009-03-06 Cary Coutant <ccoutant@google.com>
3734
3735 * options.cc (parse_short_option): Keep dash_z from registering itself.
3736
031cdbed
ILT
37372009-03-03 Ian Lance Taylor <iant@google.com>
3738
3739 PR 9918
3740 * target-reloc.h (relocate_section): Pass output_section to
3741 relocate.
3742 * i386.cc (Target_i386::should_apply_static_reloc): Add
3743 output_section parameter. Change all callers.
3744 (Target_i386::Relocate::relocate): Add output_section parameter.
3745 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3746 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3747 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3748 * testsuite/two_file_shared.sh: New script.
3749 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3750 (check_DATA): Add two_file_shared.dbg.
3751 (two_file_shared.dbg): New target.
3752 * testsuite/Makefile.in: Rebuild.
3753
15d5fa16
ILT
37542009-03-01 Ian Lance Taylor <iant@google.com>
3755
3756 * configure.ac: Check for byteswap.h.
3757 * configure: Rebuild.
3758 * config.in: Rebuild.
3759
8a4c0b0d
ILT
37602009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3761
3762 * layout.cc (Layout::find_or_add_kept_section): New function.
3763 (Layout::add_comdat): Removed.
3764 * layout.h (struct Kept_section): Move out of class Layout.
3765 Remove trailing underscores from field names. Add group_sections
3766 field. Rename group_ field to is_group. Change all uses.
3767 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3768 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3769 comdat_groups_ field.
3770 (Sized_relobj::include_section_group): Use
3771 find_or_add_kept_section and Kept_section::group_sections.
3772 (Sized_relobj::include_linkonce_section): Likewise.
3773 * object.cc (class Sized_relobj): Don't define Comdat_group or
3774 Comdat_group_table. Remove find_comdat_group and
3775 add_comdat_group. Remove comdat_groups_ field.
3776 * plugin.cc (include_comdat_group): Use
3777 Layout::find_or_add_kept_section.
3778
b4ecf66b
ILT
37792009-02-28 Ian Lance Taylor <iant@google.com>
3780
14359ca0
ILT
3781 * README: --gc-sections and map files are now supported. Document
3782 some build requirements.
3783
b4ecf66b
ILT
3784 PR 6992
3785 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3786 relocatable link set the value of the section symbol to zero.
3787 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3788 relocatable link don't include the section address in the local
3789 symbol value.
3790
0602e05a
ILT
37912009-02-27 Ian Lance Taylor <iant@google.com>
3792
fd9d194f
ILT
3793 PR 6811
3794 * options.h (class Search_directory): Add is_system_directory.
3795 (class General_options): Declare is_in_system_directory.
3796 * options.cc (get_relative_sysroot): Make static.
3797 (get_default_sysroot): Make static.
3798 (General_optoins::is_in_system_directory): New function.
3799 * fileread.cc (Input_file::is_in_system_directory): New function.
3800 * fileread.h (class Input_file): Declare is_in_system_directory.
3801 * object.h (class Object): Add is_in_system_directory.
3802 (class Input_objects): Remove system_library_directory_ field.
3803 * object.cc (Input_objects::add_object): Don't set
3804 system_library_directory_.
3805 (input_objects::found_in_system_library_directory): Remove.
3806 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3807 parameter. Change all callers.
3808 (Symbol_table::sized_write_globals): Likewise.
3809 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3810 Call Object::is_in_system_directory.
3811 * symtab.h (class Symbol_table): Update declarations.
3812
61edd21f
ILT
3813 PR 5990
3814 * descriptors.h (Open_descriptor): Add is_on_stack field.
3815 * descriptors.cc (Descriptors::open): If the descriptor is on the
3816 top of the stack, remove it. Initialize is_on_stack field.
3817 (Descriptors::release): Only add pod to stack if it is not on the
3818 stack already.
3819 (Descriptors::close_some_descriptor): Clear stack_next and
3820 is_on_stack fields.
3821
e29e076a
ILT
3822 PR 7091
3823 * output.cc (Output_section::find_starting_output_address): Rename
3824 from starting_output_address; add PADDR parameter; change return
3825 type.
3826 * output.h (class Output_section): Declare
3827 find_starting_output_address instead of starting_output_address.
3828 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3829 section symbol for which we can't find a merge section.
3830
0602e05a
ILT
3831 PR 9836
3832 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3833 hidden or internal, force the symbol to be local.
3834 * resolve.cc (Symbol::override_visibility): Define.
3835 (Symbol::override_base): Use override_visibility.
3836 (Symbol_table::resolve): Likewise.
3837 (Symbol::override_base_with_special): Likewise.
3838 (Symbol_table::override_with_special): If the visibility is hidden
3839 or internal, force the symbol to be local.
3840 * symtab.h (class Symbol): Add set_visibility and
3841 override_visibility.
3842 * testsuite/ver_test_1.sh: New file.
3843 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3844 (check_DATA): Add ver_test_1.syms.
3845 (ver_test_1.syms): New target.
3846 * testsuite/Makefile.in: Rebuild.
3847
401a9a73
CC
38482009-02-25 Cary Coutant <ccoutant@google.com>
3849
3850 * layout.cc (Layout::choose_output_section): Don't rename sections
3851 when using a linker script that has a SECTIONS clause.
3852 * Makefile.in: Regenerate.
3853
3854 * testsuite/Makefile.am (script_test_5.sh): New test case.
3855 * testsuite/Makefile.in: Regenerate.
3856 * testsuite/script_test_5.cc: New file.
3857 * testsuite/script_test_5.sh: New file.
3858 * testsuite/script_test_5.t: New file.
3859
f488e4b0
CC
38602009-02-13 Rafael Avila de Espindola <espindola@google.com>
3861
3862 * archive.cc (Archive::include_member): Update calls to add_symbols.
3863 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3864 the Layout argument.
3865 * dynobj.h (do_add_symbols): Add the Layout argument.
3866 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3867 Layout argument.
3868 * object.h (Object::add_symbols): Add the Layout argument.
3869 (Object::do_add_symbols): Add the Layout argument.
3870 (Sized_relobj::do_add_symbols): Add the Layout argument.
3871 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3872 Unify the two versions.
3873 (Add_plugin_symbols): Remove.
3874 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3875 (Sized_pluginobj::do_add_symbols): Unify the two versions.
3876 (Add_plugin_symbols): Remove.
3877 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3878 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3879 (Add_symbols::run): Make it work with Pulginobj.
3880
89dd1680
ILT
38812009-02-06 Ian Lance Taylor <iant@google.com>
3882
3883 * object.cc (Sized_relobj::do_layout): Make info message start
3884 with lower case letter.
3885
266d0a74
ILT
38862009-02-06 Mikolaj Zalewski <mikolajz@google.com>
3887
602b464e
ILT
3888 * binary.cc: Fix file comment.
3889
266d0a74
ILT
3890 * options.h (enum Incremental_disposition): Define.
3891 (class General_options): Add new options: --incremental,
3892 --incremental_changed, --incremental_unchanged,
3893 --incremental_unknown. Add incremental_disposition_ and
3894 implicit_incremental_ fields.
3895 (General_options::incremental_disposition): New function.
3896 (class Position_dependent_options): Add incremental_disposition
3897 option.
3898 (Position_dependent_options::copy_from_options): Set incremental
3899 dispositions.
3900 * options.cc (General_options::parse_incremental_changed): New
3901 function.
3902 (General_options::parse_incremental_unchanged): New function.
3903 (General_options::parse_incremental_unknown): New function.
3904 (General_options::General_options): Initialize new fields
3905 incremental_disposition_ and implicit_incremental_.
3906 (General_options::finalize): Check for uasge of --incremental-*
3907 without --incremental.
3908
f073bbf7
CD
39092009-02-06 Chris Demetriou <cgd@google.com>
3910
3911 * gold.h (gold_undefined_symbol): Change to take only a Symbol
3912 pointer and to report location as the file name associated with
3913 the symbol.
3914 (gold_undefined_symbol_at_location): New function to replace the
3915 old gold_undefined_symbol functionality.
3916 * target-reloc.h (relocate_section): Update to use
3917 gold_undefined_symbol_at_location.
3918 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3919 Call gold_undefined_symbol function rather than gold_error.
3920 * errors.h (Errors::undefined_symbol): Take location as a
3921 string, rather than calculating it from a relocation.
3922 * errors.cc (Errors::fatal): Print "fatal error:" before the
3923 formatted message.
3924 (Errors::error, Errors::error_at_location): Print "error: "
3925 before the formatted message.
3926 (Errors::undefined_symbol): Take location as a string, rather
3927 than calculating it from a relocation.
3928 (gold_undefined_symbol_at_location): New function akin to
3929 old gold_undefined_symbol, calculates location from relocation.
3930 (gold_undefined_symbol): Change to take only a Symbol pointer
3931 and to report location as the file name associated with the symbol.
3932 * testsuite/debug_msg.sh: Update for changed error messages.
3933 * testsuite/undef_symbol.sh: Likewise.
3934
8e94a90c
ILT
39352009-02-04 Duncan Sands <baldrick@free.fr>
3936
3937 PR 9812
3938 * reduced_debug_output.h
3939 (Output_reduced_debug_abbrev_section::failed): Use format for
3940 gold_warning.
3941 (Output_reduced_debug_info_section::faild): Likewise.
3942
88a0e15b
ILT
39432009-01-31 Mikolaj Zalewski <mikolajz@google.com>
3944
3945 * script.cc (Lazy_demangler): New class.
3946 (Version_script_info::get_symbol_version_helper): Demangle a
3947 symbol only once.
3948
5efc7cd2
CC
39492009-01-29 Cary Coutant <ccoutant@google.com>
3950
3951 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
3952 to __tls_get_addr.
3953 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3954
e0ebcf42
ILT
39552009-01-28 Ian Lance Taylor <iant@google.com>
3956
5efc7cd2 3957 * version.cc (version_string): Bump to 1.9.
75fe7426 3958
e0ebcf42
ILT
3959 * gold.h: Include <cstring> and <stdint.h>.
3960 * version.cc: Include <cstdio>.
3961 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
3962 warning.
3963 * reduced_debug_output.cc (insert_into_vector): Rename from
3964 Insert_into_vector; change all callers. Use Swap_unaligned to
3965 avoid aliasing issue; remove union since it is unnecessary.
3966
8e2813be 39672009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
3968
3969 * Makefile.am (CCFILES): Add gc.cc.
3970 (HFILES): Add gc.h.
3971 * Makefile.in: Regenerate.
3972 * gold.cc (Gc_runner): New class.
3973 (queue_initial_tasks): Call garbage collection related tasks
3974 when corresponding options are invoked.
3975 (queue_middle_gc_tasks): New function.
3976 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
3977 processed early before laying out sections during garbage collection.
3978 * gold.h (queue_middle_gc_tasks): New function.
3979 (is_prefix_of): Move from "layout.cc".
3980 * i386.cc (Target_i386::gc_process_relocs): New function.
3981 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
3982 * main.cc (main): Create object of class "Garbage_collection".
3983 * object.cc (Relobj::copy_symbols_data): New function.
3984 (Relobj::is_section_name_included): New function.
3985 (Sized_relobj::do_layout): Allow this function to be called twice
3986 during garbage collection and defer layout of section during the
3987 first call.
3988 * object.h (Relobj::get_symbols_data): New function.
3989 (Relobj::is_section_name_included): New function.
3990 (Relobj::copy_symbols_data): New function.
3991 (Relobj::set_symbols_data): New function.
3992 (Relobj::get_relocs_data): New function.
3993 (Relobj::set_relocs_data): New function.
3994 (Relobj::is_output_section_offset_invalid): New pure virtual function.
3995 (Relobj::gc_process_relocs): New function.
3996 (Relobj::do_gc_process_relocs): New pure virtual function.
3997 (Relobj::sd_): New data member.
3998 (Sized_relobj::is_output_section_offset_invalid): New function.
3999 (Sized_relobj::do_gc_process_relocs): New function.
4000 * options.h (General_options::gc_sections): Modify to not be a no-op.
4001 (General_options::print_gc_sections): New option.
4002 * plugin.cc (Plugin_finish::run): Remove function call to
4003 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
4004 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4005 * reloc.cc (Read_relocs::run): Add task to process relocs and
4006 determine unreferenced sections when doing garbage collection.
4007 (Gc_process_relocs): New class.
4008 (Sized_relobj::do_gc_process_relocs): New function.
4009 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4010 sections that are garbage collected.
4011 * reloc.h (Gc_process_relocs): New class.
4012 * sparc.cc (Target_sparc::gc_process_relocs): New function.
4013 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4014 symbols whose corresponding sections are garbage collected.
4015 (Symbol_table::Symbol_table): Add new parameter for the garbage
4016 collection object.
4017 (Symbol_table::gc_mark_undef_symbols): New function.
4018 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4019 (Symbol_table::gc_mark_dyn_syms): New function.
4020 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4021 as garbage.
4022 (Symbol_table::add_from_object): Likewise.
4023 (Symbol_table::add_from_relobj): When building shared objects, do not
4024 treat externally visible symbols as garbage.
4025 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4026 table information for static and relocatable links.
4027 * symtab.h (Symbol_table::set_gc): New function.
4028 (Symbol_table::gc): New function.
4029 (Symbol_table::gc_mark_undef_symbols): New function.
4030 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4031 (Symbol_table::gc_mark_dyn_syms): New function.
4032 (Symbol_table::gc_): New data member.
4033 * target.h (Sized_target::gc_process_relocs): New pure virtual
4034 function.
4035 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4036 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4037
3b293544
CF
40382009-01-20 Chris Faylor <me.sourceware@sourceware.org>
4039
4040 * options.h (General_options::gc_sections): Define as a no-op for now.
4041 (General_options::no_keep_memory): Ditto.
4042 (General_options::Bshareable): Define.
4043 * options.cc (General_options::finalize): Honor -Bshareable.
4044
83d22aa8
AS
40452009-01-20 Andreas Schwab <schwab@suse.de>
4046
4047 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4048 read the value in the contents, since we don't use it. Use the
4049 template endianness when writing.
4050 (Relocate::relocate): Use it for R_PPC_REL16_HA.
4051
cd536b21
AS
40522009-01-19 Andreas Schwab <schwab@suse.de>
4053
4054 * configure.tgt (powerpc64-*): Fix targ_obj.
4055
99e9a495
ILT
40562009-01-15 Ian Lance Taylor <iant@google.com>
4057
4058 * object.cc (Sized_relobj::write_local_symbols): Don't write out
4059 local symbols when stripping all symbols.
4060
bbbfea06
CC
40612009-01-14 Cary Coutant <ccoutant@google.com>
4062
99e9a495 4063 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 4064
0f7c0701
CC
40652009-01-14 Cary Coutant <ccoutant@google.com>
4066
4067 * archive.cc (Archive::get_elf_object_for_member): Remove call
4068 to File_read::claim_for_plugin.
4069 * descriptors.cc (Descriptors::open): Remove reference to
4070 is_claimed.
4071 (Descriptors::claim_for_plugin): Remove.
4072 * descriptors.h (Descriptors::claim_for_plugin): Remove.
4073 (Descriptors::is_claimed): Remove.
4074 (claim_descriptor_for_plugin): Remove.
4075 * fileread.cc (File_read::claim_for_plugin): Remove.
4076 * fileread.h (File_read::claim_for_plugin): Remove.
4077 (File_read::descriptor): Reopen descriptor if necessary.
4078 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
4079 (Plugin_manager::all_symbols_read): Add task parameter. Change
4080 all callers.
4081 (Plugin_manager::get_input_file): New function.
4082 (Plugin_manager::release_input_file): New function.
4083 (Pluginobj::Pluginobj): Add filesize parameter and initialize
4084 corresponding data member.
4085 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4086 and pass to base constructor. Change all callers.
4087 (get_input_file, release_input_file): New functions.
4088 (make_sized_plugin_object): Add filesize parameter. Change all callers.
4089 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4090 (Plugin_manager::all_symbols_read): Add task parameter.
4091 (Plugin_manager::get_input_file): New function.
4092 (Plugin_manager::release_input_file): New function.
4093 (Plugin_manager::task_): New data member.
4094 (Pluginobj::Pluginobj): Add filesize parameter.
4095 (Pluginobj::filename): New function.
4096 (Pluginobj::descriptor): New function.
4097 (Pluginobj::filesize): New function.
4098 (Pluginobj::filesize_): New data member.
4099 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4100 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4101 File_read::claim_for_plugin; use Object::unlock to unlock the file.
4102
4103 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4104 with archive libraries.
4105 * testsuite/Makefile.in: Regenerate.
4106 * testsuite/plugin_test.c (struct sym_info): New type.
4107 (get_input_file, release_input_file): New static variables.
4108 (onload): Capture new transfer vector entries.
4109 (claim_file_hook): Stop reading at end of file according to filesize.
4110 Factor out parsing of readelf output into separate function.
4111 (all_symbols_read_hook): Exercise get_input_file and release_input_file
4112 APIs and get the source file name from the symbol table. Convert
4113 source file name to corresponding object file name. Print info
4114 message when adding new input files.
4115 (parse_readelf_line): New function.
4116 * testsuite/plugin_test_1.sh: Add checks for new info messages.
4117 * testsuite/plugin_test_2.sh: Likewise.
4118 * testsuite/plugin_test_3.sh: Likewise.
4119 * testsuite/plugin_test_4.sh: New test case.
4120
62a6d109
ILT
41212009-01-07 Ian Lance Taylor <iant@google.com>
4122
4123 * version.cc (version_string): Bump to 1.8.
4124
483620e8
CC
41252008-12-23 Cary Coutant <ccoutant@google.com>
4126
4127 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4128 * plugin.cc (Plugin_manager::finish): Rename as
4129 layout_deferred_objects. Move cleanup to separate function.
4130 (Plugin_manager::cleanup): New function.
4131 (Plugin_finish::run): Call layout_deferred_objects and cleanup
4132 separately.
4133 * plugin.h (Plugin_manager::finish): Rename as
4134 layout_deferred_objects.
4135 (Plugin_manager::cleanup): New function.
4136 (Plugin_manager::cleanup_done): New field.
4137
d66a9eb3
CC
41382008-12-23 Cary Coutant <ccoutant@google.com>
4139
4140 * plugin.cc (is_visible_from_outside): New function.
4141 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4142 so we don't return "IR only" status for exported symbols or -r links.
4143
4144 * testsuite/Makefile.am (plugin_test_3): New test case.
4145 * testsuite/Makefile.in: Regenerate.
4146 * testsuite/plugin_test_3.sh: New file.
4147
5995b570
CC
41482008-12-22 Cary Coutant <ccoutant@google.com>
4149
4150 * object.cc (Sized_relobj::layout_section): New function.
4151 (Sized_relobj::do_layout): Defer layout of input sections until after
4152 plugin has provided replacement files.
4153 (Sized_relobj::do_layout_deferred_sections): New function.
4154 * object.h (Relobj::set_section_offset): Remove virtual keyword.
4155 (Relobj::layout_deferred_sections): New function.
4156 (Relobj::do_layout_deferred_sections): New function.
4157 (Sized_relobj::do_layout_deferred_sections): New function.
4158 (Sized_relobj::layout_section): New function.
4159 (Sized_relobj::Deferred_layout): New structure.
4160 (Sized_relobj::deferred_layout_): New field.
4161 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4162 Change all callers. Layout deferred sections.
4163 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4164 references.
4165 (Plugin_hook::run): Move code from do_plugin_hook inline.
4166 (Plugin_hook::do_plugin_hook): Remove.
4167 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4168 (Plugin_manager::finish): Renamed, was cleanup.
4169 (Plugin_manager::should_defer_layout): New function.
4170 (Plugin_manager::add_deferred_layout_object): New function.
4171 (Plugin_manager::Deferred_layout_list): New type.
4172 (Plugin_manager::deferred_layout_objects_): New field.
4173 (Plugin_hook::do_plugin_hook): Remove.
4174
ee769c88
ILT
41752008-12-17 Ian Lance Taylor <iant@google.com>
4176
4177 * options.h (class General_options): Add --no case for
4178 --export-dynamic.
4179
abc8dcba
CC
41802008-12-16 Cary Coutant <ccoutant@google.com>
4181
4182 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4183 vector.
4184 (Plugin_manager::claim_file): Create plugin object even if
4185 plugin did not call the add_symbols callback.
4186 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4187 asking for more symbols than were added.
4188 * testsuite/Makefile.am (plugin_test_1): Add test case with
4189 no global symbols.
4190 (empty.syms): New target.
4191 * testsuite/Makefile.in: Regenerate.
4192 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4193 message. Don't call add_symbols if no globals.
4194 (all_symbols_read_hook): Don't provide replacement for empty
4195 claimed file.
4196
b0074644
ILT
41972008-12-12 Ian Lance Taylor <iant@google.com>
4198
68943102
ILT
4199 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4200 r_type == 0 for a local symbol with r_sym == 0.
4201 (scan_relocatable_relocs): Pass r_sym to
4202 local_non_section_strategy.
4203 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4204 r_sym parameter.
4205
b0074644
ILT
4206 * configure.ac: Update test for TLS descriptors: they are
4207 supported as of glibc 2.9.
4208 * configure: Rebuild.
4209
c2508178
ILT
42102008-12-11 Ian Lance Taylor <iant@google.com>
4211
4212 PR 7091
4213 * target-reloc.h (Default_scan_relocatable_relocs): For each
4214 function, map r_type == 0 to RELOC_DISCARD.
4215
2756a258
CC
42162008-12-10 Cary Coutant <ccoutant@google.com>
4217
4218 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4219 object to override a kept COMDAT group from a plugin object.
4220
bb6f53d3
ILT
42212008-12-09 Ian Lance Taylor <iant@google.com>
4222
fbc558e1
ILT
4223 PR 7088
4224 * yyscript.y (file_cmd): Handle INPUT.
4225
bb6f53d3
ILT
4226 * testsuite/initpri1.c: Change all declarations to be full
4227 prototypes by adding void, to avoid compiler warnings.
4228
4674ecfc
CC
42292008-12-05 Rafael Avila de Espindola <espindola@google.com>
4230
4231 * options.cc (General_options::parse_plugin_opt): New.
4232 (General_options::add_plugin): The argument now is just the filename.
4233 (General_options::add_plugin_option): New.
4234 * options.h (plugin_opt): New.
4235 (add_plugin): Change argument name.
4236 (add_plugin_option): New.
4237 * plugin.cc (Plugin::load): Don't parse the plugin option.
4238 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4239 (Plugin::add_option): New.
4240 (Plugin::args_): Change type.
4241 (Plugin::filename_): New.
4242 (Plugin_manager::add_plugin_option): New.
4243 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4244 * testsuite/Makefile.in: Regenerate.
4245
fd06b4aa
CC
42462008-12-05 Cary Coutant <ccoutant@google.com>
4247
4248 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4249 Handle --strip-lto-sections option.
4250 * options.h (strip_lto_sections): New option.
4251
6c52134c
CC
42522008-12-01 Cary Coutant <ccoutant@google.com>
4253
4254 * plugin.cc (ld_plugin_message): Change format parameter to const.
4255 Fix mismatch between new[] and delete.
4256
a45248e0
CC
42572008-11-14 Cary Coutant <ccoutant@google.com>
4258
4259 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4260 instead of -1U.
4261
c82fbeee
CS
42622008-11-05 Craig Silverstein <csilvers@google.com>
4263
4264 * options.cc (General_options::parse_dynamic_list): New function.
4265 * options.h (General_options): New flags dynamic_list,
4266 dynamic_list_data, dynamic_list_cpp_new, and
4267 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4268 (General_options::in_dynamic_list): New function.
4269 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4270 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4271 (Lex::can_continue_name): Likewise.
4272 (yylex): Likewise.
4273 (read_script_file): New parameter script_options.
4274 (read_dynamic_list): New function.
4275 (Script_options::define_dynamic_list): New function.
4276 (dynamic_list_keyword_parsecodes): New variable.
4277 (dynamic_list_keywords): New variable.
4278 * script.h (Script_options::define_dynamic_list): New function
4279 prototype.
4280 (read_dynamic_list): New function prototype.
4281 * symtab.cc (strprefix): New macro.
4282 (Symbol::should_add_dynsym_entry): Support dynamic_list,
4283 dynamic_list_data, dynamic_list_cpp_new, and
4284 dynamic_list_cpp_typeinfo.
4285 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4286 (dynamic_list_expr): New rule.
4287 (dynamic_list_nodes): Likewise.
4288 (dynamic_list_node): Likewise.
4289 * testsuite/Makefile.am (dynamic_list): New test.
4290 * testsuite/Makefile.in: Regenerated.
4291 * testsuite/dynamic_list.t: New file.
4292 * testsuite/dynamic_list.sh: New file.
4293
e0bb29a5
CS
42942008-11-05 Craig Silverstein <csilvers@google.com>
4295
4296 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4297 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4298 (t11_last): Likewise.
4299 * testsuite/ver_test_6.c (main): Likewise.
4300
4e1e25e0
CC
43012008-10-07 Cary Coutant <ccoutant@google.com>
4302
4303 * options.c (General_options::finalize): Add check for -static and
4304 -shared.
4305 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4306 is not empty.
4307
92f03fcb
CC
43082008-10-02 Cary Coutant <ccoutant@google.com>
4309
4310 * plugin.cc (make_sized_plugin_object): Fix conditional
4311 compilation to work when not all targets are enabled.
4312
fbd8a257
CC
43132008-09-29 Cary Coutant <ccoutant@google.com>
4314
4315 * archive.cc (Archive::get_file_and_offset): Use filename instead
4316 of name to get library path.
4317 (Archive::include_member): Unlock external member of a thin archive.
4318
4319 * testsuite/Makefile.am (TEST_AR): New variable.
4320 (thin_archive_test_1): New test.
4321 (thin_archive_test_2): New test.
81636b3f
CC
4322 * testsuite/Makefile.in: Regenerate.
4323 * testsuite/thin_archive_main.cc: New file.
4324 * testsuite/thin_archive_test_1.cc: New file.
4325 * testsuite/thin_archive_test_2.cc: New file.
4326 * testsuite/thin_archive_test_3.cc: New file.
4327 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 4328
eff45813
CC
43292008-09-29 Cary Coutant <ccoutant@google.com>
4330
4331 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4332 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4333 instead of -1U.
4334 (Sized_relobj::do_finalize_local_symbols): Likewise.
4335 (Sized_relobj::map_to_kept_section): Likewise.
4336 * object.h (Sized_relobj::invalid_address): New constant.
4337 (Sized_relobj::do_output_section_offset): Check for invalid_address
4338 and return -1ULL.
4339 * output.cc (Output_reloc::local_section_offset): Use constant
4340 invalid_address instead of -1U.
4341 (Output_reloc::get_address): Likewise.
4342 (Output_section::output_address): Change -1U to -1ULL.
4343 * output.h (Output_reloc::invalid_address): New constant.
4344 * reloc.cc (Sized_relobj::write_sections): Use constant
4345 invalid_address instead of -1U.
4346 (Sized_relobj::relocate_sections): Likewise.
4347 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4348 values for merge sections.
4349 * target-reloc.h (relocate_for_relocatable): Use constant
4350 invalid_address instead of -1U.
4351
89fc3421
CC
43522008-09-19 Cary Coutant <ccoutant@google.com>
4353
4354 Add plugin functionality for link-time optimization (LTO).
4355 * configure.ac (plugins): Add --enable-plugins option.
4356 * configure: Regenerate.
4357 * config.in: Regenerate.
4358 * Makefile.am (LIBDL): New variable.
4359 (CCFILES): Add plugin.cc.
4360 (HFILES): Add plugin.h.
4361 (ldadd_var): Add LIBDL.
4362 * Makefile.in: Regenerate.
4363
4364 * archive.cc: Include "plugin.h".
4365 (Archive::setup): Don't preread archive symbols when using a plugin.
4366 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
4367 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4368 files.
4369 (Archive::include_member): Add symbols from plugin objects.
4370 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4371 * descriptors.cc (Descriptors::open): Check for file descriptors
4372 abandoned by plugins.
4373 (Descriptors::claim_for_plugin): New function.
4374 * descriptors.h (Descriptors::claim_for_plugin): New function.
4375 (Open_descriptor::is_claimed): New field.
4376 (claim_descriptor_for_plugin): New function.
4377 * fileread.cc (File_read::claim_for_plugin): New function.
4378 * fileread.h (File_read::claim_for_plugin): New function.
4379 (File_read::descriptor): New function.
4380 * gold.cc: Include "plugin.h".
4381 (queue_initial_tasks): Add task to call plugin hooks for generating
4382 new object files.
4383 * main.cc: Include "plugin.h".
4384 (main): Load plugin libraries.
4385 * object.h (Pluginobj): Declare.
4386 (Object::pluginobj): New function.
4387 (Object::do_pluginobj): New function.
4388 (Object::set_target): New function.
4389 * options.cc: Include "plugin.h".
4390 (General_options::parse_plugin): New function.
4391 (General_options::General_options): Initialize plugins_ field.
4392 (General_options::add_plugin): New function.
4393 * options.h (Plugin_manager): Declare.
4394 (General_options): Add --plugin option.
4395 (General_options::has_plugins): New function.
4396 (General_options::plugins): New function.
4397 (General_options::add_plugin): New function.
4398 (General_options::plugins_): New field.
4399 * plugin.cc: New file.
4400 * plugin.h: New file.
4401 * readsyms.cc: Include "plugin.h".
4402 (Read_symbols::do_read_symbols): Check for archive before checking
4403 for ELF file. Call plugin hooks to claim files.
4404 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4405 from a real object file; force override when processing replacement
4406 files.
4407 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4408 (Symbol::init_base_object): Likewise.
4409 (Symbol::init_base_output_data): Likewise.
4410 (Symbol::init_base_output_segment): Likewise.
4411 (Symbol::init_base_constant): Likewise.
4412 (Symbol::init_base_undefined): Likewise.
4413 (Symbol::output_section): Assert that object is not a plugin.
4414 (Symbol_table::add_from_pluginobj): New function.
4415 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4416 undefined.
4417 (Symbol_table::sized_write_globals): Likewise.
4418 (Symbol_table::add_from_pluginobj): Instantiate template.
4419 * symtab.h (Sized_pluginobj): Declare.
4420 (Symbol::in_real_elf): New function.
4421 (Symbol::set_in_real_elf): New function.
4422 (Symbol::in_real_elf_): New field.
4423 (Symbol_table::add_from_pluginobj): New function.
4424
4425 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4426 (LIBDL): New variable.
4427 (LDADD): Add LIBDL.
4428 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4429 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4430 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4431 (MOSTLYCLEANFILES): Likewise.
4432 * testsuite/Makefile.in: Regenerate.
4433 * testsuite/plugin_test.c: New file.
4434 * testsuite/plugin_test_1.sh: New file.
4435 * testsuite/plugin_test_2.sh: New file.
4436
de31bda5
ILT
44372008-09-16 Ian Lance Taylor <iant@google.com>
4438
9c2d0ef9
ILT
4439 * target-reloc.h (relocate_section): Check whether a symbol is
4440 defined by the ABI before reporting an undefined symbol error.
4441 * target.h (Target::is_defined_by_abi): Make parameter const.
4442 (Target::do_is_defined_by_abi): Likewise.
4443 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4444 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4445 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4446 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4447 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4448 * testsuite/Makefile.in: Rebuild.
4449
de31bda5
ILT
4450 * fileread.cc (make_view): Add casts to avoid warning.
4451
9fa33bee
AO
44522008-09-16 Alexandre Oliva <aoliva@redhat.com>
4453
4454 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4455 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4456
183fd0e3
AO
44572008-09-16 Alexandre Oliva <aoliva@redhat.com>
4458
4459 * options.h (General_options::output_is_executable): New.
4460 (General_options::output_is_pie): New.
4461 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4462 for shared libraries.
4463 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4464
7be8330a
CD
44652008-09-11 Chris Demetriou <cgd@google.com>
4466
4467 * options.h (origin): New -z option.
4468 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4469 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4470 in DT_FLAGS_1.
4471
a9caad02
CC
44722008-09-05 Cary Coutant <ccoutant@google.com>
4473
4474 * fileread.cc (File_read::make_view): Add check for attempt to map
4475 beyond end of file.
4476
ae6dce4d
CC
44772008-09-05 Cary Coutant <ccoutant@google.com>
4478
4479 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4480 explicit instantiations.
4481
d7ab2a47
KVH
44822008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4483
4484 PR gold/6858
4485 * options.cc (General_options::finalize): Allow undefined symbols
4486 in shlibs if linking -shared.
4487
4488 PR gold/6859
4489 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4490 symbols as not needing a dynsym entry.
4491
1e52a9c1
CS
44922008-08-20 Craig Silverstein <csilvers@google.com>
4493
4494 * fileread.cc (File_read::open): Do not lock the file unless it
4495 was successfully opened.
4496
d85c80a3
CC
44972008-08-14 Cary Coutant <ccoutant@google.com>
4498
4499 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4500 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4501 * testsuite/tls_test.cc (struct int128): 128-bit struct
4502 for testing TLS relocs with non-zero addend.
4503 (v12): New TLS variable.
4504 (t12): New test.
4505 (t_last): Add check for v12.
4506 * testsuite/tls_test.h (t12): New function.
4507 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4508
2d924fd9
ILT
45092008-08-13 Ian Lance Taylor <iant@google.com>
4510
4511 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4512 set tls_segment_ or relro_segment_.
4513 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4514 when appropriate.
4515 * output.h (Output_section::clear_is_relro): New function.
4516 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4517 sections specially even when output_data_ is empty.
4518 (Output_segment::maximum_alignment): When first section is relro,
4519 only force alignment for PT_LOAD segments.
4520 * script.cc (script_data_segment_align): New function.
4521 (script_data_segment_relro_end): New function.
4522 * script-c.h (script_data_segment_align): Declare.
4523 (script_data_segment_relro_end): Declare.
4524 * script-sections.h (class Script_sections): Declare
4525 data_segment_align and data_segment_relro_end. Add fields
4526 segment_align_index_ and saw_relro_end_.
4527 * script-sections.cc (class Sections_element): Add set_is_relro
4528 virtual function. Add new bool* parameter to place_orphan_here.
4529 Add get_output_section virtual function.
4530 (class Output_section_definition): Add set_is_relro. Add new
4531 bool* parameter to place_orphan_here. Add get_output_section.
4532 Add is_relro_ field.
4533 (Output_section_definition::Output_section_definition): Initialize
4534 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4535 and is_relro_ fields.
4536 (Output_section_definition::place_orphan_here): Add is_relro
4537 parameter.
4538 (Output_section_definition::set_section_addresses): Set relro for
4539 output section.
4540 (Output_section_definition::alternate_constraint): Likewise.
4541 (class Orphan_output_section): Add new bool* parameter to
4542 place_orphan_here. Add get_output_section.
4543 (Orphan_output_section::place_orphan_here): Add is_relro
4544 parameter.
4545 (Script_sections::Script_sections): Initialize
4546 data_segment_align_index_ and saw_relro_end_.
4547 (Script_sections::data_segment_align): New function.
4548 (Script_sections::data_segment_relro_end): New function.
4549 (Script_sections::place_orphan): Set or clear is_relro.
4550 (Script_sections::set_section_addresses): Force alignment of first
4551 TLS section.
4552 * yyscript.y (exp): Call script_data_segment_align and
4553 script_data_segment_relro_end.
4554 * testsuite/relro_script_test.t: New file.
4555 * testsuite/relro_test.cc (using_script): Declare.
4556 (t1, t2): Test using_script.
4557 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4558 (relro_script_test_SOURCES): Define.
4559 (relro_script_test_DEPENDENCIES): Define.
4560 (relro_script_test_LDFLAGS): Define.
4561 (relro_script_test_LDADD): Define.
4562 (relro_script_test.so): New target.
4563 * testsuite/Makefile.in: Rebuild.
4564
f827c9a9
CC
45652008-08-06 Cary Coutant <ccoutant@google.com>
4566
4567 * archive.cc (Archive::total_archives, Archive::total_members)
4568 (Archive::total_members_loaded): New variables.
4569 (Archive::setup): Add parameter. Add option to preread
4570 archive symbols.
4571 (Archive::read_armap): Add counter.
4572 (Archive::get_file_and_offset): New function.
4573 (Archive::get_elf_object_for_member): New function.
4574 (Archive::read_all_symbols): New function.
4575 (Archive::read_symbols): New function.
4576 (Archive::add_symbols): Add counters.
4577 (Archive::include_all_members): Use armap to find members if it's
4578 already built.
4579 (Archive::include_member): Skip reading symbols if already read.
4580 Factored code into Archive::get_file_and_offset and
4581 Archive::get_elf_object_for_member. Changed call to
4582 Mapfile::report_include_archive_member.
4583 (Archive::print_stats): New function.
4584 * archive.h: Declare Object and Read_symbols_data classes.
4585 (Archive::Archive): Add initializers for new members.
4586 (Archive::setup): Add parameter.
4587 (Archive::print_stats): New function.
4588 (Archive::total_archives, Archive::total_members)
4589 (Archive::total_members_loaded): New variables.
4590 (Archive::get_file_and_offset): New function.
4591 (Archive::get_elf_object_for_member): New function.
4592 (Archive::read_all_symbols): New function.
4593 (Archive::read_symbols): New function.
4594 (Archive::Archive_member): New class.
4595 (Archive::members_): New member.
4596 (Archive::num_members_): New member.
4597 * main.cc: Include archive.h.
4598 (main): Call Archive::print_stats.
4599 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4600 archive parameter; member_name is now the fully-decorated name.
4601 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4602 * options.h: (General_options): Add --preread-archive-symbols option.
4603 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4604 Archive::setup.
4605
de4c45bd
ILT
46062008-08-04 Ian Lance Taylor <iant@google.com>
4607
4608 * symtab.h (Symbol::use_plt_offset): New function.
4609 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4610 * powerpc.cc (Relocate::relocate): Likewise.
4611 * sparc.cc (Relocate::relocate): Likewise.
4612 * x86_64.cc (Relocate::relocate): Likewise.
4613 * testsuite/weak_plt.sh: New test.
4614 * testsuite/weak_plt_main.cc: New test.
4615 * testsuite/weak_plt_shared.cc: New test.
4616 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4617 (check_PROGRAMS): Add weak_plt.
4618 (check_DATA): Add weak_plt_shared.so.
4619 (weak_plt_main_pic.o, weak_plt): New targets.
4620 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4621 * testsuite/Makefile.in: Rebuild.
4622
4623 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4624 gcctestdir/ld.
4625 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4626 * testsuite/Makefile.in: Rebuild.
4627
323ee3f4
AM
46282008-08-04 Alan Modra <amodra@bigpond.net.au>
4629
4630 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4631 * Makefile.in: Regenerate.
4632 * po/POTFILES.in: Regenerate.
4633
7c07ecec
ILT
46342008-07-29 Ian Lance Taylor <iant@google.com>
4635
4636 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4637 symbols before other symbols.
4638 * testsuite/script_test_2.cc (test_addr): Declare.
4639 (test_addr_alias): Declare.
4640 (main): Check that test_addr and test_addr_alias have the right
cd536b21 4641 values.
7c07ecec
ILT
4642 * testsuite/script_test_2.t: Define test_addr_alias and
4643 test_addr.
4644
5778530e
ILT
46452008-07-24 Ian Lance Taylor <iant@google.com>
4646
2a00e4fb
ILT
4647 PR 5990
4648 * descriptors.cc: New file.
4649 * descriptors.h: New file.
4650 * gold-threads.h (class Hold_optional_lock): New class.
4651 * fileread.cc: Include "descriptors.h".
4652 (File_read::~File_read): Release descriptor rather than closing
4653 it.
4654 (File_read::open) [file]: Call open_descriptor rather than open.
4655 Set is_descriptor_opened_.
4656 (File_read::open) [memory]: Assert that descriptor is not open.
4657 (File_read::reopen_descriptor): New function.
4658 (File_read::release): Release descriptor.
4659 (File_read::do_read): Make non-const. Reopen descriptor.
4660 (File_read::read): Make non-const.
4661 (File_read::make_view): Reopen descriptor.
4662 (File_read::do_readv): Likewise.
4663 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4664 Update declarations.
4665 * layout.cc: Include "descriptors.h".
4666 (Layout::create_build_id): Use open_descriptor rather than open.
4667 * output.cc: Include "descriptors.h".
4668 (Output_file::open): Use open_descriptor rather than open.
4669 * archive.cc (Archive::const_iterator): Change Archive to be
4670 non-const.
4671 (Archive::begin, Archive::end): Make non-const.
4672 (Archive::count_members): Likewise.
4673 * archive.h (class Archive): Update declarations.
4674 * object.h (Object::read): Make non-const.
4675 * Makefile.am (CCFILES): Add descriptors.cc.
4676 (HFILES): Add descriptors.h.
4677 * Makefile.in: Rebuild.
4678
801647d1
ILT
4679 PR 6716
4680 * gold.h: Always include <clocale>. Add Solaris workarounds
4681 following code in binutils/sysdep.h.
4682
5edd166e
ILT
4683 PR 6048
4684 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4685 this->eh_frame_hdr_ is NULL before using it.
4686
c89ad728
ILT
4687 * dynobj.cc (Versions::Versions): Update comment.
4688
aa86f06b
ILT
4689 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4690 the base version name.
4691
5778530e
ILT
4692 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4693 array size plus one.
4694 (Stringpool_template::set_string_offsets): Subtract one from key
4695 before using it as an array index.
4696 (Stringpool_template::get_offset_with_length): Likewise.
4697 (Stringpool_template::write_to_buffer): Likewise.
4698 * stringpool.h (Stringpool_template::get_offset_from_key):
4699 Likewise.
4700
057ead22
ILT
47012008-07-23 Ian Lance Taylor <iant@google.com>
4702
7f649c59
ILT
4703 PR 6658
4704 * object.h (Merged_symbol_value::value): Do our best to handle a
4705 negative addend.
4706
057ead22
ILT
4707 PR 6647
4708 * script.cc (Version_script_info::get_versions): Don't add empty
4709 version tag to return value.
4710 (Version_script_info::get_symbol_version_helper): Change return
4711 type to bool. Add pversion parameter. Change all callers.
4712 (script_register_vers_node): Don't require a non-NULL tag.
4713 * script.h (class Version_script_info): Update declarations.
4714 (Version_script_info::get_symbol_version): Change return type to
4715 bool. Add version parameter. Change all callers.
4716 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4717 handling. Handle an empty version from a version script.
4718 (Symbol_table::define_special_symbol): Likewise.
4719 * testsuite/ver_test_10.script: New file.
4720 * testsuite/ver_test_10.sh: New file.
4721 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4722 (check_DATA): Add ver_test_10.syms.
4723 (ver_test_10.syms, ver_test_10.so): New target.
4724 * testsuite/Makefile.in: Rebuild.
4725
58e54ac2
CD
47262008-07-23 Simon Baldwin <simonb@google.com>
4727
4728 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4729 to zero for undefined symbols from dynamic libraries.
4730
95d14cd3
ILT
47312008-07-23 Ian Lance Taylor <iant@google.com>
4732
4733 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4734 Change all callers.
4735 * symtab.h (class Symbol_table): Update declaration.
4736 * testsuite/ver_test_9.cc: New file.
4737 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4738 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4739 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4740 (ver_test_9.so, ver_test_9.o): New targets.
4741 * testsuite/Makefile.in: Rebuild.
4742
92de84a6
ILT
47432008-07-22 Ian Lance Taylor <iant@google.com>
4744
34810851
ILT
4745 * options.h (class General_options): Define --check-sections.
4746 * layout.cc (Layout::set_segment_offsets): Handle
4747 --check-sections.
4748
af6156ef
ILT
4749 * options.h (class General_options): Define -n/--nmagic and
4750 -N/--omagic.
4751 * options.cc (General_options::finalize): For -n/--nmagic or
4752 -N/--omagic, set -static.
4753 * layout.cc (Layout::attach_allocated_section_to_segment): If
4754 -N/--omagic, don't put read-only and read-write sections in
4755 different segments.
4756 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4757 finding a read-only segment.
4758 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4759 don't set the minimum segment alignment to the common page size,
4760 and don't set the file offset to the address modulo the page size.
4761 * script-sections.cc (Script_sections::create_segments): If
4762 -n/--omagic, don't put read-only and read-write sections in
4763 different segments.
4764
92de84a6
ILT
4765 * cref.cc: New file.
4766 * cref.h: New file.
4767 * options.h (class General_options): Add --print-symbol-counts.
4768 * main.cc (main): Issue defined symbol report if requested.
4769 * archive.cc (Archive::interpret_header): Make into a const member
4770 function.
4771 (Archive::add_symbols): Call Input_objects::archive_start and
4772 archive_stop.
4773 (Archive::const_iterator): Define new class.
4774 (Archive::begin, Archive::end): New functions.
4775 (Archive::include_all_members): Rewrite to use iterator.
4776 (Archive::count_members): New function.
4777 * archive.h (class Archive): Update declarations.
4778 (Archive::filename): New function.
4779 * object.cc: Include "cref.h".
4780 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4781 (Sized_relobj::do_get_global_symbol_counts): New function.
4782 (Input_objects::add_object): Add object to cross-referencer.
4783 (Input_objects::archive_start): New function.
4784 (Input_objects::archive_stop): New function.
4785 (Input_objects::print_symbol_counts): New function.
4786 * object.h: Declare Cref and Archive.
4787 (Object::get_global_symbol_counts): New function.
4788 (Object::do_get_global_symbol_counts): New pure virtual function.
4789 (class Sized_relobj): Add defined_count_ field. Update
4790 declarations.
4791 (class Input_objects): Add cref_ field. Update constructor.
4792 Update declarations.
4793 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4794 defined_count_.
4795 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4796 symbol counts.
4797 (Sized_dynobj::do_get_global_symbol_counts): New function.
4798 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4799 defined_count_. Update declarations. Define Symbols typedef.
4800 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4801 parameter. Change all callers.
4802 (Symbol_table::add_from_dynobj): Add sympointers and defined
4803 parameters. Change all callers.
4804 * symtab.h (class Symbol_table): Update declarations.
4805 * Makefile.am (CCFILES): Add cref.cc.
4806 (HFILES): Add cref.h.
4807 * Makefile.in: Rebuild.
4808
3f7c5e1d
CD
48092008-07-22 Simon Baldwin <simonb@google.com>
4810
4811 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4812 to zero when writing undefined symbols.
4813
e0b64032
ILT
48142008-07-22 Ian Lance Taylor <iant@google.com>
4815
4816 * output.cc (Output_section::add_input_section): Don't try to
4817 merge empty merge sections.
4818
096b02cf
CS
48192008-07-21 Craig Silverstein <csilvers@google.com>
4820
4821 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4822 Include symbol version in error message.
cd536b21 4823
1d1f116d
CD
48242008-07-20 Chris Demetriou <cgd@google.com>
4825
cd536b21 4826 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
4827 (RANDOM_SEED_CFLAGS): New substituted variable.
4828 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4829 * configure: Rebuild.
4830 * Makefile.in: Likewise.
4831 * testsuite/Makefile.in: Likewise.
4832
a18f591e
ILT
48332008-07-18 Ian Lance Taylor <iant@google.com>
4834
4835 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4836 where we see NAME/NULL and NAME/VERSION as separate symbols.
4837 * testsuite/ver_test_main.cc (main): Call t4.
4838 (t4, t4_2a): Define.
4839 * testsuite/ver_test_2.cc (t4_2): Define.
4840 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4841 * testsuite/ver_test_4.cc (t4_2a): Define.
4842 * testsuite/ver_test_4.script: Put t4_2a in VER2.
4843 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4844
c6e3f6ed
ILT
48452008-07-17 Ian Lance Taylor <iant@google.com>
4846
4847 * dynobj.cc (Versions::add_def): If we give an error about a
4848 missing version, go ahead and create the version anyhow.
4849
ef9beddf
ILT
48502008-07-10 Ian Lance Taylor <iant@google.com>
4851
4852 Handle output sections with more than 0x7fffffff bytes.
4853 * object.h (class Relobj): Change map_to_output_ to
4854 output_sections_, and just keep a section pointer. Change all
4855 uses. Move comdat group support to Sized_relobj.
4856 (Relobj::is_section_specially_mapped): Remove.
4857 (Relobj::output_section): Remove poff parameter. Change all
4858 callers.
4859 (Relobj::output_section_offset): New function.
4860 (Relobj::set_section_offset): Rewrite.
4861 (Relobj::map_to_output): Remove.
4862 (Relobj::output_sections): New function.
4863 (Relobj::do_output_section_offset): New pure virtual function.
4864 (Relobj::do_set_section_offset): Likewise.
4865 (class Sized_relobj): Add section_offsets_ field. Add comdat
4866 group support from Relobj. Update declarations.
4867 (Sized_relobj::get_output_section_offset): New function.
4868 (Sized_relobj::do_output_section_offset): New function.
4869 (Sized_relobj::do_set_section_offset): New function.
4870 * object.cc (Relobj::output_section_address): Remove.
4871 (Sized_relobj::Sized_relobj): Initialize new fields.
4872 (Sized_relobj::include_section_group): Cast find_kept_object to
4873 Sized_relobj.
4874 (Sized_relobj::include_linkonce_section): Likewise.
4875 (Sized_relobj::do_layout): Use separate arrays for output section
4876 and output offset.
4877 (Sized_relobj::do_count_local_symbols): Change map_to_output to
4878 output_sections.
4879 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4880 output_sections and section_offsets.
4881 (Sized_relobj::write_local_symbols): Likewise.
4882 (map_to_kept_section): Compute output address directly.
4883 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4884 output_sections and section_offsets.
4885 (Sized_relobj::write_sections): Likewise.
4886 (Sized_relobj::relocate_sections): Likewise.
4887 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4888 * output.h (class Output_reloc): Update declarations. Change
4889 u2_.relobj to Sized_relobj*.
4890 (class Output_data_reloc): Change add functions to use
4891 Sized_relobj*.
4892 * output.cc (Output_reloc::Output_reloc): Change relobj to
4893 Sized_relobj*.
4894 (Output_reloc::local_section_offset): Change return type to
4895 Elf_Addr. Use get_output_section_offset.
4896 (Output_reloc::get_address): Likewise.
4897 (Output_section::is_input_address_mapped): Don't call
4898 is_section_specially_mapped.
4899 (Output_section::output_offset): Likewise.
4900 (Output_section::output_address): Likewise.
4901 (Output_section::starting_output_address): Likewise.
4902 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4903 parameter to Sized_relobj*.
4904 (Copy_relocs::need_copy_reloc): Likewise.
4905 (Copy_relocs::save): Likewise.
4906 * copy-relocs.h (class Copy_relocs): Update declarations.
4907 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4908 Sized_relobj*. Change relobj_ field to Sized_relobj*.
4909 * target-reloc.h (relocate_for_relocatable): Change
4910 offset_in_output_section type to Elf_Addr. Change code that uses
4911 it as well.
4912 * layout.cc (Layout::layout): Always set *off.
4913 * mapfile.cc (Mapfile::print_input_section): Use
4914 output_section_offset.
4915 * i386.cc (Target_i386::copy_reloc): Change object parameter to
4916 Sized_relobj*.
4917 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
4918 * sparc.cc (Target_sparc::copy_reloc): Likewise.
4919 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
4920
5cb66f97
ILT
49212008-07-03 Ian Lance Taylor <iant@google.com>
4922
4923 * layout.cc (Layout::include_section): Do not discard unrecognized
4924 SHT_STRTAB sections.
4925
afe47622
CS
49262008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
4927
4928 * script.cc (Lex::can_continue_name): Make '?' allowable in
4929 version-script names.
4930 * testsuite/version_script.map: Change glob pattern to use '?'
4931
5adf9721
ILT
49322008-06-30 Manish Singh <yosh@gimp.org>
4933
4934 PR 6585
4935 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
4936 Correct typo.
4937
e6fde208
ILT
49382008-06-30 Ian Lance Taylor <iant@google.com>
4939
4940 PR 6660
4941 PR 6682
4942 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
4943 versions]: Don't try to read the value in the contents, since we
4944 don't use it. Use the template endianness when writing.
4945
3f2e6a2d
CC
49462008-06-25 Cary Coutant <ccoutant@google.com>
4947
4948 * fileread.cc (File_read::make_view): Assert on zero-length view.
4949 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
4950 symbol table when there are no symbols to read.
4951
c43d3a48
CS
49522008-06-23 Craig Silverstein <csilvers@google.com>
4953
4954 * version.cc (version_string): Bump to 1.7
4955
5f494ea0
CS
49562008-06-18 Craig Silverstein <csilvers@google.com>
4957
4958 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4959 constant 0xFFFF to type Valtype.
4960 (Powerpc_relocate_functions::rel16_ha): Likewise.
4961
c42e122e
ILT
49622008-06-17 Ian Lance Taylor <iant@google.com>
4963
f34787f8
ILT
4964 * output.h (Output_section::Input_section): Initialize p2align_ to
4965 zero for Output_section_data constructors.
4966 (Output_section::Input_section::addralign): If not an input
4967 section, return the alignment of the Output_section_data.
4968 * testsuite/copy_test.cc: New file.
4969 * testsuite/copy_test_1.cc: New file.
4970 * testsuite/copy_test_2.cc: New file.
4971 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
4972 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
4973 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
4974 (copy_test_1_pic.o, copy_test_1.so): New targets.
4975 (copy_test_2_pic.o, copy_test_2.so): New targets.
4976 * testsuite/Makefile.in: Rebuild.
4977
c42e122e
ILT
4978 * script-sections.cc (Script_sections::place_orphan): Initialize
4979 local variable exact.
4980
ce3ac18a
DE
49812008-06-13 David Edelsohn <edelsohn@gnu.org>
4982
4983 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
4984
42cacb20
DE
49852008-06-12 David Edelsohn <edelsohn@gnu.org>
4986 David S. Miller <davem@davemloft.net>
4987
4988 * powerpc.cc: New file.
4989 * Makefile.am (TARGETSOURCES): Add powerpc.cc
4990 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4991 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4992 * Makefile.in: Rebuild.
4993
7b308235
ILT
49942008-06-09 Ian Lance Taylor <iant@google.com>
4995
4996 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4997 <exception>.
4998 (throwing, orig_terminate): New static variables.
4999 (terminate_handler): New static function.
5000 (t2): Set terminate handler.
5001
f0b886e3
ILT
50022008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
5003
5004 PR 6584
cd536b21 5005 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
5006 alignment.
5007
3e90f135
CC
50082008-05-30 Cary Coutant <ccoutant@google.com>
5009
5010 * archive.cc (Archive::include_all_members) Correct to step
5011 over symbol table and extended name table in thin archives.
5012
e09ad04a
ILT
50132008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
5014
5015 PR 6407
5016 * target-reloc.h (relocate_for_relocatable): Fix new_offset
5017 calculation.
5018
62b01cb5
ILT
50192008-05-28 Caleb Howe <cshowe@google.com>
5020
5021 * reduced_debug_output.cc: New file.
5022 * reduced_debug_output.h: New file.
92de84a6 5023 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
5024 * options.cc (General_options::finalize): Add strip_debug_non_line
5025 to the strip heirarchy.
5026 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5027 fields.
5028 * layout.cc: Include "reduced_debug_output.h".
5029 (Layout::Layout): Initialize new fields.
5030 (line_only_debug_sections): New static array.
5031 (is_lines_only_debug_sections): New static inline function.
5032 (Layout::include_section): Handle --strip-debug-non-line.
5033 (Layout::make_output_section): If --strip-debug-non-line, build
5034 new output sections for .debug_abbrev and .debug_info.
5035 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5036 gold. Warn about possible overflow.
5037 (read_signed_LEB_128): Likewise.
5038 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5039 (read_signed_LEB_128): Declare.
5040 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5041 (HFILES): Add reduced_debug_output.h.
5042 * Makefile.in: Rebuild.
5043
7d9e3d98
ILT
50442008-05-21 Ian Lance Taylor <iant@google.com>
5045
5046 * mapfile.cc: New file.
5047 * mapfile.h: New file.
5048 * options.h (class General_options): Add -M/--print-map and -Map.
5049 * options.cc (General_options::finalize): Make -M equivalent to
5050 -Map -.
5051 * main.cc: Include <cstdio> and "mapfile.h".
5052 (main): Open mapfile if requested.
5053 * gold.cc (class Middle_runner): Add mapfile_ field. Update
5054 constructor. Change caller.
5055 (queue_initial_tasks): Add mapfile parameter. Change caller.
5056 (queue_middle_tasks): Likewise.
5057 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5058 declarations.
5059 * archive.cc: Include "mapfile.h".
5060 (Archive::add_symbols): Add mapfile parameter. Change all
5061 callers. Pass mapfile, symbol, and reason to include_member.
5062 (Archive::include_all_members): Add mapfile parameter. Change all
5063 callers.
5064 (Archive::include_member): Add mapfile, sym, and why parameters.
5065 Change all callers. Report inclusion to map file.
5066 * archive.h: Include "fileread.h".
5067 (class Archive): Update declarations.
5068 (Archive::file): New const method.
5069 (class Add_archive_symbols): Add mapfile_ field. Update
5070 constructor. Change all callers.
5071 * readsyms.h (class Read_symbols): Likewise.
5072 (class Finish_group): Likewise.
5073 (class Read_script): Likewise.
5074 * common.cc: Include "mapfile.h".
5075 (Symbol_table::allocate_commons): Add mapfile parameter. Change
5076 all callers.
5077 (Symbol_table::do_allocate_commons): Likewise.
5078 (Symbol_table::do_allocate_commons_list): Likewise. Report common
5079 symbol allocation to mapfile.
5080 * common.h (class Allocate_commons_task): Add mapfile_ field.
5081 Update constructor. Change all callers.
5082 * symtab.h (class Symbol_table): Update declarations.
5083 * layout.cc: Include "mapfile.h".
5084 (Layout_task_runner::run): Print information to mapfile.
5085 (Layout::create_gold_note): Change Output_data_fixed_space to
5086 Output_data_zero_fill.
5087 (Layout::create_build_id): Likewise.
5088 (Layout::print_to_mapfile): New function.
5089 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
5090 constructor. Change caller.
5091 (class Layout): Declare print_to_mapfile.
5092 * output.cc (Output_section::Input_section::print_to_mapfile): New
5093 function.
5094 (Output_section::add_input_section): If producing a map, always
5095 add to input_sections_ list.
5096 (Output_section::do_print_to_mapfile): New function.
5097 (Output_segment::print_sections_to_mapfile): New function.
5098 (Output_segment::print_section_list_to_mapfile): New function.
5099 * output.h: Include "mapfile.h".
5100 (Output_data::print_to_mapfile): New function.
5101 (Output_data::do_print_to_mapfile): New virtual function.
5102 (Output_segment_headers::do_print_to_mapfile): New function.
5103 (Output_file_header::do_print_to_mapfile): New function.
5104 (Output_data_const::do_print_to_mapfile): New function.
5105 (class Output_data_const_buffer): Add map_name_ field. Update
5106 constructor. Change all callers. Add do_print_to_mapfile
5107 function.
5108 (class Output_data_fixed_space): Likewise.
5109 (class Output_data_space): Likewise.
5110 (class Output_data_zero_fill): New class.
5111 (Output_data_strtab::do_print_to_mapfile): New function.
5112 (Output_data_reloc_base::do_print_to_mapfile): New function.
5113 (Output_relocatable_relocs::do_print_to_mapfile): New function.
5114 (Output_data_group::do_print_to_mapfile): New function.
5115 (Output_data_got::do_print_to_mapfile): New function.
5116 (Output_data_dynamic::do_print_to_mapfile): New function.
5117 (Output_symtab_xindex::do_print_to_mapfile): New function.
5118 (class Output_section): Declare do_print_to_mapflie. Declare
5119 print_to_mapfile in Input_section.
5120 (class Output_segment): Declare new functions.
5121 * object.h (Sized_relobj::symbol_count): New function.
5122 * script-sections.cc
5123 (Output_section_element_dot_assignment::set_section_addresses):
5124 Change Output_data_fixed_space to Output_data_zero_fill.
5125 (Output_data_expression::do_print_to_mapfile): New function.
5126 * script.cc (read_input_script): Add mapfile parameter. Change
5127 all callers.
5128 * script.h (read_input_script): Update declaration.
5129 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5130 (Eh_frame::do_print_to_mapfile): New function.
5131 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5132 (Output_merge_string::do_print_to_mapfile): New function.
5133 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5134 function.
5135 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5136 function.
5137 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5138 function.
5139 * Makefile.am (CCFILES): Add mapfile.cc.
5140 (HFILES): Add mapfile.h.
5141 * Makefile.in: Rebuild.
5142
9f1d377b
ILT
51432008-05-19 Ian Lance Taylor <iant@google.com>
5144
5145 * options.h (class General_options): Add -z relro.
5146 * layout.cc (Layout::Layout): Initialize relro_segment_.
5147 (Layout::add_output_section_data): Return the output section.
5148 (Layout::make_output_section): Rcognize relro sections and mark
5149 them appropriately.
5150 (Layout::attach_allocated_section_to_segment): Put relro sections
5151 in a PT_GNU_RELRO segment.
5152 (Layout::create_initial_dynamic_sections): Mark the .dynamic
5153 section as relro.
5154 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5155 PT_TLS segments.
5156 (Layout::linkonce_mapping): Map d.rel.ro.local to
5157 .data.rel.ro.local.
5158 (Layout::output_section_name): Us .data.rel.ro.local for any
5159 section which begins with that.
5160 * layout.h (class Layout): Update add_output_section_data
5161 declaration. Add relro_segment_ field.
5162 * output.cc (Output_section::Output_section): Initialize is_relro_
5163 and is_relro_local_ fields.
5164 (Output_segment::add_output_section): Group relro sections.
5165 (Output_segment::is_first_section_relro): New function.
5166 (Output_segment::maximum_alignment): If there is a relro section,
5167 align the segment to the common page size.
5168 (Output_segment::set_section_addresses): Track whether we are
5169 looking at relro sections. If the last section is a relro
5170 section, align to the common page size.
5171 (Output_segment::set_section_list_addresses): Add in_relro
5172 parameter. Change all callers. Align to the page size when
5173 moving from relro to non-relro section.
5174 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5175 segment.
5176 * output.h (class Output_section): Add is_relro_ and
5177 is_relro_local_ fields.
5178 (Output_section::is_relro): New function.
5179 (Output_section::set_is_relro): New function.
5180 (Output_section::is_relro_local): New function.
5181 (Output_section::set_is_relro_local): New function.
5182 (class Output_segment): Update declarations.
5183 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5184 * sparc.cc (Target_sparc::got_section): Likewise.
5185 * x86_64.cc (Target_x86_64::got_section): Likewise.
5186 * testsuite/relro_test_main.cc: New file.
5187 * testsuite/relro_test.cc: New file.
5188 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5189 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5190 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5191 (relro_test.so, relro_test_pic.o): New targets.
5192 * testsuite/Makefile.in: Rebuild.
5193
a984ee1d
ILT
51942008-05-16 Ian Lance Taylor <iant@google.com>
5195
01676dcd
ILT
5196 * output.cc (Output_segment::add_output_section): Remove front
5197 parameter.
5198 * output.h (class Output_segment): Remove
5199 add_initial_output_section and overloaded add_output_section.
5200 Update declaration of remaining add_output_section.
5201 * layout.cc (Layout::create_interp): Call add_output_section
5202 rather than add_initial_output_section.
5203 (Layout::finish_dynamic_section): Likewise.
5204
497897f9
ILT
5205 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5206 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5207 know the dynamic type.
5208 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5209 field. Initialize it in constructor.
5210 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5211 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5212 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5213 reloc.
5214
a984ee1d
ILT
5215 * output.cc (Output_reloc::get_address): Change return type to
5216 Elf_Addr.
5217 * output.h (class Output_reloc): Update get_address declaration.
5218 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5219 for section addresses.
5220
55ba0940
ILT
52212008-05-09 Ian Lance Taylor <iant@google.com>
5222
5223 PR 6493
5224 * gold.cc (gold_nomem): Use return value of write.
5225
75517b77
ILT
52262008-05-08 Ian Lance Taylor <iant@google.com>
5227
5228 * symtab.c (Symbol::init_base_output_data): Add version
5229 parameter. Change all callers.
5230 (Symbol::init_base_output_segment): Likewise.
5231 (Symbol::init_base_constant): Likewise.
5232 (Symbol::init_base_undefined): Likewise.
5233 (Sized_symbol::init_output_data): Likewise.
5234 (Sized_symbol::init_output_segment): Likewise.
5235 (Sized_symbol::init_constant): Likewise.
5236 (Sized_symbol::init_undefined): Likewise.
5237 (Symbol_table::do_define_in_output_data): If the new symbol has a
5238 version, mark it as the default.
5239 (Symbol_table::do_define_in_output_segment): Likewise.
5240 (Symbol_table::do_define_as_constant): Likewise.
5241 * symtab.h (class Symbol): Update declarations.
5242 (class Sized_symbol): Likewise.
5243 * resolve.cc (Symbol::override_version): New function.
c42e122e 5244 (Symbol::override_base): Call override_version.
75517b77
ILT
5245 (Symbol::override_base_with_special): Likewise.
5246 * testsuite/ver_script_8.script: New file.
5247 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5248 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5249 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5250 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5251
f1f70eae
ILT
52522008-05-06 Ian Lance Taylor <iant@google.com>
5253
f3e9c5c5
ILT
5254 PR 6049
5255 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5256 functions.
5257 (class General_options): Remove existing --undefined, and add
5258 --no-undefined instead. Add new --undefined as synonym for -u.
5259 * archive.cc (Archive::add_symbols): Check whether symbol was
5260 named with -u.
5261 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5262 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5263 all uses. Add IS_UNDEFINED. Update declarations to split
5264 different versions of init_base. Declare init_base_undefined.
5265 (Symbol::is_defined): Handle IS_UNDEFINED.
5266 (Symbol::is_undefined): Likewise.
5267 (Symbol::is_weak_undefined): Call is_undefined.
5268 (Symbol::is_absolute): Handle IS_CONSTANT.
5269 (class Sized_symbol): Update declarations to split different
5270 versions of init. Declare init_undefined.
5271 (class Symbol_table): Declare new functions.
5272 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5273 Change all callers.
5274 (Symbol::init_base_output_data): Likewise.
5275 (Symbol::init_base_output_segment): Likewise.
5276 (Symbol::init_base_constant): Likewise.
5277 (Symbol::init_base_undefined): New function.
5278 (Sized_symbol::init_object): Rename from init. Change all
5279 callers.
5280 (Sized_symbol::init_output_data): Likewise.
5281 (Sized_symbol::init_output_segment): Likewise.
5282 (Sized_symbol::init_constant): Likewise.
5283 (Sized_symbol::init_undefined): New function.
5284 (Symbol_table::add_undefined_symbols_from_command_line): New
5285 function.
5286 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5287 function.
5288 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5289 (Symbol::output_section): Likewise.
5290 (Symbol::set_output_section): Likewise.
5291 (Symbol_table::sized_finalize_symbol): Likewise.
5292 (Symbol_table::sized_write_globals): Likewise.
5293 * resolve.cc (Symbol_table::should_override): Likewise.
5294 (Symbol::override_base_with_special): Likewise.
5295
8bdcdf2c
ILT
5296 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5297 symbol, change it to have default visibility.
5298 * testsuite/protected_1.cc: New file.
5299 * testsuite/protected_2.cc: New file.
5300 * testsuite/protected_3.cc: New file.
5301 * testsuite/protected_main_1.cc: New file.
5302 * testsuite/protected_main_2.cc: New file.
5303 * testsuite/protected_main_3.cc: New file.
5304 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5305 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5306 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5307 (protected_1.so): New target.
5308 (protected_1_pic.o, protected_2_pic.o): New targets.
5309 (protected_3_pic.o): New target.
5310 (check_PROGRAMS): Add protected_2.
5311 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5312 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5313 * testsuite/Makefile.in: Rebuild.
5314
2b706932
ILT
5315 * options.h (DEFINE_var): Add set_user_set_##varname__.
5316 (DEFINE_bool_alias): New macro.
5317 (class General_options): Define -Bstatic using DEFINE_bool_alias
5318 rather than DEFINE_special. Add --undefined as an alias for -z
5319 defs.
5320 * options.cc (General_options::parse_Bstatic): Remove.
5321
d82a5bcc
ILT
5322 * options.h (class General_options): Add --fatal-warnings.
5323 * main.cc (main): Implement --fatal-warnings.
5324 * errors.h (Errors::warning_count): New function.
5325
f1f70eae
ILT
5326 * options.h (class General_options): Add -Bsymbolic-functions.
5327 * symtab.h (Symbol::is_preemptible): Check for
5328 -Bsymbolic-functions.
5329
8825ac63
ILT
53302008-05-05 Ian Lance Taylor <iant@google.com>
5331
d98bc257
ILT
5332 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5333 as noVARNAME rather than no-VARNAME.
5334 (class General_options): Add option -z combreloc.
5335 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5336 get_address.
5337 (Output_reloc::sort_before) [SHT_REL]: New function.
5338 (Output_reloc::sort_before) [SHT_RELA]: New function.
5339 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5340 Sort_relocs_comparison.
5341 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5342 parameter. Change all callers.
5343 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5344 sort_relocs parameter. Change all callers.
5345 * output.cc (Output_reloc::get_address): New function, broken out
5346 of write_rel.
5347 (Output_reloc::write_rel): Call it.
5348 (Output_reloc::compare): New function.
5349 (Output_data_reloc_base::do_write): Optionally sort relocs.
5350
60b2b4e7
ILT
5351 * configure.ac: If targ_extra_obj is set, link it in.
5352 * configure.tgt: Initialize all variables.
5353 (x86_64*): Set targ_extra_obj and targ_extra_size.
5354 * configure: Rebuild.
5355
8825ac63
ILT
5356 * object.cc (Sized_relobj::include_section_group): Adjust section
5357 indexes read from group data. Build vector to pass to
5358 layout_group.
5359 * layout.cc (Layout::layout_group): Add flags and shndxes
5360 parameters. Remove contents parameter. Change caller. Update
5361 explicit instantiations.
5362 * layout.h (class Layout): Update layout_group declaration.
5363 * output.cc (Output_data_group::Output_data_group): Add flags and
5364 input_shndxes parameters. Remove contents parameter. Change
5365 caller.
5366 (Output_data_group::do_write): Change input_sections_ to
5367 input_shndxes_.
5368 * output.h (class Output_data_group): Update constructor
5369 declaration. Rename input_sections_ to input_shndxes_.
5370 * testsuite/many_sections_test.cc: Add template.
5371
e94cf127
CC
53722008-04-30 Cary Coutant <ccoutant@google.com>
5373
4418b2d5
CC
5374 * target-reloc.h (relocate_section): Fix dead-pointer bug.
5375
e94cf127
CC
5376 * layout.cc (Layout::include_section): Refactored check for debug
5377 info section.
5378 (Layout::add_comdat): Add new parameters. Change type
5379 of signature parameter. Add object and shndx to signatures table.
5380 (Layout::find_kept_object): New function.
5381 * layout.h: Include <cstring>.
5382 (Layout::is_debug_info_section): New function.
5383 (Layout::add_comdat): Add new parameters.
5384 (Layout::find_kept_object): New function.
5385 (Layout::Kept_section): New struct.
5386 (Layout::Signatures): Change type of map range.
5387 * object.cc (Relobj::output_section_address): New function.
5388 (Sized_relobj::include_section_group): Add new parameters. Change
5389 calls to Layout::add_comdat. Change to build table of kept comdat
5390 groups and table mapping discarded sections to kept sections.
5391 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5392 (Sized_relobj::do_layout): Change calls to include_section_group and
5393 include_linkonce_section.
5394 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5395 value to zero when section is discarded.
5396 (Sized_relobj::map_to_kept_section): New function.
5397 * object.h (Relobj::output_section_address): New function.
5398 (Relobj::Comdat_group): New type.
5399 (Relobj::find_comdat_group): New function.
5400 (Relobj::Comdat_group_table): New type.
5401 (Relobj::Kept_comdat_section): New type.
5402 (Relobj::Kept_comdat_section_table): New type.
5403 (Relobj::add_comdat_group): New function.
5404 (Relobj::set_kept_comdat_section): New function.
5405 (Relobj::get_kept_comdat_section): New function.
5406 (Relobj::comdat_groups_): New field.
5407 (Relobj::kept_comdat_sections_): New field.
5408 (Symbol_value::input_value): Update comment.
5409 (Sized_relobj::map_to_kept_section) New function.
5410 (Sized_relobj::include_linkonce_section): Add new parameter.
5411 * target-reloc.h (Comdat_behavior): New type.
5412 (get_comdat_behavior): New function.
5413 (relocate_section): Add code to map a discarded section to the
5414 corresponding kept section when applying a relocation.
5415
e4e5049b
CS
54162008-04-30 Craig Silverstein <csilvers@google.com>
5417
5418 * dwarf_reader.cc (next_generation_count): New static var.
5419 (Addr2line_cache_entry): New struct.
5420 (addr2line_cache): New static var.
5421 (Dwarf_line_info::one_addr2line): Added caching.
5422 (Dwarf_line_info::clear_addr2line_cache): New function.
5423 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5424 cache-size parameter.
5425 (Dwarf_line_info::one_addr2line_cache): New function.
5426 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5427 new cache-size argument to one_addr2line(), and clear cache.
5428
d09e9154
CC
54292008-04-28 Cary Coutant <ccoutant@google.com>
5430
5431 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5432 R_386_PC8 relocations.
5433
7ef73768
ILT
54342008-04-23 Ian Lance Taylor <iant@google.com>
5435
55438702
ILT
5436 * object.cc (Sized_relobj::include_section_group): Check for
5437 invalid section group.
5438
c165fb93
ILT
5439 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5440 header size.
5441
7ef73768
ILT
5442 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5443 than read for file header.
5444 * archive.cc (Archive::include_member): Likewise.
5445
6194aaab
L
54462008-04-23 Paolo Bonzini <bonzini@gnu.org>
5447
5448 * aclocal.m4: Regenerate.
5449 * configure: Regenerate.
5450
d491d34e
ILT
54512008-04-19 Ian Lance Taylor <iant@google.com>
5452
5ea2bac6
ILT
5453 * version.cc (version_string): Bump to 1.6.
5454
7bc3e21a
ILT
5455 * testsuite/Makefile.am (many_sections_r_test): New target.
5456 (many_sections_r_test_SOURCES): Remove.
5457 (many_sections_r_test_DEPENDENCIES): Remove.
5458 (many_sections_r_test_LDFLAGS): Remove.
5459 (many_sections_r_test_LDADD): Remove.
5460
7fcd3aa9
ILT
5461 * object.cc (Sized_relobj::do_add_symbols): Always pass
5462 local_symbol_count_ to add_from_relobj.
5463
4c94d6ae
ILT
5464 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5465 every thousand variables.
5466 * testsuite/Makefile.in: Rebuild.
5467
d491d34e
ILT
5468 * object.cc (Xindex::initialize_symtab_xindex): New function.
5469 (Xindex::read_symtab_xindex): New function.
5470 (Xindex::sym_xindex_to_shndx): New function.
5471 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5472 available.
5473 (Sized_relobj::do_initialize_xindex): New function.
5474 (Sized_relobj::do_read_symbols): Adjust section links.
5475 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5476 parameter. Change all callers.
5477 (Sized_relobj::include_section_group): Adjust section links and
5478 symbol section indexes.
5479 (Sized_relobj::do_layout): Adjust section links.
5480 (Sized_relobj::do_count_local_symbols): Adjust section links and
5481 symbol section indexes.
5482 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5483 ordinary and special symbols.
5484 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5485 dynsym_xindex parameters. Change all callers. Adjust section
5486 links. Use SHN_XINDEX when needed.
5487 (Sized_relobj::get_symbol_location_info): Adjust section links.
5488 Don't get fooled by special symbols.
5489 * object.h (class Xindex): Define.
5490 (class Object): Add xindex_ parameter. Declare virtual functoin
5491 do_initialize_xindex.
5492 (Object::adjust_sym_shndx): New function.
5493 (Object::set_xindex): New protected function.
5494 (class Symbol_value): Add is_ordinary_shndx_ field.
5495 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5496 (Symbol_value::value): Assert ordinary section.
5497 (Symbol_value::initialize_input_to_output_map): Likewise.
5498 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5499 Change all callers.
5500 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5501 all callers.
5502 (class Sized_relobj): Update declarations.
5503 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5504 parameter. Change all callers.
5505 (Sized_relobj::adjust_shndx): New function.
5506 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5507 field.
5508 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5509 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5510 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5511 (Sized_dynobj::read_dynsym_section): Adjust section links.
5512 (Sized_dynobj::read_dynamic): Likewise.
5513 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5514 section links.
5515 (Sized_dynobj::do_initialize_xindex): New function.
5516 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5517 do_initialize_xindex.
5518 (Sized_dynobj::adjust_shndx): New function.
5519 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5520 dynsym_xindex_ fields.
5521 (Layout::finalize): Add a call to set_section_indexes before
5522 creating the symtab sections.
5523 (Layout::set_section_indexes): Don't do anything if the section
5524 already has a section index.
5525 (Layout::create_symtab_sections): Add shnum parameter. Change
5526 caller. Create .symtab_shndx section if needed.
5527 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5528 caller.
5529 (Layout::allocated_output_section_count): New function.
5530 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5531 needed.
5532 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5533 fields. Update declarations.
5534 (Layout::symtab_xindex): New function.
5535 (Layout::dynsym_xindex): New function.
5536 (class Write_symbols_task): Add layout_ field.
5537 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5538 Change caller.
5539 * output.cc (Output_section_headers::Output_section_headers): Add
5540 shstrtab_section parameter. Change all callers.
5541 (Output_section_headers::do_sized_write): Store overflow values
5542 for section count and section string table section index in
5543 section header zero.
5544 (Output_file_header::do_sized_write): Check for overflow of
5545 section count and section string table section index.
5546 (Output_symtab_xindex::do_write): New function.
5547 (Output_symtab_xindex::endian_do_write): New function.
5548 * output.h (class Output_section_headers): Add shstrtab_section_.
5549 Update declarations.
5550 (class Output_symtab_xindex): Define.
5551 (Output_section::has_out_shndx): New function.
5552 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5553 field.
5554 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5555 Change all callers.
5556 (Sized_symbol::init): Likewise.
5557 (Symbol::output_section): Check for ordinary symbol.
5558 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5559 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5560 callers.
5561 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5562 Change all callers. Simplify handling of symbols from sections
5563 not included in the link.
5564 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5565 distinction.
5566 (Weak_alias_sorter::operator()): Assert that symbols are
5567 ordinary.
5568 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5569 distinction.
5570 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5571 parameters. Change all callers.
5572 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5573 symbol distinction. Use SHN_XINDEX when needed.
5574 (Symbol_table::write_section_symbol): Add symtab_xindex
5575 parameter. Change all callers.
5576 (Symbol_table::sized_write_section_symbol): Likewise. Use
5577 SHN_XINDEX when needed.
5578 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5579 declarations.
5580 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5581 (Symbol::is_defined): Check is_ordinary.
5582 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5583 (Symbol::is_absolute, Symbol::is_common): Likewise.
5584 (class Sized_symbol): Update declarations.
5585 (class Symbol_table): Update declarations.
5586 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5587 parameters. Change all callers.
5588 (Sized_symbol::override): Likewise.
5589 (Symbol_table::override): Likewise.
5590 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5591 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5592 is_ordinary, and orig_st_shndx parameters. Change all callers.
5593 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5594 to be in an ordinary section.
5595 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5596 object and is_ordinary parameters. Change all callers.
5597 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5598 Change all callers. Don't add undefined or non-ordinary symbols
5599 to reloc_map_.
5600 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5601 Change all callers.
5602 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5603 declarations.
5604 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5605 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5606 (Sized_relobj::relocate_sections): Likewise.
5607 * target-reloc.h (scan_relocs): Adjust section symbol index.
5608 (scan_relocatable_relocs): Likewise.
5609 * i386.cc (Scan::local): Check for ordinary symbols.
5610 * sparc.cc (Scan::local): Likewise.
5611 * x86_64.cc (Scan::local): Likewise.
5612 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5613 to symbol_section_and_value.
5614 * testsuite/many_sections_test.cc: New file.
5615 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5616 (check_PROGRAMS): Add many_sections_test.
5617 (many_sections_test_SOURCES): Define.
5618 (many_sections_test_DEPENDENCIES): Define.
5619 (many_sections_test_LDFLAGS): Define.
5620 (BUILT_SOURCES): Add many_sections_define.h.
5621 (many_sections_define.h): New target.
5622 (BUILT_SOURCES): Add many_sections_check.h.
5623 (many_sections_check.h): New target.
5624 (check_PROGRAMS): Add many_sections_r_test.
5625 (many_sections_r_test_SOURCES): Define.
5626 (many_sections_r_test_DEPENDENCIES): Define.
5627 (many_sections_r_test_LDFLAGS): Define.
5628 (many_sections_r_test_LDADD): Define.
5629 (many_sections_r_test.o): New target.
5630 * testsuite/Makefile.in: Rebuild.
5631
c5818ff1
CC
56322008-04-17 Cary Coutant <ccoutant@google.com>
5633
5634 * errors.cc (Errors::info): New function.
5635 (gold_info): New function.
5636 * errors.h (Errors::info): New function.
5637 * gold.h (gold_info): New function.
5638 * object.cc (Input_objects::add_object): Print trace output.
5639 * options.cc (options::parse_set): New function.
5640 (General_options::parse_wrap): Deleted.
5641 (General_options::General_options): Deleted initializer.
5642 * options.h (options::String_set): New typedef.
5643 (options::parse_set): New function.
5644 (DEFINE_set): New macro.
5645 (General_options::wrap): Changed to use DEFINE_set. Changed
5646 callers of any_wrap_symbols and is_wrap_symbol.
5647 (General_options::trace, General_options::trace_symbol):
5648 New options.
5649 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5650 (General_options::wrap_symbols_): Deleted.
5651 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5652
b5be4a7c
DM
56532008-04-17 David S. Miller <davem@davemloft.net>
5654
5655 * options.cc (General_options::parse_V): New function.
5656 * options.h: Add entries for -V and -Qy.
5657
155a0dd7
ILT
56582008-04-17 Ian Lance Taylor <iant@google.com>
5659
5660 * common.cc (Symbol_table::allocate_commons): Remove options
5661 parameter. Change caller.
5662 (Symbol_table::do_allocate_commons): Remove options parameter.
5663 Change caller. Just call do_allocate_commons_list twice.
5664 (Symbol_table::do_allocate_commons_list): New function, broken out
5665 of do_allocate_commons.
5666 * common.h (class Allocate_commons_task): Remove options_ field.
5667 Update constructor.
5668 * symtab.cc (Symbol_table::Symbol_table): Initialize
5669 tls_commons_.
5670 (Symbol_table::add_from_object): Put TLS common symbols on
5671 tls_commons_ list.
5672 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5673 which are IN_OUTPUT_DATA.
5674 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5675 allocate_commons and do_allocate_commons declarations. Declare
5676 do_allocate_commons_list.
5677 * gold.cc (queue_middle_tasks): Update creation of
5678 Allocate_commons_task to not pass options.
5679 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5680 (TLS_TEST_C_FLAGS): New variable.
5681 (tls_test_c_pic.o): New target.
5682 (tls_test_shared.so): Link in tls_test_c_pic.o.
5683 (tls_test_c_pic_ie.o): New target.
5684 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5685 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5686 (tls_test_c.o): New target.
5687 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5688 (tls_pic_test_LDADD): Likewise.
5689 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5690 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5691 (tls_test_c_gnu2.o): New target.
5692 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5693 tls_test_c_gnu2.o.
5694 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5695 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5696 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5697 * testsuite/tls_test.cc: Include "config.h".
5698 (t_last): Call t11_last.
5699 * testsuite/tls_test.h (t11, t11_last): Declare.
5700 * testsuite/tls_test_c.c: New file.
5701 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5702 * configure.ac: Check for OpenMP support.
5703 * configure, config.in, Makefile.in: Rebuild.
5704 * testsuite/Makefile.in: Rebuild.
5705
edfbb029
CC
57062008-04-16 Cary Coutant <ccoutant@google.com>
5707
5708 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5709 (Target_i386::tls_base_symbol_defined_): New field.
5710 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5711 (Target_i386::Scan::global): Likewise.
5712 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5713 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5714 (Target_x86_64::tls_base_symbol_defined_): New field.
5715 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5716 (Target_x86_64::Scan::global): Likewise.
5717
f3c69fca
CC
57182008-04-16 Cary Coutant <ccoutant@google.com>
5719
5720 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5721 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5722 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5723 building shared libraries.
5724 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5725 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5726 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5727 * testsuite/Makefile.in: Rebuild.
5728 * testsuite/weak_undef.h: New file.
5729 * testsuite/weak_undef_file1.cc: Add extra test cases.
5730 * testsuite/weak_undef_file2.cc: Likewise.
5731 * testsuite/weak_undef_test.cc: Likewise.
5732
7c414435
DM
57332008-04-16 David S. Miller <davem@davemloft.net>
5734
32b769e1
DM
5735 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5736 Add issued_non_pic_error_ field. Declare check_non_pic.
5737 (Target_sparc::Scan::check_non_pic): New function.
5738 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5739 (Target_sparc::Scan::global): Likewise.
5740
11936fb1
DM
5741 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5742 * configure: Rebuild.
5743
7c414435
DM
5744 * options.h (DEFINE_enable): New macro.
5745 (new_dtags): New enable option.
5746 (initfirst, interpose, loadfltr, nodefaultlib,
5747 nodelete, nodlopen, nodump): New -z options.
5748 * layout.cc (Layout:finish_dynamic_section): If new
5749 dtags enabled, emit DT_RUNPATH. Also, emit a
5750 DT_FLAGS_1 containing any specified -z flags.
5751
85c7bf8b
ILT
57522008-04-16 Ian Lance Taylor <iant@google.com>
5753
12c0daef
ILT
5754 * copy-relocs.cc: New file.
5755 * copy-relocs.h: New file.
5756 * reloc.cc: Remove Copy_relocs code.
5757 * reloc.h: Likewise.
5758 * reloc-types.h (struct Reloc_types) [both versions]: Add
5759 get_reloc_addend_noerror.
5760 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5761 variants of add_global which take an addend which must be zero.
5762 * i386.cc: Include "copy-relocs.h".
5763 (class Target_i386): Change type of copy_relocs_ to variable,
5764 update initializer.
5765 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5766 Change all callers.
5767 (Target_i386::do_finalize_sections): Change handling of
5768 copy_relocs_.
5769 * sparc.cc: Include "copy-relocs.h".
5770 (class Target_sparc): Change type of copy_relocs_ to variable,
5771 update initializer.
5772 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5773 Change all callers.
5774 (Target_sparc::do_finalize_sections): Change handling of
5775 copy_relocs_.
5776 * x86_64.cc: Include "copy-relocs.h".
5777 (class Target_x86_64): Change type of copy_relocs_ to variable,
5778 update initializer.
5779 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5780 class. Change all callers.
5781 (Target_x86_64::do_finalize_sections): Change handling of
5782 copy_relocs_.
5783 * Makefile.am (CCFILES): Add copy-relocs.cc.
5784 (HFILES): Add copy-relocs.h.
5785
4f4995b6
ILT
5786 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5787
85c7bf8b
ILT
5788 * testsuite/script_test_4.sh: Permit leading zeroes.
5789
4f2a9edd
ILT
57902008-04-15 Ian Lance Taylor <iant@google.com>
5791
e6188289
ILT
5792 * script-sections.cc (Script_sections::create_segments): Use
5793 header_size_adjustment even when there is enough room for the
5794 headers.
5795 * testsuite/script_test_4.sh: New file.
5796 * testsuite/script_test_4.t: New file.
5797 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5798 (check_DATA): Add script_test_4.stdout.
5799 (MOSTLYCLEANFILES): Likewise.
5800 (script_test_4): New target.
5801 (script_test_4.stdout): New target.
5802 * testsuite/Makefile.in: Rebuild.
5803
4f2a9edd
ILT
5804 * sparc.cc: Add definitions for Output_data_plt_sparc class
5805 constants.
5806
f5314dd5
DM
58072008-04-14 David S. Miller <davem@davemloft.net>
5808
5809 * sparc.cc: New file.
5810 * Makefile.am (TARGETSOURCES): Add sparc.cc
5811 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5812 * configure.tgt: Document targ_extra_size and
5813 targ_extra_big_endian. Add entries for sparc-* and
5814 sparc64-*.
5815 * configure.ac: Handle targ_extra_size and
5816 targ_extra_big_endian.
5817 * Makefile.in: Rebuild.
5818 * configure: Likewise.
5819 * po/POTFILES.in: Likewise.
5820 * po/gold.pot: Likewise.
5821
154e0e9a
ILT
58222008-04-14 Ian Lance Taylor <iant@google.com>
5823
5824 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5825 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5826 in the name/type/flags to section mapping. Don't call
5827 allocate_output_section.
5828 (Layout::choose_output_section): Change parameter from adjust_name
5829 to is_input_section. Don't permit input sections after sections
5830 are attached to segments. Don't call allocate_output_section.
5831 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5832 not write_enable_output_section.
5833 (Layout::make_output_section): Don't push to
5834 unattached_section_list_ nor call attach_to_segment. Call
5835 attach_section_to_segment if sections are attached.
5836 (Layout::attach_sections_to_segments): New function.
5837 (Layout::attach_section_to_segment): New function.
5838 (Layout::attach_allocated_section_to_segment): Rename from
5839 attach_to_segment. Remove flags parameter.
5840 (Layout::allocate_output_section): Remove function.
5841 (Layout::write_enable_output_section): Remove function.
5842 * layout.h (class Layout): Update for above changes. Add new
5843 field sections_are_attached_.
5844 * output.h (Output_section::update_flags_for_input_section): New
5845 function.
5846 * output.cc (Output_section::add_input_section): Call
5847 update_flags_for_input_section.
5848 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5849
009a67a2
CC
58502008-04-11 Cary Coutant <ccoutant@google.com>
5851
5852 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5853 thought unnecessary.
5854 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5855
759b1a24
ILT
58562008-04-11 Ian Lance Taylor <iant@google.com>
5857
5858 * output.h (class Output_section_data): Remove inline definition
5859 of set_addralign.
5860 * output.cc (Output_section_data::set_addralign): New function.
5861
c2b45e22
CC
58622008-04-11 Cary Coutant <ccoutant@google.com>
5863
5864 Add support for TLS descriptors for i386 and x86_64.
5865 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5866 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5867 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5868 GOT_TYPE_TLS_DESC.
5869 (Target_i386::got_mod_index_entry): Remove unnecessary code.
5870 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5871 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
5872 relocations.
5873 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5874 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5875 Fix problem with initial-exec relocations.
5876 (Target_i386::Relocate::relocate_tls): Likewise.
5877 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5878 relaxation.
5879 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5880 support for section-plus-offset dynamic table entries.
5881 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5882 (Output_data_dynamic::Dynamic_entry): Add support for
5883 section-plus-offset dynamic table entries.
5884 (Output_data_dynamic::Classification): Likewise.
5885 (Output_data_dynamic::classification_): Renamed offset_.
5886 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5887 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5888 (Target_x86_64::make_plt_section): New function.
5889 (Target_x86_64::reserve_tlsdesc_entries): New function.
5890 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5891 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5892 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5893 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5894 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5895 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5896 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5897 add extra PLT entry for TLS descriptors.
5898 (Output_data_plt_x86_64::got_): New field.
5899 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5900 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5901 fields.
5902 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5903 descriptors.
5904 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5905 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5906 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5907 R_386_TLS_DESC_CALL relocations.
5908 (Target_x86_64::Scan::global): Likewise.
5909 (Target_x86_64::do_finalize_sections): Add dynamic table entries
5910 for TLS descriptors.
5911 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
5912 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
5913 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
5914 GD-to-IE relaxation.
5915 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
5916 and TLS_DESCRIPTORS.
5917 * Makefile.in: Rebuild.
5918 * configure: Rebuild.
5919 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
5920 (tls_test_shared2.so): New target.
5921 (tls_shared_gd_to_ie_test_SOURCES): New variable.
5922 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
5923 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
5924 (tls_shared_gd_to_ie_test_LDADD): New variable.
5925 (tls_shared_gnu2_gd_to_ie_test): New target.
5926 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
5927 New targets.
5928 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
5929 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
5930 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
5931 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
5932 (tls_shared_gnu2_test): New target.
5933 (tls_test_gnu2_shared.so): New target.
5934 (tls_shared_gnu2_test_SOURCES): New variable.
5935 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
5936 (tls_shared_gnu2_test_LDFLAGS): New variable.
5937 (tls_shared_gnu2_test_LDADD): New variable.
5938 * testsuite/Makefile.in: Rebuild.
5939 * testsuite/Makefile.
5940
83bfb6b7
ILT
59412008-04-11 Ian Lance Taylor <iant@google.com>
5942
5943 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
5944 justsyms.t.
5945 * testsuite/Makefile.in: Rebuild.
5946
5947 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
5948 long.
5949 * testsuite/script_test_2.cc (main): Adjust test.
5950
706e1f5e
ILT
59512008-04-11 David S. Miller <davem@davemloft.net>
5952 Ian Lance Taylor <iant@google.com>
5953
5954 * options.h (General_options): Add entries for '-Y' and
5955 '-relax'.
5956 * options.cc (General_options:finalize): If -Y was used, add those
5957 entries to the library path instead of the default "/lib" and
5958 "/usr/lib".
5959
7c98e6bb
DM
59602008-04-11 David S. Miller <davem@davemloft.net>
5961
5962 * testsuite/justsyms.t: Start at 0x100.
5963 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
5964 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
5965 long.
5966 * testsuite/script_test_2.cc: Adjust string and section length
5967 checks.
7c98e6bb 5968
99a37bfd
ILT
59692008-04-09 Ian Lance Taylor <iant@google.com>
5970
2cefc357
ILT
5971 PR gold/5996
5972 * script-sections.cc (Sections_element::allocate_to_segment): Add
5973 orphan parameter.
5974 (Output_section_definition::allocate_to_segment): Likewise.
5975 (Orphan_output_section::allocate_to_segment): Likewise.
5976 (Script_sections::attach_sections_using_phdrs_clause): Don't
5977 propagate non-PT_LOAD segments to orphan sections.
5978 * testsuite/Makefile.am (script_test_3.stdout): Generate using
5979 readelf rather than objdump.
5980 * testsuite/script_test_3.sh: Adjust accordingly. Test that
5981 .interp section and PT_INTERP segment are the same size.
5982 * testsuite/Makefile.in: Rebuild.
5983
99a37bfd
ILT
5984 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
5985 aliases for symbols defined in the same object.
5986 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5987 (weak_alias_test_SOURCES): New variable.
5988 (weak_alias_test_DEPENDENCIES): New variable.
5989 (weak_alias_test_LDFLAGS): New variable.
5990 (weak_alias_test_LDADD): New variable.
5991 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5992 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5993 (weak_alias_test_3.o): New target.
5994 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5995 * testsuite/weak_alias_test_main.cc: New file.
5996 * testsuite/weak_alias_test_1.cc: New file.
5997 * testsuite/weak_alias_test_2.cc: New file.
5998 * testsuite/weak_alias_test_3.cc: New file.
5999
780e49c5
ILT
60002008-04-08 Ian Lance Taylor <iant@google.com>
6001
cdb0b8f5
ILT
6002 * options.h (class General_options): Add --noinhibit-exec option.
6003 * main.cc (main): Check --noinhibit-exec.
6004
0864d551
ILT
6005 * options.h (class General_options): Define --wrap as a special
6006 option. Add wrap_symbols_ field.
6007 (General_options::any_wrap_symbols): New function.
6008 (General_options::is_wrap_symbol): New function.
6009 * options.cc (General_options::parse_wrap): New function.
6010 (General_options::General_options): Initialize wrap_symbols_.
6011 * symtab.cc (Symbol_table::wrap_symbol): New function.
6012 (Symbol_table::add_from_object): Handle --wrap.
6013 * symtab.h (class Symbol_table): Declare wrap_symbol.
6014 * target.h (Target::wrap_char): New function.
6015 (Target::Target_info): Add wrap_char field.
6016 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6017 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6018 * testsuite/testfile.cc (Target_test::test_target_info):
6019 Likewise.
6020
789aa6de
ILT
6021 * errors.cc (Errors::undefined_symbol): Mention symbol version if
6022 there is one.
6023
2c38906f
ILT
6024 * layout.h (class Layout): Add added_eh_frame_data_ field.
6025 * layout.cc (Layout::Layout): Initialize new field.
6026 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6027 output section until we find a section we merged successfully.
6028 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6029 that the size be non-zero.
6030
780e49c5
ILT
6031 * merge.cc (Object_merge_map::get_output_offset): Remove inline
6032 qualifier.
6033
7fcd0256
ILT
60342008-04-08 Craig Silverstein <csilvers@google.com>
6035
6036 * configure.ac: Export new conditional variable HAVE_ZLIB.
6037 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6038 on HAVE_ZLIB.
6039 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6040 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6041
6835af53
ILT
60422008-04-07 Ian Lance Taylor <iant@google.com>
6043
e24f324c
ILT
6044 * version.cc (version_string): Set to "1.5".
6045
a036edd8
ILT
6046 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6047 Add issued_non_pic_error_ field. Declare check_non_pic.
6048 (Target_x86_64::Scan::check_non_pic): New function.
6049 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6050 (Target_x86_64::Scan::global): Likewise.
6051
624f8810
ILT
6052 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6053 addend parameter. Change caller. Handle merge sections.
6054 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6055 Address to Addend. Don't add in the result of
6056 local_section_offset, pass down the addend and use the returned
6057 value.
6058 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6059 Update declarations of local_section_offset and symbol_value.
6060 * testsuite/two_file_test_1.cc (t18): New function.
6061 * testsuite/two_file_test_2.cc (f18): New function.
6062 * testsuite/two_file_test_main.cc (main): Call t18.
6063 * testsuite/two_file_test.h (t18, f18): Declare.
6064
6835af53
ILT
6065 * configure.ac: Don't test for objdump, c++filt, or readelf.
6066 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6067 conditionals.
6068 (TEST_READELF): New variable.
6069 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6070 (check_PROGRAMS): Add two_file_strip_test.
6071 (two_file_strip_test): New target.
6072 (check_PROGRAMS): Add two_file_same_shared_strip_test.
6073 (two_file_same_shared_strip_test_SOURCES): New variable.
6074 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6075 (two_file_same_shared_strip_test_LDFLAGS): New variable.
6076 (two_file_same_shared_strip_test_LDADD): New variable.
6077 (two_file_shared_strip.so): New target.
6078 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6079 (ver_test_5.syms, ver_test_7.syms): Likewise.
6080 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6081 (strip_test_3.stdout): Use TEST_OBJDUMP.
6082 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6083
86925eef
CC
60842008-04-04 Cary Coutant <ccoutant@google.com>
6085
6086 * symtab.h (Symbol::is_weak_undefined): New function.
6087 (Symbol::is_strong_undefined): New function.
6088 (Symbol::is_absolute): New function.
6089 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6090 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6091 absolute symbols.
6092 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6093 (weak_undef_test): New target.
6094 * testsuite/Makefile.in: Rebuild.
6095 * testsuite/weak_undef_file1.cc: New file.
6096 * testsuite/weak_undef_file2.cc: New file.
6097 * testsuite/weak_undef_test.cc: New file.
6098
126f3ece
ILT
60992008-04-03 Craig Silverstein <csilvers@google.com>
6100
6101 * compressed_output.h (class Output_compressed_section): Use
6102 unsigned buffer.
6103 * compressed_output.cc (zlib_compress): Use unsigned buffers,
6104 add zlib header.
6105 (zlib_compressed_suffix): Removed.
6106 (Output_compressed_section::set_final_data_size): Use unsigned
6107 buffers.
6108 * testsuite/Makefile.am (flagstest_compress_debug_sections):
6109 Fix linker invocation.
6110 (flagstest_o_specialfile_and_compress_debug_sections):
6111 Likewise.
6112 * testsuite/Makefile.in: Regenerated.
6113
deae2a14
DM
61142008-04-02 David S. Miller <davem@davemloft.net>
6115
6116 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6117 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6118
70752818
ILT
61192008-04-02 Craig Silverstein <csilvers@google.com>
6120
6121 * TODO: New file.
6122
39d0cb0e
ILT
61232008-04-02 Ian Lance Taylor <iant@google.com>
6124
6125 * fileread.cc (File_read::find_view): Add byteshift and vshifted
6126 parameters. Update for new key type to views_. Change all
6127 callers.
6128 (File_read::read): Adjust for byteshift in returned view.
6129 (File_read::add_view): New function, broken out of
6130 find_and_make_view.
6131 (File_read::make_view): New function, broken out of
6132 find_and_make_view.
6133 (File_read::find_or_make_view): Add offset and aligned
6134 parameters. Rewrite accordingly. Change all callers.
6135 (File_read::get_view): Add offset and aligned parameters. Adjust
6136 for byteshift in return value.
6137 (File_read::get_lasting_view): Likewise.
6138 * fileread.h (class File_read): Update declarations.
6139 (class File_read::View): Add byteshift_ field. Add byteshift to
6140 constructor. Add byteshift method.
6141 * archive.h (Archive::clear_uncached_views): New function.
6142 (Archive::get_view): Add aligned parameter. Change all callers.
6143 * object.h (Object::get_view): Add aligned parameter. Change all
6144 callers.
6145 (Object::get_lasting_view): Likewise.
6146
6147 * fileread.cc (File_read::release): Don't call clear_views if
6148 there are multiple objects.
6149 * fileread.h (File_read::clear_uncached_views): New function.
6150 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6151 on the archive.
6152
a1207466
CC
61532008-03-31 Cary Coutant <ccoutant@google.com>
6154
6155 Add thin archive support.
6156 * archive.cc (Archive::armagt): New const.
6157 (Archive::setup): Remove task parameter and calls to unlock.
6158 (Archive::unlock_nested_archives): New function.
6159 (Archive::read_header): Add nested_off parameter. Change
6160 all callers.
6161 (Archive::interpret_header): Likewise.
6162 (Archive::include_all_members): Change to handle thin
6163 archives.
6164 (Archive::include_member): Likewise.
6165 * archive.h (Archive::Archive): Add new parameters and
6166 initializers.
6167 (Archive::armagt): New const.
6168 (Archive::setup): Remove task parameter.
6169 (Archive::unlock_nested_archives): New function.
6170 (Archive::read_header): Add nested_off parameter.
6171 (Archive::interpret_header): Likewise.
6172 (Archive::Nested_archive_table): New typedef.
6173 (Archive::is_thin_archive_): New field.
6174 (Archive::nested_archives_): New field.
6175 (Archive::options_): New field.
6176 (Archive::dirpath_): New field.
6177 (Archive::task_): New field.
6178 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6179 for thin archives. Pass additional parameters to
6180 Archive::Archive. Unlock the archive file after calling
6181 Archive::setup.
cd536b21 6182
479f6503
ILT
61832008-03-29 Ian Lance Taylor <iant@google.com>
6184
686c8caf
ILT
6185 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6186 version symbol to be local.
6187 * testsuite/ver_test_4.sh: New file.
6188 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6189 (check_DATA): Add ver_test_4.syms.
6190 (ver_test_4.syms): New target.
6191 * testsuite/Makefile.in: Rebuild.
6192
ab794b6b
ILT
6193 * output.cc
6194 (Output_section::Input_section_sort_entry::has_priority): New
6195 function.
6196 (Output_section::Input_section_sort_entry::match_file_name): New
6197 function.
6198 (Output_section::Input_section_sort_entry::match_section_name):
6199 Remove.
6200 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6201 Remove.
6202 (Output_section::Input_section_sort_entry::match_section_file):
6203 Remove.
6204 (Output_section::Input_section_sort_compare::operator()): Rewrite
6205 using new Input_section_sort_entry functions. Sort crtbegin and
6206 crtend first. Sort sections with no priority before sections with
6207 a priority.
6208 * testsuite/initpri1.c (d3): Check j != 4.
6209 (cd5): New constructor/destructor function.
6210 (main): Check j != 2.
6211
479f6503
ILT
6212 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6213 new symbol when resolving, don't call set_is_default.
6214 * testsuite/ver_test_7.cc: New file.
6215 * testsuite/ver_test_7.sh: New file.
6216 * testsuite/Makefile.am (ver_test_7.so): New target.
6217 (ver_test_7.o): New target.
6218 (check_SCRIPTS): Add ver_test_7.sh.
6219 (check_DATA): Add ver_test_7.syms.
6220 (ver_test_7.syms): New target.
6221
2fd32231
ILT
62222008-03-28 Ian Lance Taylor <iant@google.com>
6223
6224 * layout.cc (Layout::layout): If we see an input section with a
6225 name that needs sorting, set the must_sort flag for the output
6226 section.
6227 (Layout::make_output_section): If the name of the output section
6228 indicates that it might require sorting, set the may_sort flag.
6229 * output.h (Output_section::may_sort_attached_input_sections): New
6230 function.
6231 (Output_section::set_may_sort_attached_input_sections): New
6232 function.
6233 (Output_section::must_sort_attached_input_sections): New
6234 function.
6235 (Output_section::set_must_sort_attached_input_sections): New
6236 function.
6237 (class Output_section): Declare Input_section_sort_entry. Define
6238 Input_section_sort_compare. Declare
6239 sort_attached_input_sections. Add new fields:
6240 may_sort_attached_input_sections_,
6241 must_sort_attached_input_sections_,
6242 attached_input_sections_are_sorted_.
6243 * output.cc (Output_section::Output_section): Initialize new
6244 fields.
6245 (Output_section::add_input_section): Add an entry to
6246 input_sections_ if may_sort or must_sort are true.
6247 (Output_section::set_final_data_size): Call
6248 sort_attached_input_sections if necessary.
6249 (Output_section::Input_section_sort_entry): Define new class.
6250 (Output_section::Input_section_sort_compare::operator()): New
6251 function.
6252 (Output_section::sort_attached_input_sections): New function.
6253 * configure.ac: Check whether the compiler supports constructor
6254 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6255 * testsuite/initpri1.c: New file.
6256 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6257 CONSTRUCTOR_PRIORITY.
6258 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6259 (initpri1_LDFLAGS): New variable.
6260 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6261
18e6b24e
ILT
62622008-03-27 Ian Lance Taylor <iant@google.com>
6263
49bdd526
ILT
6264 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6265 * testsuite/common_test_1.c: New file.
6266 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6267 (common_test_1_SOURCES): New variable.
6268 (common_test_1_DEPENDENCIES): New variable.
6269 (common_test_1_LDFLAGS): New variable.
6270
18e6b24e
ILT
6271 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6272 and commons_ correctly when NAME/VERSION does not override
6273 NAME/NULL.
6274 * testsuite/ver_test_6.c: New file.
6275 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6276 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6277 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6278
04bf7072
ILT
62792008-03-26 Ian Lance Taylor <iant@google.com>
6280
5871526f
ILT
6281 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6282 of an undefined symbol from a version script.
6283 * testsuite/Makefile.am (ver_test_5.so): New target.
6284 (ver_test_5.o): New target.
6285 (check_SCRIPTS): Add ver_test_5.sh.
6286 (check_DATA): Add ver_test_5.syms.
6287 (ver_test_5.syms): New target.
6288 * testsuite/ver_test_5.cc: New file.
6289 * testsuite/ver_test_5.script: New file.
6290 * testsuite/ver_test_5.sh: New file.
6291 * Makefile.in, testsuite/Makefile.in: Rebuild.
6292
04bf7072
ILT
6293 PR gold/5986
6294 Fix problems building gold with gcc 4.3.0.
6295 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6296 (gold_error_at_location, gold_warning_at_location): Use it.
6297 * configure.ac: Check whether we can compile and use a template
6298 function with a printf attribute.
6299 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6300 when jumping over bytes.
6301 * object.cc: Instantiate Object::read_section_data.
6302 * debug.h: Include <cstring>
6303 * dwarf_reader.cc: Include <algorithm>
6304 * main.cc: Include <cstring>.
6305 * options.cc: Include <cstring>.
6306 * output.cc: Include <cstring>.
6307 * script.cc: Include <cstring>.
6308 * script.h: Include <string>.
6309 * symtab.cc: Include <cstring> and <algorithm>.
6310 * target-select.cc: Include <cstring>.
6311 * version.cc: Include <string>.
6312 * testsuite/testmain.cc: Include <cstdlib>.
6313 * configure, config.in: Rebuild.
6314
874c5b28
ILT
63152008-03-25 Ian Lance Taylor <iant@google.com>
6316
819d6c3a
ILT
6317 * options.cc: Include "../bfd/bfdver.h".
6318 (options::help): Print bug reporting address.
6319
f4b2c6f5
ILT
6320 * version.cc (print_version): Adjust output for current value of
6321 BFD_VERSION_STRING.
6322
6323 * NEWS: New file.
6324
e96caa79
ILT
6325 * options.cc (options::help): Print list of supported targets.
6326 * target-select.h: Include <vector>.
6327 (class Target_selector): Make machine_, size_, and is_big_endian_
6328 fields const. Add bfd_name_ and instantiated_target_ fields.
6329 (Target_selector::Target_selector): Add bfd_name parameter.
6330 (Target_selector::recognize): Make non-virtual, call
6331 do_recognize.
6332 (Target_selector::recognize_by_name): Make non-virtual, call
6333 do_recognize_by_name.
6334 (Target_selector::supported_names): New function.
6335 (Target_selector::bfd_name): New function.
6336 (Target_selector::do_instantiate_target): New pure virtual
6337 function.
6338 (Target_selector::do_recognize): New virtual function.
6339 (Target_selector::do_recognize_by_name): New virtual function.
6340 (Target_selector::instantiate_target): New private function.
6341 (supported_target_names): Declare.
6342 * target-select.cc (Target_selector::Target_selector): Update for
6343 new parameter and fields.
6344 (select_target_by_name): Check that the name matches before
6345 calling recognize_by_name.
6346 (supported_target_names): New function.
6347 * i386.cc (class Target_selector_i386): Update Target_selector
6348 constructor call. Remove recognize and recognize_by_name. Add
6349 do_instantiate_target.
6350 * x86_64.cc (class Target_selector_x86_64): Likewise.
6351 * testsuite/testfile.cc (class Target_selector_test): Update for
6352 changes to Target_selector.
6353
874c5b28
ILT
6354 * README: Rewrite, with some notes on unsupported features.
6355
0a65a3a7
CC
63562008-03-24 Cary Coutant <ccoutant@google.com>
6357
6358 * i386.cc (Target_i386::Got_type): New enum declaration.
6359 (Target_i386::Scan::local): Updated callers of Output_data_got
6360 member functions.
6361 (Target_i386::Scan::global): Likewise.
6362 (Target_i386::Relocate::relocate): Likewise.
6363 (Target_i386::Relocate::relocate_tls): Likewise.
6364 * object.h (Got_offset_list): New class.
6365 (Sized_relobj::local_has_got_offset): Added got_type parameter.
6366 (Sized_relobj::local_got_offset): Likewise.
6367 (Sized_relobj::set_local_got_offset): Likewise.
6368 (Sized_relobj::local_has_tls_got_offset): Removed.
6369 (Sized_relobj::local_tls_got_offset): Removed.
6370 (Sized_relobj::set_local_tls_got_offset): Removed.
6371 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6372 * output.cc (Output_data_got::add_global): Added got_type parameter.
6373 (Output_data_got::add_global_with_rel): Likewise.
6374 (Output_data_got::add_global_with_rela): Likewise.
6375 (Output_data_got::add_global_pair_with_rel): New function.
6376 (Output_data_got::add_global_pair_with_rela): New function.
6377 (Output_data_got::add_local): Added got_type parameter.
6378 (Output_data_got::add_local_with_rel): Likewise.
6379 (Output_data_got::add_local_with_rela): Likewise.
6380 (Output_data_got::add_local_pair_with_rel): New function.
6381 (Output_data_got::add_local_pair_with_rela): New function.
6382 (Output_data_got::add_global_tls): Removed.
6383 (Output_data_got::add_global_tls_with_rel): Removed.
6384 (Output_data_got::add_global_tls_with_rela): Removed.
6385 (Output_data_got::add_local_tls): Removed.
6386 (Output_data_got::add_local_tls_with_rel): Removed.
6387 (Output_data_got::add_local_tls_with_rela): Removed.
6388 * output.h (Output_data_got::add_global): Added got_type parameter.
6389 (Output_data_got::add_global_with_rel): Likewise.
6390 (Output_data_got::add_global_with_rela): Likewise.
6391 (Output_data_got::add_global_pair_with_rel): New function.
6392 (Output_data_got::add_global_pair_with_rela): New function.
6393 (Output_data_got::add_local): Added got_type parameter.
6394 (Output_data_got::add_local_with_rel): Likewise.
6395 (Output_data_got::add_local_with_rela): Likewise.
6396 (Output_data_got::add_local_pair_with_rel): New function.
6397 (Output_data_got::add_local_pair_with_rela): New function.
6398 (Output_data_got::add_global_tls): Removed.
6399 (Output_data_got::add_global_tls_with_rel): Removed.
6400 (Output_data_got::add_global_tls_with_rela): Removed.
6401 (Output_data_got::add_local_tls): Removed.
6402 (Output_data_got::add_local_tls_with_rel): Removed.
6403 (Output_data_got::add_local_tls_with_rela): Removed.
6404 * resolve.cc (Symbol::override_base_with_special): Removed
6405 reference to has_got_offset_ field.
6406 * symtab.cc (Symbol::init_fields): Replaced initialization
6407 of got_offset_ with got_offsets_. Removed initialization
6408 of has_got_offset_
53fcba31 6409 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
6410 (Symbol::got_offset): Likewise.
6411 (Symbol::set_got_offset): Likewise.
6412 (Symbol::has_tls_got_offset): Removed.
6413 (Symbol::tls_got_offset): Removed.
6414 (Symbol::set_tls_got_offset): Removed.
6415 (Symbol::got_offset_): Removed.
6416 (Symbol::tls_mod_got_offset_): Removed.
6417 (Symbol::tls_pair_got_offset_): Removed.
6418 (Symbol::got_offsets_): New field.
6419 (Symbol::has_got_offset): Removed.
6420 (Symbol::has_tls_mod_got_offset): Removed.
6421 (Symbol::has_tls_pair_got_offset): Removed.
6422 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6423 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6424 member functions.
6425 (Target_x86_64::Scan::global): Likewise.
6426 (Target_x86_64::Relocate::relocate): Likewise.
6427 (Target_x86_64::Relocate::relocate_tls): Likewise.
6428
bd52eafb
BE
64292008-03-25 Ben Elliston <bje@au.ibm.com>
6430
6431 * yyscript.y: Fix spelling error in comment.
6432
8b105e34
ILT
64332008-03-24 Ian Lance Taylor <iant@google.com>
6434
8ed814a9
ILT
6435 * options.h (class General_options): Define build_id option.
6436 * layout.h (class Layout): Declare write_build_id, create_note,
6437 create_build_id. Add build_id_note_ member.
6438 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6439 "libiberty.h", "md5.h", "sha1.h".
6440 (Layout::Layout): Initialize eh_frame_data_,
6441 eh_frame_hdr_section_, and build_id_note_.
6442 (Layout::finalize): Call create_build_id.
6443 (Layout::create_note): New function, broken out of
6444 Layout::create_gold_note.
6445 (Layout::create_gold_note): Call create_note.
6446 (Layout::create_build_id): New function.
6447 (Layout::write_build_id): New function.
6448 (Close_task_runner::run): Call write_build_id.
6449
8b105e34
ILT
6450 * x86_64.cc: Correct license to GPLv3.
6451
086a1841
ILT
64522008-03-23 Ian Lance Taylor <iant@google.com>
6453
6454 * options.cc: Include "demangle.h".
6455 (parse_optional_string): New function.
6456 (parse_long_option): Handle takes_optional_argument.
6457 (parse_short_option): Update dash_z initializer. Handle
6458 takes_optional_argument.
6459 (General_options::General_options): Initialize do_demangle_.
6460 (General_options::finalize): Set do_demangle_. Handle demangling
6461 style.
6462 * options.h (parse_optional_string): Declare.
6463 (struct One_option): Add optional_arg field. Update constructor.
6464 Update call constructor calls. Add takes_optional_argument
6465 function.
6466 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6467 (DEFINE_optional_string): Define.
6468 (General_options::demangle): Change from DEFINE_bool to
6469 DEFINE_optional_string.
6470 (General_options::no_demangle): New function.
6471 (General_options::do_demangle): New function.
6472 (General_options::set_do_demangle): New function.
6473 (General_options::execstack_status_): Move definition to end of
6474 class definition.
6475 (General_options::static_): Likewise.
6476 (General_options::do_demangle_): New field.
6477 * object.cc (big_endian>::get_symbol_location_info): Call
6478 Options::do_demangle, not Options::demangle.
6479 * symtab.cc (demangle): Likewise.
6480
cbb93e63
ILT
64812008-03-22 Ian Lance Taylor <iant@google.com>
6482
6483 * gold.h: Include <cstddef> and <sys/types.h>
6484 * options.h: Include <cstring>.
6485
ec531623
ILT
64862008-03-21 Ian Lance Taylor <iant@google.com>
6487
6488 * Added source code to GNU binutils.
This page took 0.380146 seconds and 4 git commands to generate.