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