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