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