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