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