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