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