Add a testcase for PR gas/11867.
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
88a4108b
ILT
12010-08-02 Ian Lance Taylor <iant@google.com>
2
3 PR 11855
4 * script.cc (Script_options::Script_options): Initialize
5 symbol_definitions_ and symbol_references_.
6 (Script_options::add_symbol_assignment): Update
7 symbol_definitions_ and symbol_references_.
8 (Script_options::add_symbol_reference): New function.
9 (script_symbol): New function.
10 * script.h (class Script_options): Add symbol_definitions_ and
11 symbol_references_ fields.
12 (Script_options::referenced_const_iterator): New type.
13 (Script_options::referenced_begin): New function.
14 (Script_options::referenced_end): New function.
15 (Script_options::is_referenced): New function.
16 (Script_options::any_unreferenced): New function.
17 * script-c.h (script_symbol): Declare.
18 * yyscript.y (exp): Call script_symbol.
19 * symtab.cc: Include "script.h".
20 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
21 Change all callers. Check symbols referenced by scripts.
22 (Symbol_table::add_undefined_symbols_from_command_line): Add
23 layout parameter. Change all callers.
24 (Symbol_table::do_add_undefined_symbols_from_command_line):
25 Likewise. Break out loop body. Check symbols referenced by
26 scripts.
27 (Symbol_table::add_undefined_symbol_from_command_line): New
28 function broken out of
29 do_add_undefined_symbols_from_command_line.
30 * symtab.h (class Symbol_table): Update declarations.
31 * archive.cc: Include "layout.h".
32 (Archive::should_include_member): Add layout parameter. Change
33 all callers. Check for symbol mentioned in expression.
34 * archive.h (class Archive): Update declaration.
35 * object.cc (Sized_relobj::do_should_include_member): Add layout
36 parameter.
37 * object.h (Object::should_include_member): Add layout parameter.
38 Change all callers.
39 (Object::do_should_include_member): Add layout parameter.
40 (class Sized_relobj): Update declaration.
41 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
42 parameter.
43 * dynobj.h (class Sized_dynobj): Update declaration.
44 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
45 layout parameter.
46 * plugin.h (class Sized_pluginobj): Update declaration.
47
5f1ab67a
ILT
482010-08-02 Ian Lance Taylor <iant@google.com>
49
50 PR 11866
51 * output.cc (Output_segment::set_offset): Search for the first and
52 last sections rather than assuming that the list is in order.
53 (Output_segment::find_first_and_last_list): New function.
54 * output.h (class Output_segment): Update declarations.
55 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
56 (relro_strip_test_SOURCES): New variable.
57 (relro_strip_test_DEPENDENCIES): New variable.
58 (relro_strip_test_LDFLAGS): New variable.
59 (relro_strip_test_LDADD): New variable.
60 (relro_strip_test.so): New target.
61
a8df5856
ILT
622010-08-02 Ian Lance Taylor <iant@google.com>
63
64 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
65 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
66 (Target_i386::got_tlsdesc_section): New function.
67 (Target_i386::got_section): Create space for GOT entries for
68 TLSDESC relocations.
69 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
70 R_386_TLS_GOTDESC.
71 (Target_i386::Scan::global): Likewise.
72 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
73 using TLSDESC GOT.
74 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
75 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
76 (Target_x86_64::got_tlsdesc_section): New function.
77 (Target_x86_64::got_section): Create space for GOT entries for
78 TLSDESC relocations.
79 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
80 R_386_TLS_GOTDESC.
81 (Target_x86_64::Scan::global): Likewise.
82 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
83 using TLSDESC GOT.
84
0c10a0a6
ILT
852010-08-02 Ian Lance Taylor <iant@google.com>
86
87 * testsuite/final_layout.sh: Use dc to convert from hex to
88 decimal.
89
41cbeecc
ST
902010-07-29 Sriraman Tallam <tmsriram@google.com>
91
92 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
93 paramter to the call to gold::gc_process_relocs.
94 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
95 paramter to the call to gold::gc_process_relocs.
96 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
97 parameter to the call to gold::gc_process_relocs.
98 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
99 template parameter to the call to gold::gc_process_relocs.
100 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
101 paramter to the call to gold::gc_process_relocs.
102 * gc.h (get_embedded_addend_size): New function.
103 (gc_process_relocs): Save the size of the reloc for use by ICF.
104 * icf.cc (get_section_contents): Get the addend from the text section
105 for SHT_REL relocation sections.
106 * icf.h (Icf::Reloc_addend_size_info): New typedef.
107 (Icf::Reloc_info): Add new member reloc_addend_size_info.
108 * int_encoding.h (read_from_pointer): New overloaded function.
109 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
110 * testsuite/icf_sht_rel_addend_test.sh: New file.
111 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
112 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
113
6ea55b82
RW
1142010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
115
116 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
117 * Makefile.in: Regenerate.
118 * testsuite/Makefile.in: Regenerate.
119
9691462b
ILT
1202010-07-27 Jeffrey Yasskin <jyasskin@google.com>
121
122 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
123 * gold/testsuite/debug_msg.cc: Likewise.
124 * gold/testsuite/odr_violation1.cc
125 * gold/testsuite/odr_violation2.cc
126
76897331
CC
1272010-07-21 Cary Coutant <ccoutant@google.com>
128
129 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
130 string, and length fields.
131 (Output_merge_string::Merged_strings_list): New type.
132 (Output_merge_string::Merged_strings_lists): New typedef.
133 (Output_merge_string): Replace merged_strings_ with
134 merged_strings_lists_.
135 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
136 Merged_strings_list per input object and section. Don't store pointer
137 to the string. Don't store length with each merged string entry.
138 (Output_merge_string::finalize_merged_data): Loop over list of merged
139 strings lists. Recompute length of each merged string.
140
78384e8f
CC
1412010-07-15 Cary Coutant <ccoutant@google.com>
142
143 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
144 here.
145
783659f9
ILT
1462010-07-14 Ian Lance Taylor <iant@google.com>
147
148 * descriptors.cc (Descriptors::open): Report correct name in error
149 message.
150
131687b4
DK
1512010-07-13 Doug Kwan <dougkwan@google.com>
152
153 * arm.cc (Arm_input_section::Arm_input_section): For a
154 SHT_ARM_EXIDX section, always keeps the input sections.
155 (Arm_input_section::set_exidx_section_link): New method.
156 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
157 has_errors_ to false.
158 (Arm_exidx_input_section::has_errors,
159 Arm_exidx_input_section::set_has_errors): New methods.
160 (Arm_exidx_input_section::has_errors_): New data member.
161 (Arm_relobj::get_exidx_shndx_list): New method.
162 (Arm_output_section::append_text_sections_to_list): Do not skip
163 section without SHF_EXECINSTR.
164 (Arm_output_section::fix_exidx_coverage): Skip input sections with
165 errors.
166 (Arm_relobj::make_exidx_input_section): Add new parameter for text
167 section header. Make error messages more verbose. Check for
168 a non-executable section linked to an EXIDX section.
169 (Arm_relobj::do_read_symbols): Remove error checking, which has been
170 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
171 check that there is no deferred EXIDX section if we exit early.
172 Instead of not making an EXIDX section in case of an error, make one
173 and set the has_errors flag of it.
174 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
175 in a relocatable link.
176 (Target_arm::do_relax): Look for the EXIDX output section instead of
177 assuming that it is called .ARM.exidx.
178 (Target_arm::fix_exidx_coverage): Add a new parameter for input
179 section list. Do not check for SHF_EXECINSTR section flags but
180 skip any input section with errors.
181 * output.cc (Output_section::Output_section): Initialize
182 always_keeps_input_sections_ to false.
183 (Output_section::add_input_section): Check for
184 always_keeps_input_sections_.
185 * output.h (Output_section::always_keeps_input_sections,
186 Output_section::set_always_keeps_input_sections): New methods.
187 (Output_section::always_keeps_input_sections): New data member.
188
69517287
RÁE
1892010-07-13 Rafael Espindola <espindola@google.com>
190
191 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
192 * fileread.h (Input_file): Add try_extra_search_path and find_file.
193
82742395
ILT
1942010-07-13 Philip Herron <herron.philip@googlemail.com>
195 Ian Lance Taylor <iant@google.com>
196
197 * output.h (Output_section_lookup_maps::add_merge_section):
198 Correct check of whether value was inserted.
199 (Output_section_lookup_maps::add_merge_input_section): Likewise.
200 (Output_section_lookup_maps::add_relaxed_input_section):
201 Likewise.
202 * arm.cc (Target_arm::got_section): Remove used local os.
203 * i386.cc (Target_i386::got_section): Likewise.
204 * x86_64.cc (Target_x86_64::got_section): Likewise.
205 * sparc.cc (Target_sparc::got_section): Likewise.
206 (Target_sparc::relocate): Remove unused local have_got_offset.
207 * powerpc.cc (Target_powerpc::relocate): Likewise.
208
f2d707b5
ILT
2092010-07-13 Ian Lance Taylor <iant@google.com>
210
241531d6
ILT
211 * compressed_output.cc (zlib_decompress): Fix signature in
212 !HAVE_ZLIB_H case.
213
f2d707b5
ILT
214 * archive.cc (Archive::include_member): Unlock an external member
215 of a thin archive. Don't bother to delete an object we know is
216 NULL.
217
a2e47362
CC
2182010-07-12 Cary Coutant <ccoutant@google.com>
219
220 * compressed_output.cc (zlib_decompress): New function.
221 (get_uncompressed_size): New function.
222 (decompress_input_section): New function.
223 * compressed_output.h (get_uncompressed_size): New function.
224 (decompress_input_section): New function.
225 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
226 Handle compressed debug sections.
227 * layout.cc (is_compressed_debug_section): New function.
228 (Layout::output_section_name): Map compressed section names to
229 canonical names.
230 * layout.h (is_compressed_debug_section): New function.
231 (is_debug_info_section): Recognize compressed debug sections.
232 * merge.cc: Include compressed_output.h.
233 (Output_merge_data::do_add_input_section): Handle compressed
234 debug sections.
235 (Output_merge_string::do_add_input_section): Handle compressed
236 debug sections.
237 * object.cc: Include compressed_output.h.
238 (Sized_relobj::Sized_relobj): Initialize new data members.
239 (build_compressed_section_map): New function.
240 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
241 * object.h (Object::section_is_compressed): New method.
242 (Object::do_section_is_compressed): New method.
243 (Sized_relobj::Compressed_section_map): New type.
244 (Sized_relobj::do_section_is_compressed): New method.
245 (Sized_relobj::compressed_sections_): New data member.
246 * output.cc (Output_section::add_input_section): Handle compressed
247 debug sections.
248 * reloc.cc: Include compressed_output.h.
249 (Sized_relobj::write_sections): Handle compressed debug sections.
250
ce279a62
CC
2512010-07-08 Cary Coutant <ccoutant@google.com>
252
253 * resolve.cc (Symbol_table::resolve): Remember whether undef was
254 weak when resolving to a dynamic def.
255 (Symbol_table::should_override): Add adjust_dyndef flag; set it
256 for weak undef/dynamic def cases. Adjust callers.
257 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
258 undef_binding_weak_.
259 (Symbol_table::sized_write_globals): Adjust symbol binding.
260 (Symbol_table::sized_write_symbol): Add binding parameter.
261 * symtab.h (Symbol::set_undef_binding): New method.
262 (Symbol::is_undef_binding_weak): New method.
263 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
264 (Symbol_table::should_override): Add new parameter.
265 (Symbol_table::sized_write_symbol): Add new parameter.
266
267 * testsuite/weak_undef_file1.cc: Add new test case.
268 * testsuite/weak_undef_file2.cc: Fix header comment.
269 * testsuite/weak_undef_test.cc: Add new test case.
270
b2286c10
DK
2712010-06-29 Doug Kwan <dougkwan@google.com>
272
273 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
274 Initialize USE_SYMBOL_.
275 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
276 definition.
277 (Arm_reloc_property::uses_symbol_): New data member declaration.
278 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
279 uses symbol value and symbol is undefined but not weakly undefined.
280
4802450a
RÁE
2812010-06-28 Rafael Espindola <espindola@google.com>
282
283 * plugin.cc (Plugin::load): Use dlerror.
284
e5ca47ba
ILT
2852010-06-26 Jeffrey Yaskin <jyasskin@google.com>
286
287 * symtab.cc (detect_odr_violations): When reporting an ODR
288 violation, report an object where the symbol is defined.
289
8a75a161
DK
2902010-06-25 Doug Kwan <dougkwan@google.com>
291
292 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
293 (Target_arm::section_may_have_icf_unsafe_pointers): New method
294 definition.
295 (Target_arm::Scan::local_reloc_may_be_function_pointer,
296 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
297 target hook to detect function points.
298 (Target_arm::Scan::possible_function_pointer_reloc): New method.
299 * icf.h (Icf::check_section_for_function_pointers): Change type of
300 parameter SECTION_NAME to const reference to std::string. Use
301 target hook to determine if section may have unsafe pointers.
302 * target.h (Target::section_may_have_icf_unsafe_pointers): New
303 method definition.
304
42218b9f
RÁE
3052010-06-21 Rafael Espindola <espindola@google.com>
306
307 * fileread.cc (Input_file::find_fie): New
308 (Input_file::open): Use Input_file::find_fie.
309 * fileread.h (Input_file::find_fie): New
310 * plugin.cc (set_extra_library_path): New.
311 (Plugin::load): Add set_extra_library_path to the transfer vector.
312 (Plugin_manager::set_extra_library_path): New.
313 (Plugin_manager::add_input_file): Use the extra search path if set.
314 (set_extra_library_path(): New.
315 * plugin.h (Plugin_manager): Add set_extra_library_path and
316 extra_search_path_.
317
a0506cca
CC
3182010-06-19 Cary Coutant <ccoutant@google.com>
319
320 * layout.cc (gdb_sections): Add .debug_types.
321 (lines_only_debug_sections): Likewise.
322
6508b958
RÁE
3232010-06-18 Rafael Espindola <espindola@google.com>
324
325 * plugin.cc (add_input_file,add_input_library)
326 (Plugin_manager::add_input_file): Make filename arguments const.
327 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
328 const.
329
3e235302
DK
3302010-06-16 Doug Kwan <dougkwan@google.com>
331
332 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
333 .ARM.attributes section if we have not merged any input
334 attributes sections.
335
106e8a6c
DK
3362010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
337
338 * arm.cc: Allow combining objects with no EABI version
339 information.
340
91ff43fe
RÁE
3412010-06-15 Rafael Espindola <espindola@google.com>
342
343 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
344
68ed838c
ILT
3452010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
346
347 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
348 (struct iovec): Correct !HAVE_READV definition.
349
f3a2388f
CC
3502010-06-10 Cary Coutant <ccoutant@google.com>
351
352 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
353 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
354 reloc sections.
355 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
356
357 PR 11683
358 * symtab.h (Symbol::is_placeholder): New member function.
359 * target-reloc.h (relocate_section): Check for placeholder symbols.
360
361 * testsuite/Makefile.am (plugin_test_8): New test.
362 (plugin_test_9): New test.
363 * testsuite/Makefile.in: Regenerate.
364
e1df38aa
NC
3652010-06-09 Nick Clifton <nickc@redhat.com>
366
367 * yyscript.y (input_list_element): Allow strings prefixed with
368 the '-' character. Treat these as libraries.
369 * script.cc (script_add_library): New function. Adds a library
370 specified by "-l<name>" found in an input script.
371 * script-c.h: Add prototype for script_add_library.
372
25bbe950
DK
3732010-06-07 Doug Kwan <dougkwan@google.com>
374
375 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
376 Restrict stub-group size to be within long conditional branch
377 range when working around cortex-A8 erratum.
378
0f32ea4c
ILT
3792010-06-07 Damien Diederen <dd@crosstwine.com>
380
381 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
382 #ifdef typo.
383
8fe2a369
ST
3842010-06-03 Sriraman Tallam <tmsriram@google.com>
385
386 PR gold/11658
387 * output.cc
388 (Output_section::Input_section_sort_entry::compare_section_ordering):
389 Change to return non-zero correctly.
390 (Output_section::Input_section_sort_section_order_index_compare
391 ::operator()): Change to fix ambiguity in comparisons.
392
6e9ba2ca
ST
3932010-06-01 Sriraman Tallam <tmsriram@google.com>
394
395 * gold.h (is_wildcard_string): New function.
396 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
397 (Layout::layout_eh_frame): Ditto.
398 (Layout::find_section_order_index): New method.
399 (Layout::read_layout_from_file): New method.
400 * layout.h (Layout::find_section_order_index): New method.
401 (Layout::read_layout_from_file): New method.
402 (Layout::input_section_position_): New private member.
403 (Layout::input_section_glob_): New private member.
404 * main.cc (main): Call read_layout_from_file here.
405 * options.h (--section-ordering-file): New option.
406 * output.cc (Output_section::input_section_order_specified_): New
407 member.
408 (Output_section::Output_section): Initialize new member.
409 (Output_section::add_input_section): Add new parameter.
410 Keep input sections when --section-ordering-file is used.
411 (Output_section::set_final_data_size): Sort input sections when
412 section ordering file is specified.
413 (Output_section::Input_section_sort_entry): Add new parameter.
414 Check sorting type.
415 (Output_section::Input_section_sort_entry::compare_section_ordering):
416 New method.
417 (Output_section::Input_section_sort_compare::operator()): Change to
418 consider section_order_index.
419 (Output_section::Input_section_sort_init_fini_compare::operator()):
420 Change to consider section_order_index.
421 (Output_section::Input_section_sort_section_order_index_compare
422 ::operator()): New method.
423 (Output_section::sort_attached_input_sections): Change to sort
424 according to section order when specified.
e1df38aa
NC
425 (Output_section::add_input_section<32, true>): Add new parameter.
426 (Output_section::add_input_section<64, true>): Add new parameter.
427 (Output_section::add_input_section<32, false>): Add new parameter.
428 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
429 * output.h (Output_section::add_input_section): Add new parameter.
430 (Output_section::input_section_order_specified): New
431 method.
432 (Output_section::set_input_section_order_specified): New method.
433 (Input_section::Input_section): Initialize section_order_index_.
434 (Input_section::section_order_index): New method.
435 (Input_section::set_section_order_index): New method.
436 (Input_section::section_order_index_): New member.
437 (Input_section::Input_section_sort_section_order_index_compare): New
438 struct.
439 (Output_section::input_section_order_specified_): New member.
440 * script-sections.cc (is_wildcard_string): Delete and move modified
441 method to gold.h.
442 (Output_section_element_input::Output_section_element_input): Modify
443 call to is_wildcard_string.
444 (Output_section_element_input::Input_section_pattern
445 ::Input_section_pattern): Ditto.
446 (Output_section_element_input::Output_section_element_input): Ditto.
447 * testsuite/Makefile.am (final_layout): New test case.
448 * testsuite/Makefile.in: Regenerate.
449 * testsuite/final_layout.cc: New file.
450 * testsuite/final_layout.sh: New file.
451
3537c84b
RÁE
4522010-06-01 Rafael Espindola <espindola@google.com>
453
454 * plugin.cc (Plugin::load): Pass the output name to the plugin.
455
105b6afd
RÁE
4562010-06-01 Rafael Espindola <espindola@google.com>
457
458 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
459 visibility of symbols.
460
29e11421
DK
4612010-05-27 Doug Kwan <dougkwan@google.com>
462
463 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
464 from start of output section instead of address for a local symbol
465 in a merged or relaxed section when doing a relocatable link.
466
5e0f337e
RÁE
4672010-05-26 Rafael Espindola <espindola@google.com>
468
469 PR 11604
470 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
471 adding sections the garbage collector removed.
472 * gold/testsuite/Makefile.am: Add test.
473 * gold/testsuite/Makefile.in: Regenerate.
474 * gold/testsuite/plugin_test_7.sh: New.
475 * gold/testsuite/plugin_test_7_1.c: New.
476 * gold/testsuite/plugin_test_7_2.c: New.
477
f4187277
RÁE
4782010-05-26 Rafael Espindola <espindola@google.com>
479
480 * script-sections.cc (Output_section_definition::set_section_addresses):
481 Check for --section-start.
482
5c388529
DK
4832010-05-26 Doug Kwan <dougkwan@google.com>
484
485 * arm.cc (Arm_scan_relocatable_relocs): New class.
486 (Target_arm::relocate_special_relocatable): New method.
487 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
488 (Arm_relocate_functions::thumb_branch_common): Same.
489 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
490 instead of Default_scan_relocatable_relocs.
491 * target-reloc.h (relocate_for_relocatable): Let target handle
492 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
493 * target.h (Sized_target::relocate_special_relocatable): New method.
494
bca1c3ae
ILT
4952010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
496
497 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
498
0439c796
DK
4992010-05-23 Doug Kwan <dougkwan@google.com>
500
501 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
502 instead of a cast.
503 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
504 with a direct branch, not a conditional branch, to a stub.
505 * merge.cc (Output_merge_base::record_input_section): New method
506 defintion.
507 (Output_merge_data::do_add_input_section): Record input section if
508 keeps-input-sections flag is set.
509 (Output_merge_string::do_add_input_section): Ditto.
510 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
511 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
512 INPUT_SECTIONS_.
513 (Output_merge_base::keeps_input_sections,
514 Output_merge_base::set_keeps_input_sections,
515 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
516 method definitions.
517 (Output_merge_base::Input_sections): New type declaration.
518 (Output_merge_base::input_sections_begin,
519 Output_merge_base::input_sections_end,
520 Output_merge_base::do_set_keeps_input_sections): New method definitions.
521 (Output_merge_base::bool keeps_input_sections_,
522 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
523 Output_merge_base::input_sections_): New data members.
524 (Output_merge_data::do_set_keeps_input_sections): New method
525 defintion.
526 (Output_merge_string::do_set_keeps_input_sections): Ditto.
527 * output.cc (Output_section::Input_section::relobj): Move method
528 defintion from class declaration to here and handle merge sections.
529 (Output_section::Input_section::shndx): Ditto.
530 (Output_section::Output_section): Remove initializations of removed
531 data members and initialize new data member LOOKUP_MAPS_.
532 (Output_section::add_input_section): Set keeps-input-sections flag
533 for a newly created merge output section as appropriate. Adjust code
534 to use Output_section_lookup_maps class.
535 (Output_section::add_relaxed_input_section): Adjst code for lookup
536 maps code refactoring.
537 (Output_section::add_merge_input_section): Add a new parameter
538 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
539 class. If adding input section to a newly created merge output
540 section fails, remove the new merge section.
541 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 542 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
543 (Output_section::find_merge_section): Ditto.
544 (Output_section::build_lookup_maps): New method defintion.
545 (Output_section::find_relaxed_input_section): Adjust code to use
546 Output_section_lookup_maps class.
547 (Output_section::get_input_sections): Export merge sections. Adjust
548 code to use Output_section_lookup_maps class.
549 (Output_section:::add_script_input_section): Adjust code to use
550 Output_section_lookup_maps class. Update lookup maps for merge
551 sections also.
552 (Output_section::discard_states): Use Output_section_lookup_maps.
553 (Output_section::restore_states): Same.
554 * output.h (Merge_section_properties): Move class defintion out of
555 Output_section.
556 (Output_section_lookup_maps): New class.
557 (Output_section::Input_section::is_merge_section): New method
558 defintion.
559 (Output_section::Input_section::relobj): Move defintion out of class
560 defintion. Declare method only.
561 (Output_section::Input_section::shndx): Ditto.
562 (Output_section::Input_section::output_merge_base): New method defintion.
563 (Output_section::Input_section::u2_.pomb): New union field.
564 (Output_section::Merge_section_by_properties_map,
565 Output_section::Output_section_data_by_input_section_map,
566 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
567 Remove types.
568 (Output_section::add_merge_input_section): Add new parameter
569 KEEPS_INPUT_SECTIONS.
570 (Output_section::build_lookup_maps): New method declaration.
571 (Output_section::merge_section_map_,
572 Output_section::merge_section_by_properties_map_,
573 Output_section::relaxed_input_section_map_,
574 Output_section::is_relaxed_input_section_map_valid_): Remove data
575 members.
576 (Output_section::lookup_maps_): New data member.
577
76295588
L
5782010-05-21 Doug Kwan <dougkwan@google.com>
579
580 PR gold/11619
581 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
582 avoid a compilation error.
583
d103a984
RÁE
5842010-05-19 Rafael Espindola <espindola@google.com>
585
586 * script-sections.cc (Output_section_definition::allocate_to_segment):
587 Update the phdrs_list even when the output section is NULL.
588 * testsuite/Makefile.am: Add test.
589 * testsuite/Makefile.in: Regenerate.
590 * testsuite/script_test_9.cc: New.
591 * testsuite/script_test_9.sh: New.
592 * testsuite/script_test_9.t: New.
593
6625d24e
DK
5942010-05-19 Doug Kwan <dougkwan@google.com>
595
596 * arm.cc (Arm_input_section::original_size): New method.
597 (Arm_input_section::do_addralign): Add a cast.
598 (Arm_input_section::do_output_offset): Remove static cast.
599 (Arm_input_section::original_addralign,
600 Arm_input_section::original_size_): Change type to uint32_t.
601 (Arm_input_section::init): Add safe casts for section alignment
602 and size.
603 (Arm_input_section::set_final_data_size): Do not set address and
604 offset of stub table.
605 (Arm_output_section::fix_exidx_coverage): Change use of of
606 Output_section::Simple_input_section to that of
607 Output_section::Input_section.
608 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
609 except for the first pass.
610 * output.cc (Output_section::get_input_sections): Change type of
611 input_sections to std::list<Input_section>.
612 (Output_section::add_script_input_section): Rename from
613 Output_section::add_simple_input_section. Change type of SIS
614 parameter from Simple_input_section to Input_section.
615 * output.h (Output_section::Simple_input_section): Remove class.
616 (Output_section::Input_section): Change class visibility to public.
617 (Output_section::Input_section::addralign): Use stored alignments
618 for special input sections if set.
619 (Output_section::Input_section::set_addralign): New method.
620 (Output_section::get_input_sections): Change parameter type from
621 list of Simple_input_section to list of Input_section.
622 (Output_section::add_script_input_section): Rename from
623 Output_section::add_simple_input_section. Change first parameter's
624 type from Simple_input_section to Input_section and remove the
625 second and third parameters.
626 * script-sections.cc (Input_section::Input_section_list): Change
627 type to list of Output_section::Input_section/
628 (Input_section_info::Input_section_info): Change parameter type of
629 INPUT_SECTION to Output_section::Input_section.
630 (Input_section_info::input_section): Change return type.
631 (Input_section_info::input_section_): Change type to
632 Output_section::Input_section.
633 (Output_section_element_input::set_section_addresses): Adjust code
634 to use Output_section::Input_section instead of
635 Output_section::Simple_input_section. Adjust code for renaming
636 of Output_section::add_simple_input_section.
637 (Orphan_output_section::set_section_addresses): Ditto.
638
e1e82ea4
RW
6392010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
640
641 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
642 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
643
91e75c8a
RÁE
6442010-05-18 Rafael Espindola <espindola@google.com>
645
646 * options.cc (General_options::finalize): Handle -nostdlib.
647 * options.h (nostdlib): New option.
648 * script.cc (script_add_search_dir): Handle -nostdlib.
649
da59ad79
DK
6502010-05-12 Doug Kwan <dougkwan@google.com>
651
652 * arm.cc (Target_arm::do_finalize_sections): Create an empty
653 attributes section only if there no attributes section after merging.
654 (Target_arm::merge_object_attributes): Move value of
e1df38aa 655 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
656 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
657 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
658 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
659 and arm_attr_merge_7.stdout.
660 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
661 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
662 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
663 arm_attr_merge_7b.o): New rules.
664 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
665 arm_attr_merge_7
666 * testsuite/Makefile.in: Regenerate.
667 * testsuite/arm_attr_merge.sh: New file.
668 * testsuite/arm_attr_merge_[67][ab].s: Same.
669
3e01a7fd
NC
6702010-05-05 Nick Clifton <nickc@redhat.com>
671
672 * po/es.po: Updated Spanish translation.
673
7ad2014a
L
6742010-04-27 H.J. Lu <hongjiu.lu@intel.com>
675
676 * Makefile.am (install-exec-local): Properly install gold as
677 default cross linker.
678 * Makefile.in: Regenerated.
679
4fda8867
NC
6802010-04-27 H.J. Lu <hongjiu.lu@intel.com>
681 Nick Clifton <nickc@redhat.com>
682
683 * configure.ac (install_as_default): Define and set to false
684 unless --enable-gold or --enable-gold=both/gold has been
685 specified.
686 * configure: Regenerate.
687
688 * Makefile.am (install-exec-local): Install the executable as
689 'ld.gold'. If install_as_default is true then also install it as
690 'ld'.
691 * Makefile.in: Regenerated.
692
bd288ea2
ILT
6932010-04-24 Ian Lance Taylor <iant@google.com>
694
695 * layout.cc (Layout::layout_reloc): In relocatable link don't
696 combine reloc sections for grouped sections.
697
ef38fd8a
ST
6982010-04-23 Sriraman Tallam <tmsriram@google.com>
699
700 * gc.h (gc_process_relocs): Pass information on relocs pointing to
701 sections that are not ordinary to icf.
702 * icf.cc (get_section_contents): Handle relocation pointing to section
703 with no object or shndx information.
704 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
705 * testsuite/Makefile.in: Regenerate.
706 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
707 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
708
f6973bdc
ILT
7092010-04-22 Ian Lance Taylor <iant@google.com>
710
711 * expression.cc (Expression::Expression_eval_info): Add
712 result_alignment_pointer field.
713 (Expression::eval_with_dot): Add result_alignment_pointer
714 parameter. Change all callers.
715 (Expression::eval_maybe_dot): Likewise.
716 (class Binary_expression): Add alignment_pointer parameter to
717 left_value and right_value. Change all callers.
718 (BINARY_EXPRESSION): Set result alignment.
719 (class Trinary_expression): Add alignment_pointer parameter to
720 arg2_value and arg3_value. Change all callers.
721 (Trinary_cond::value): Set result alignment.
722 (Max_expression::value, Min_expression::value): Likewise.
723 (Align_expression::value): Likewise.
724 * script-sections.cc (class Sections_element): Add dot_alignment
725 parameter to set_section_addresses virtual function. Update
726 instantiations.
727 (class Output_section_element): Likewise.
728 (Script_sections::create_segments): Add dot_alignment parameter.
729 Change all callers.
730 (Script_sections::create_segments_from_phdrs_clause): Likewise.
731 (Script_sections::set_phdrs_clause_addresses): Likewise.
732 * script-sections.h: Update declarations.
733 * script.h: Update declarations.
734 * output.h (Output_segment::set_minimum_p_align): Don't decrease
735 min_p_align.
736 * testsuite/script_test_3.t: Set large alignment.
737 * testsuite/script_test_3.sh: Make sure that at least one LOAD
738 segment has expected alignment.
739
9c9c98a5
NC
7402010-04-22 Nick Clifton <nickc@redhat.com>
741
742 * po/gold.pot: Updated by the Translation project.
743 * po/vi.po: Updated Vietnamese translation.
744
2253bfba
L
7452010-04-22 H.J. Lu <hongjiu.lu@intel.com>
746
747 * testsuite/Makefile.am (check_PROGRAMS): Add
748 icf_virtual_function_folding_test.
749 * testsuite/Makefile.in: Regenerated.
750
85fdf906
AH
7512010-04-15 Andrew Haley <aph@redhat.com>
752
753 * options.h (merge_exidx_entries): New option.
754 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
755 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
756 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
757 (Target_arm::merge_exidx_entries): New function.
758 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
759 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
760 to Arm_exidx_fixup constructor.
761 Add new arg, merge_exidx_entries.
762 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
763 Arm_output_section::fix_exidx_coverage.
764
ce97fa81
ST
7652010-04-18 Sriraman Tallam <tmsriram@google.com>
766
767 * icf.cc (get_section_contents): Check for preemptible functions.
768 Ignore addend when appropriate.
769 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
770 section folded.
771 (add_from_relobj): Check for section folded.
772 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
773 * symtab.h (should_add_dynsym_entry): Add new parameter.
774 * target-reloc.h (scan_relocs): Check for section folded.
775 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
776 Check reloc types for function pointers in shared objects.
777 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
778 case.
779 (icf_preemptible_functions_test): New test case.
780 (icf_string_merge_test): New test case.
781 * testsuite.Makefile.in: Regenerate.
782 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
783 bar_glob. Refactor code.
784 * testsuite/icf_preemptible_functions_test.cc: New file.
785 * testsuite/icf_preemptible_functions_test.sh: New file.
786 * testsuite/icf_string_merge_test.cc: New file.
787 * testsuite/icf_string_merge_test.sh: New file.
788 * testsuite/icf_virtual_function_folding_test.cc: New file.
789 * testsuite/icf_virtual_function_folding_test.sh: New file.
790
04ceb17c
DK
7912010-04-14 Doug Kwan <dougkwan@google.com>
792
793 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
794 for local symbol recounting if we remove a section due to ICF.
795 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
796 there are no regular objects in input.
797
153e7da4
DK
7982010-04-13 Doug Kwan <dougkwan@google.com>
799
800 * arm.cc (Arm_input_section::set_final_data_size): Compute
801 accurate final data size instead of using current data size.
802
4dbd9faf
DK
8032010-04-09 Doug Kwan <dougkwan@google.com>
804
805 * layout.cc (Layout::choose_output_section): Handle script section
806 types.
807 (Layout::make_output_section_for_script): Add section type parameter.
808 Handle script section types.
809 * layout.h (Layout::make_output_section_for_script): Add section
810 type parameter.
811 * output.cc (Output_section::Output_section): Initialize data member
812 is_noload_.
813 (Output_section::do_reset_address_and_file_offset): Do not set address
814 to 0 if section is a NOLOAD section.
815 * output.h (Output_section::is_noload): New method.
816 (Output_section::set_is_noload): Ditto.
817 (Output_section::is_noload_): New data member.
818 * script-c.h (Script_section_type): New enum type.
819 (struct Parser_output_section_header): Add new file section_type.
820 * script-sections.cc (Sections_element::output_section_name): Add
821 parameter for returning script section type.
822 (Output_section_definition::output_section_name): Ditto.
823 (Output_section_definition::section_type)P; New method.
824 (Output_section_definiton::script_section_type_name): Ditto.
825 (Output_section_definition::script_section_type_): New data member.
826 (Output_section_definition::Output_section_definition): Initialize
827 data member Output_section_definition::script_section_type_.
828 (Output_section_definition::create_sections): Pass script section type
829 to Layout::make_output_section_for_script.
830 (Output_section_definition::output_section_name): Return script
831 section type to caller.
832 (Output_section_definition::set_section_address): Do not advance
833 dot value and load address if section type is NOLOAD. Set address
834 of NOLOAD sections regardless of section flags.
835 (Output_section_definition::print): Print section type if it is
836 not SCRIPT_SECTION_TYPE_NONE.
837 (Output_section_definition::section_type): New method.
838 (Output_section_definition::script_section_type_name): Ditto.
839 (Script_sections::output_section_name): Add new parameter
840 PSECTION_TYPE for returning script section type. Pass it to
841 section elements. Handle discard sections.
842 (Sort_output_sections::operator()): Handle NOLOAD sections.
843 * script-sections.h (Script_sections::Section_type): New enum type.
844 (Script_sections::output_section_name): Add a new parameter for
845 returning script section type.
846 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
847 INFO and NOLOAD.
848 * yyscript.y (union): Add new field SECTION_TYPE.
849 (COPY, DSECT, INFO, NOLOAD): New tokens.
850 (opt_address_and_section_type): Change type to output_section_header.
851 (section_type): New non-terminal
852 (section_header): Handle section type.
2253bfba 853 (opt_address_and_section_type): Return section type value.
4dbd9faf 854
721ea635
L
8552010-04-09 H.J. Lu <hongjiu.lu@intel.com>
856
857 * testsuite/plugin_common_test_1.c (foo): Add prototype.
858 * testsuite/plugin_common_test_2.c (foo): Likewise.
859
6bf924b0
DK
8602010-04-08 Doug Kwan <dougkwan@google.com>
861
862 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
863 Output_merge_data.
864 * output.cc (Output_section::add_merge_input_section): Simplify
865 code and return status of Output_merge_base::add_input_section.
e1df38aa 866 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
867 returns true.
868
24af6f92
DK
8692010-04-07 Doug Kwan <dougkwan@google.com>
870
871 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
872 if section is marked as containing instructions but has no mapping
873 symbols.
874 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
875 correct section index.
876 (Arm_relobj::find_linked_text_section): Ditto.
877
00698fc5
CC
8782010-04-07 Cary Coutant <ccoutant@google.com>
879
880 * archive.cc (include_member): Destroy Read_symbols_data object before
881 releasing file.
882 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
883 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
884 (Read_symbols_data::~Read_symbols_data) New destructor.
885 (Section_relocs::Section_relocs) New constructor.
886 (Section_relocs::~Section_relocs) New destructor.
887 (Read_relocs_data::Read_relocs_data) New constructor.
888 (Read_relocs_data::~Read_relocs_data) New destructor.
889 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
890 pointers to NULL after deleting.
891
7296d933
DK
8922010-04-07 Doug Kwan <dougkwan@google.com>
893
894 * arm.cc: Replace "endianity" with "endianness" in comments.
895 (Arm_exidx_cantunwind): Ditto.
896 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
897 (Arm_relobj::merge_flags_and_attributes): New method.
898 (Arm_relobj::merge_flags_and_attributes_): New data member.
899 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
900 (Arm_relobj::scan_sections_for_stubs): Ditto.
901 (Arm_relobj::do_read_symbols): Check to see if we really want to
902 merge processor-specific flags and attributes. Exit early if
903 an object is empty except for section names and the undefined symbol.
904 (Target_arm::do_finalize_sections): Move check for ELF format to
905 Arm_relobj::do_read_symbols. Merge processor specific flags and
906 attributes from a regular object only when we have determined that
907 it is aapropriate. Do not create an .ARM.attributes section in
908 output if there is no regular input object.
909 (Target_arm::merge_processor_specific_flags): Check
910 --warn-mismatch before printing any error.
911 (Target_arm::merge_object_attributes): Ditto.
912 * gold.cc (queue_middle_tasks): Handle the case in which there is
913 no regular object in input.
914 * options.cc (General_options::parse_EB): New method.
915 (General_options::parse_EL): Same.
916 (General_options::General_options): Initialize endianness_.
917 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
918 New options.
919 (General_options::Endianness): New enum.
920 (General_options::endianness): New method.
921 (General_options::endianness_): New data member.
922 * parameters.cc (Parameters::set_options): Check target endianness.
923 (Parameters::set_target_once): Ditto.
924 (Parameters::check_target_endianness): New method.
925 (parameters_force_valid_target): If either -EL or -EB is specified,
926 use it to define endianness of default target.
927 * parameters.h (Parameters::check_target_endianness): New method
928 declaration.
929 * target.h (class Target): Change "endianity" to "endianness"
930 in comments.
931
efc8d4f2
RW
9322010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
933
934 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
935 * configure: Regenerate.
936 * Makefile.in: Regenerate.
937 * testsuite/Makefile.in: Regenerate.
938
be234d88
CC
9392010-04-06 Cary Coutant <ccoutant@google.com>
940
941 gcc PR lto/42757
942 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
943 prevailing definitions of common symbols.
944 * testsuite/plugin_test_6.sh: New test case.
945 * testsuite/plugin_common_test_1.c: New test case.
946 * testsuite/plugin_common_test_2.c: New test case.
947 * testsuite/Makefile.am (plugin_test_6): New test case.
948 * testsuite/Makefile.in: Regenerate.
949
bd32c6bd
NC
9502010-04-06 Nick Clifton <nickc@redhat.com>
951
952 * po/vi.po: New Vietnamese translation.
953
323c532f
DK
9542010-03-30 Doug Kwan <dougkwan@google.com>
955
956 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
957
4fcd97eb
DK
9582010-03-25 Doug Kwan <dougkwan@google.com>
959
960 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
961 to avoid a conversion warning on a 32-bit host.
962
4ebf39db
ILT
9632010-03-24 Ian Lance Taylor <iant@google.com>
964
965 * testsuite/script_test_3.t: Add a TLS segment.
966 * testsuite/Makefile.am (check_PROGRAMS): Add
967 tls_phdrs_script_test.
968 (tls_phdrs_script_test_SOURCES): Define.
969 (tls_phdrs_script_test_DEPENDENCIES): Define.
970 (tls_phdrs_script_test_LDFLAGS): Define.
971 (tls_phdrs_script_test_LDADD): Define.
972 * testsuite/Makefile.in: Rebuild.
973
4a599bdd
CC
9742010-03-23 Cary Coutant <ccoutant@google.com>
975
976 * fileread.cc (find_or_make_view): Fix comment.
977
6c93b22c
ILT
9782010-03-23 Ian Lance Taylor <iant@google.com>
979
980 * script-sections.cc (class Orphan_section_placement): Define
981 PLACE_TLS and PLACE_TLS_BSS.
982 (Orphan_section_placement::Orphan_section_placement): Initialize
983 new places.
984 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
985 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
986 (tls_script_test_SOURCES): Define.
987 (tls_script_test_DEPENDENCIES): Define.
988 (tls_script_test_LDFLAGS): Define.
989 (tls_script_test_LDADD): Define.
990 * testsuite/Makefile.in: Rebuild.
991
a2c7281b
DK
9922010-03-22 Doug Kwan <dougkwan@google.com>
993
994 * arm.cc (Arm_relocate_functions::abs8,
995 Arm_relocate_functions::abs16): Use correct check for overflow
996 specified in the ARM ELF specs.
997 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
998 target of a BLX instruction specially.
999 (Reloc_stub::stub_type_for_reloc): Ditto.
1000 (Relocate::relocate): Use symbolic names instead of numeric relocation
1001 codes to report error.
1002 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
1003 workaround.
1004 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
1005 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
1006 thumb2_blx_out_of_range.stdout
1007 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
1008 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
1009 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
1010 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
1011 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
1012 thumb2_blx_in_range, thumb2_blx_in_range.o,
1013 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
1014 thumb2_blx_out_of_range.o): New rules.
1015 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
1016 thumb2_blx_in_range and thumb2_blx_out_of_range.
1017 * testsuite/Makefile.in: Regenerate.
1018 * arm_branch_in_range.sh: Add tests for THUMB BLX.
1019 * testsuite/thumb_blx_in_range.s: New file.
1020 * testsuite/thumb_blx_out_of_range.s: New file.
1021
b0193076
RÁE
10222010-03-22 Rafael Espindola <espindola@google.com>
1023
1024 * archive.cc (Should_include): Move to archive.h.
1025 (should_include_member): Make it a member of Archive.
1026 (Lib_group): New.
1027 (Add_lib_group_symbols): New.
1028 * archive.h: Include options.h.
1029 (Archive_member): Moved from Archive.
1030 (Should_include): Moved from archive.cc.
1031 (Lib_group): New.
1032 (Add_lib_group_symbols): New.
1033 * dynobj.cc (do_should_include_member): New.
1034 * dynobj.h (do_should_include_member): New.
1035 * gold.cc (queue_initial_tasks): Update call to queue.
1036 * main.cc (main): Print lib group stats.
1037 * object.cc (do_should_include_member): New.
1038 * object.h: Include archive.h.
1039 (Object::should_include_member): New.
1040 (Object::do_should_include_member): New.
1041 (Sized_relobj::do_should_include_member): New.
1042 * options.cc (General_options::parse_start_lib): New.
1043 (General_options::parse_end_lib): New.
1044 (Input_arguments::add_file): Handle lib groups.
1045 (Input_arguments::start_group): Check we are not in a lib.
1046 (Input_arguments::start_lib): New.
1047 (Input_arguments::end_lib): New.
1048 * options.h (General_options): Add start_lib and end_lib.
1049 (Input_argument::lib_): New.
1050 (Input_argument::lib): New.
1051 (Input_argument::is_lib): New.
1052 (Input_file_lib): New.
1053 (Input_arguments::in_lib_): New.
1054 (Input_arguments::in_lib): New.
1055 (Input_arguments::start_lib): New.
1056 (Input_arguments::end_lib_): New.
1057 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
1058 in unused members as preempted.
1059 (Sized_pluginobj::do_should_include_member): New.
1060 * plugin.h (Sized_pluginobj::do_should_include_member): New.
1061 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
1062 return the blocker.
1063 (Read_symbols::do_whole_lib_group): New.
1064 (Read_symbols::do_lib_group): New.
1065 (Read_symbols::do_read_symbols): Handle lib groups.
1066 (Read_symbols::get_name): Handle lib groups.
1067 * readsyms.h (Read_symbols): Add an archive member pointer.
1068 (Read_symbols::do_whole_lib_group): New.
1069 (Read_symbols::do_lib_group): New.
1070 (Read_symbols::member_): New.
1071 * script.cc (read_input_script): Update call to queue_soon.
1072
d099120c
DK
10732010-03-19 Doug Kwan <dougkwan@google.com>
1074
1075 * arm.cc (Stub_table::Stub_table): Initialize new data members
1076 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1077 (Stub_table::add_reloc_stub): Assign stub offset and update
1078 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1079 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
1080 New data members.
1081 (Stub_table::update_data_size_and_addralign): Use
1082 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
1083 instead of going over all reloc stubs.
1084 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
1085 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1086 Stringpool_template::offset_ to size of Stringpool_char.
1087 (Stringpool_template::new_key_offset): Remove code to initialize
1088 Stringpool_template::offset_.
1089 * stringpool.h (Stringpool_template::set_no_zero_null): Set
1090 Stringpool_template::offset_ to zero.
1091
1aa37384
DK
10922010-03-15 Doug Kwan <dougkwan@google.com>
1093
1094 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1095 offset_.
1096 (Stringpool_template::new_key_offset): New method.
1097 (Stringpool_template::add_string): Assign offsets when adding new
1098 strings.
1099 (Stringpool_template::set_string_offsets): Do not set string offsets
1100 when not optimizing.
1101 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
1102 member size_.
1103 (Chunked_vector::clear): Clear size_.
1104 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
1105 (Chunked_vector::size): Return size_.
1106 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 1107 (Chunked_vector::size_): New data member.
1aa37384
DK
1108 (Stringpool_template::set_no_zero_null): Assert string set is empty.
1109 (Stringpool_template::new_key_offset): New method declaration.
1110 (Stringpool_template::offset_): New data member.
1111
b672b057
RÁE
11122010-03-15 Rafael Espindola <espindola@google.com>
1113
1114 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
1115 Add_symbols' constructor.
1116 * readsyms.h (Add_symbols): Remove the input_group member.
1117
b6848d3c
ILT
11182010-03-10 Ian Lance Taylor <iant@google.com>
1119
1120 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
1121 target to ask whether a reference to a symbol requires a stack
1122 split.
1123 * target.h (Target::is_call_to_non_split): New function.
1124 (Target::do_is_call_to_non_split): Declare virtual function.
1125 * target.cc: Include "symtab.h".
1126 (Target::do_is_call_to_non_split): New function.
1127 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
1128
a2a5469e
CC
11292010-03-10 Cary Coutant <ccoutant@google.com>
1130
1131 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
1132 (File_read::open[1]): Remove initial mapping of whole_file_view_.
1133 (File_read::open[2]): Add whole_file_view_ to list of views.
1134 (File_read::make_view): Remove test of whole_file_view_.
1135 (File_read::find_or_make_view): Create whole_file_view_ if
1136 necessary.
1137 (File_read::clear_views): Replace bool parameter with enum;
1138 adjust all callers. Don't delete views with permanent data;
1139 do delete cached views and views from archives if
1140 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
1141 if clearing the corresponding view.
1142 * fileread.h (File_read::Clear_views_mode): New enum.
1143 (File_read::View::is_permanent_view): New method.
1144 (File_read::clear_views): Replace bool parameter
1145 with enum; adjust all callers.
1146 * options.h (General_options): Change keep_files_mapped option;
1147 add map_whole_files.
1148 * readsyms.cc (Add_symbols::run): Delete sd_ object before
1149 releasing the file.
1150 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
1151 the file.
1152
8861f32b
DM
11532010-03-10 David S. Miller <davem@davemloft.net>
1154
1155 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
1156
d62d0f5f
ST
11572010-03-09 Sriraman Tallam <tmsriram@google.com>
1158
1159 * icf.cc (get_section_contents): Add '@' marker after processing the
1160 merge reloc.
1161
9177756d
DK
11622010-03-08 Doug Kwan <dougkwan@google.com>
1163
1164 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
1165 due to a conversion warning.
1166 (Arm_relobj::update_output_local_symbol_count): Check for local
1167 symbol with unset output index.
1168
9e9e071b
ILT
11692010-03-05 Ian Lance Taylor <iant@google.com>
1170
1171 * options.h (class General_options): Add --spare-dynamic-tags.
1172 * output.cc (Output_data_dynamic::set_final_data_size): Implement
1173 --spare-dynamic-tags.
1174
a81ee015
ILT
11752010-03-05 Ian Lance Taylor <iant@google.com>
1176
1177 * incremental.cc: Include "libiberty.h".
1178
44ec90b9
RO
11792010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
1180
1181 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
1182 function, is_info_ member.
1183 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
1184 (Versions::Versions): Update caller.
1185 (Versions::define_base_version): Likewise.
1186 (Versions::add_def): Likewise.
1187
0897ed3b
ST
11882010-03-03 Sriraman Tallam <tmsriram@google.com>
1189
1190 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
1191 (Scan::possible_function_pointer_reloc): New function.
1192 (Scan::local_reloc_may_be_function_pointer): Change to call
1193 possible_function_pointer_reloc.
1194 (Scan::global_reloc_may_be_function_pointer): Ditto.
1195 * icf.h (Icf::check_section_for_function_pointers): Change to reject
1196 relocations in ".data.rel.ro._ZTV" section.
1197 * testsuite/icf_safe_so_test.sh: Change to pass i386.
1198 * testsuite/icf_safe_so_test.cc: Ditto.
1199 * testsuite/icf_safe_test.cc: Ditto.
1200 * testsuite/icf_safe_test.sh: Ditto.
1201
d3bbad62
ILT
12022010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1203 Ian Lance Taylor <iant@google.com>
1204
1205 * target-reloc.h (relocate_section): Check the symbol table index
1206 for -1U before setting the local symbol index.
1207 (scan_relocatable_relocs): If copying the relocation, record that
1208 the local symbol is required.
1209 * object.h (Symbol_value::is_output_symtab_index_set): New
1210 function.
1211 (Symbol_value::may_be_discarded_from_output_symtab): New
1212 function.
1213 (Symbol_value::has_output_symtab_entry): New function.
1214 (Symbol_value::needs_output_symtab_entry): Remove.
1215 (Symbol_value::output_symtab_index): Make sure the symbol index is
1216 set.
1217 (Symbol_value::set_output_symtab_index): Make sure the symbol
1218 index is not set. Make sure the new index is valid.
1219 (Symbol_value::set_must_have_output_symtab_entry): New function.
1220 (Symbol_value::has_output_dynsym_entry): New function.
1221 (Symbol_value::set_output_dynsym_index): Make sure the new index
1222 is valid.
1223 (Sized_relobj::set_must_have_output_symtab_entry): New function.
1224 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
1225 local symbol if permitted.
1226 (Sized_relobj::do_finalize_local_symbols): Call
1227 is_output_symtab_index_set rather than needs_output_symtab_entry.
1228 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
1229 rather than needs_output_symtab_entry. Call
1230 has_output_dynsym_entry rather than needs_output_dynsym_entry.
1231 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
1232 is_output_symtab_index_set rather than needs_output_symtab_entry.
1233 * testsuite/discard_locals_relocatable_test.c: New file.
1234 * testsuite/discard_locals_test.sh: Test -r.
1235 * testsuite/Makefile.am (check_DATA): Add
1236 discard_locals_relocatable_test1.syms,
1237 discard_local_relocatable_test2.syms.
1238 (MOSTLYCLEANFILES): Likewise. Also add
1239 discard_locals_relocatable_test1.lout and
1240 discard_locals_relocatable_test2.out.
1241 (discard_locals_relocatable_test1.syms): New target.
1242 (discard_locals_relocatable_test.o): New target.
1243 (discard_locals_relocatable_test1.out): New target.
1244 (discard_locals_relocatable_test2.syms): New target.
1245 (discard_locals_relocatable_test2.out): New target.
1246 (various): Add missing ../ld-new dependencies.
1247 * testsuite/Makefile.in: Rebuild.
1248
7e8ccf26
NC
12492010-03-03 Nick Clifton <nickc@redhat.com>
1250
1251 * po/fi.po: New Finnish translation.
1252
2a0ff005
DK
12532010-03-01 Doug Kwan <dougkwan@google.com>
1254
1255 * layout.cc (Layout::Layout): Force section types of .init_array*,
1256 .preinit_array* and .fini_array* sections.
1257 * output.cc (Output_section::Input_section_sort_entry::has_priority):
1258 Fix check of return value of std::string::find.().
1259 (Output_section::Input_section_sort_compare::operator()): Remove
1260 comment about .init_array.
1261 (Output_section::Input_section_sort_init_fini_compare::operator()):
1262 New method.
1263 (Output_section::sort_attached_input_sections): Handle .init_array
1264 and .fini_array specially.
1265 * output.h (Output_section::Inut_section_sort_compare): Update
1266 comment.
1267 (Output_section::Input_section_sort_init_fini_compare): New struct.
1268
c3e4ae29
DK
12692010-02-26 Doug Kwan <dougkwan@google.com>
1270
1271 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
1272 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
1273 * testsuite/debug_msg.sh: Avoid matching source line number for
1274 use of global variable undef_int.
1275
2fd9ae7a
DK
12762010-02-26 Doug Kwan <dougkwan@google.com>
1277
1278 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
1279 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
1280 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
1281 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
1282 * options.cc (General_options::General_options): Initialize member
1283 fix_v4bx_.
1284 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
1285 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
1286 and rm_no_fix_v4bx.stdout
1287 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
1288 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
1289 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
1290 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
1291 and arm_no_fix_v4bx.
1292 * Makefile.in: Regenerate.
1293 * testsuite/arm_fix_v4bx.s: New file.
1294 * testsuite/arm_fix_v4bx.sh: Ditto.
1295
67ec7d0b
DK
12962010-02-24 Doug Kwan <dougkwan@google.com>
1297
1298 * arm.cc (Target_arm::got_section): Make the .got section the first
1299 non RELRO section in the data segment.
1300 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
1301 suffixes of section names.
1302
10165461
DK
13032010-02-24 Doug Kwan <dougkwan@google.com>
1304
1305 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
1306 flags and attributes merging if an input file is a binary file.
1307 * fileread.cc (Input_file::open): Record format of original file.
1308 * fileread.h (Input_file::Format): New enum type.
1309 (Input_file::Input_file): Initialize data member format_.
1310 (Input_file::format): New method definition.
1311 (Input_file::format_):: New data member.
1312
4a54abbb
DK
13132010-02-24 Doug Kwan <dougkwan@google.com>
1314
1315 * arm.cc (Arm_output_data_got): New class.
1316 (ARM_TCB_SIZE): New constant
1317 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
1318 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
1319 If user uses a script with a SECTIONS clause, issue only a warning
1320 for a misplaced EXIDX input section. Otherwise, issue an error.
1321 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
1322 garbage collection.
1323 (Target_arm::got_mode_index_entry): Handle static linking.
1324 (Target_arm::Scan::local): Ditto.
1325 (Target_arm::Scan::global): Ditto.
1326 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
1327 all incorrectly implemented relocations.
e1df38aa 1328 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
1329 Arm_output_section::fix_exidx_coverage.
1330 * layout.cc (Layout::section_name_mapping): Remove trailing dots
1331 from ".ARM.exidx." and ".ARM.extab.".
1332
ca419a6f
ILT
13332010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1334
1335 * arm.cc (Target_arm::do_finalize_sections): Create attribute
1336 section if it does not already exist.
1337 * attributes.cc (Attributes_section_data::Attributes_section_data):
1338 Don't crash if size is zero.
1339
135b9c78
ILT
13402010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1341 Ian Lance Taylor <iant@google.com>
1342
1343 * gold.cc (queue_middle_tasks): If no input files were opened,
1344 exit.
1345 * workqueue.h (Task_function::Task_function): Assert that there is
1346 a blocker.
1347
bb0bfe4f
DK
13482010-02-22 Doug Kwan <dougkwan@google.com>
1349
1350 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
1351 * icf.cc (get_section_contents): Cast snprintf arguments to long long
1352 types to avoid warnings due to different uint64_t implementations
1353 on different hosts.
1354
2a2b6d42
DK
13552010-02-21 Doug Kwan <dougkwan@google.com>
1356
1357 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
1358 handling of the maximum backward branch offset.
1359 (Arm_relocate_functions::thumb_branch_common): Ditto.
1360 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
1361 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 1362 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
1363 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
1364 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
1365 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
1366 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
1367 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
1368 thumb_bl_out_of_range thumb_bl_out_of_range.o,
1369 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
1370 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
1371 thumb2_bl_out_of_range.o): New rules.
1372 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
1373 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
1374 thumb2_bl_out_of_range
1375 * testsuite/Makefile.in: Regenerate.
1376 * testsuite/arm_bl_in_range.s: New file.
1377 * testsuite/arm_bl_out_of_range.s: Ditto.
1378 * testsuite/arm_branch_in_range.sh: Ditto.
1379 * testsuite/arm_branch_range.t: Ditto.
1380 * testsuite/thumb2_branch_range.t: Ditto.
1381 * testsuite/thumb_bl_in_range.s: Ditto.
1382 * testsuite/thumb_bl_out_of_range.s: Ditto.
1383 * testsuite/thumb_branch_range.t: Ditto.
1384
b487ad64
ST
13852010-02-20 Sriraman Tallam <tmsriram@google.com>
1386
1387 * gc.h (gc_process_relocs): Change vectors to point to the new list.
1388 Add reloc offset information.
1389 * icf.cc (get_section_contents): Change iterators to point to the new
1390 vectors. Add reloc offset information to the contents.
1391 * icf.h (Icf::Sections_reachable_info): New typedef.
1392 (Icf::Sections_reachable_list): New typedef.
1393 (Icf::Offset_info): New typedef.
1394 (Icf::Reloc_info): New struct typedef.
1395 (Icf::Reloc_info_list): New typedef.
1396 (Icf::symbol_reloc_list): Delete method.
1397 (Icf::addend_reloc_list): Delete method.
1398 (Icf::section_reloc_list): Delete method.
1399 (Icf::reloc_info_list): New method.
1400 (Icf::reloc_info_list_): New member.
1401
f96accdf
DK
14022010-02-19 Doug Kwan <dougkwan@google.com>
1403
1404 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
1405 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
1406 * arm.cc (Arm_relocation_functions): New forward declaration.
1407 (Target_arm::Target_arm): Initialize new data members
1408 got_mod_index_offset_ and tls_base_symbol_defined_.
1409 (Target_arm::Relocate::relocate_tls): New method.
1410 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
1411 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
1412 New methods.
1413 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
1414 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
1415 (Target_arm::got_mod_index_offset_,
1416 Target_arm::tls_base_symbol_defined_): New data members.
1417 (Target_arm::Scan::local, Target::Scan::global,
1418 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
1419 relocations.
1420
c8761b9a
DK
14212010-02-18 Doug Kwan <dougkwan@google.com>
1422
1423 * arm.cc (Arm_relobj::find_linked_text_section): New method.
1424 (Arm_relobj::make_exidx_input_section): Pass section index of linked
1425 text section as a parameter becuase some broken tools may not set
1426 the link in section header.
1427 (Target_arm::has_got_section): New method.
1428 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
1429 without any mapping symbol as data only. Remove warning.
1430 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
1431 link in its section header, try to discover the link by inspecting the
1432 REL31 relocation at the beginning of the section.
1433 (Target_arm::Scan::check_non_pic): Report name of offending relocation
1434 in error message.
1435 (Target_arm::Scan::global): Treat any reference to the symbol
1436 _GLOBAL_OFFSET_TABLE_ as a GOT access.
1437
21bb3914
ST
14382010-02-12 Sriraman Tallam <tmsriram@google.com>
1439
1440 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
1441 (Scan::global_reloc_may_be_function_pointer): New function.
1442 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1443 (Scan::global_reloc_may_be_function_pointer): New function.
1444 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1445 (Scan::global_reloc_may_be_function_pointer): New function.
1446 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
1447 (Scan::global_reloc_may_be_function_pointer): New function.
1448 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
1449 (Scan::global_reloc_may_be_function_pointer): New function.
1450 (Scan::possible_function_pointer_reloc): New function.
1451 (Target_x86_64::can_check_for_function_pointers): New function.
1452 * gc.h (gc_process_relocs): Scan relocation types to determine if
1453 function pointers were taken for targets that support it.
1454 * icf.cc (Icf::find_identical_sections): Include functions for
1455 folding in safe ICF whose pointer is not taken.
1456 * icf.h (Secn_fptr_taken_set): New typedef.
1457 (fptr_section_id_): New member.
1458 (section_has_function_pointers): New function.
1459 (set_section_has_function_pointers): New function.
1460 (check_section_for_function_pointers): New function.
1461 * options.h: Fix comment for safe ICF option.
1462 * target.h (can_check_for_function_pointers): New function.
1463 * testsuite/Makefile.am: Add icf_safe_so_test test case.
1464 Modify icf_safe_test for X86-64.
1465 * testsuite/Makefile.in: Regenerate.
1466 * testsuite/icf_safe_so_test.cc: New file.
1467 * testsuite/icf_safe_so_test.sh: New file.
1468 * testsuite/icf_safe_test.cc (kept_func_3): New function.
1469 (main): Change to take pointer to function kept_func_3.
1470 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
1471 folding is done correctly for X86-64.
1472
0da6fa6c
DM
14732010-02-12 David S. Miller <davem@davemloft.net>
1474
1475 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
1476 is_symbolless parameter.
1477 (Output_reloc<SHT_REL>::is_symbolless): New.
1478 (Output_reloc<SHT_REL>::is_symbolless_): New.
1479 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
1480 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
1481 (Output_reloc<SHT_RELA>::is_symbolless): New.
1482 (Output_data_reloc::add_global): Handle is_symbolless.
1483 (Output_data_reloc::add_global_relative): Likewise.
1484 (Output_data_reloc::add_local): Likewise.
1485 (Output_data_reloc::add_local_relative): Likewise.
1486 (Output_data_reloc::add_symbolless_global_addend): New.
1487 (Output_data_reloc::add_symbolless_local_addend): New.
1488 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
1489 is_symbolless.
1490 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
1491 instead of ->is_relative_
1492 (Output_reloc::write): Likewise.
1493 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
1494 (Output_reloc::write_rel): Simplify.
1495
1496 * sparc.cc (Target_sparc::Scan::local): Use
1497 ->add_symbolless_local_addend as needed.
1498 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
1499 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
1500 based upon relocation offset.
1501
e4782e83
DK
15022010-02-11 Doug Kwan <dougkwan@google.com>
1503
1504 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
1505 (Target_arm::Scan::global): Ditto. Also remove a comment before the
1506 beginning of function.
1507 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
1508 and MOVT_ABS relocations. Those are non issued in scanning. Fix
1509 parameter is_32bit in calls to should_apply_static_reloc.
1510 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
1511 (check_DATA): Add arm_abs_global.stdout.
1512 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
1513 arm_abs_global.stdout): New rules.
1514 (MOSTLLYCLEANFILES): Add arm_abs_global
1515 * Makefile.in: Regenerate.
1516 * testsuite/arm_abs_global.s: New file.
1517 * testsuite/arm_abs_global.sh: Ditto.
1518 * testsuite/arm_abs_lib.s: Ditto.
1519
93ceb764
ILT
15202010-02-11 Ian Lance Taylor <iant@google.com>
1521
1522 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
1523 Read_relocs task.
1524 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
1525 Allocate_commons_task first.
1526 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
1527 task, rather than symtab_lock_.
1528 (Gc_process_relocs::~Gc_process_relocs): New function.
1529 (Gc_process_relocs::is_runnable): Check this_blocker_.
1530 (Gc_process_relocs::locks): Use next_blocker_ rather than
1531 blocker_.
1532 (Scan_relocs::~Scan_relocs): New function.
1533 (Scan_relocs::is_runnable): Check this_blocker_ rather than
1534 symtab_lock_.
1535 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
1536 next_blocker_.
1537 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
1538 fields. Add this_blocker_ and next_blocker_ fields. Adjust
1539 constructor accordingly.
1540 (class Gc_process_relocs): Likewise.
1541 (class Scan_relocs): Likewise.
1542 * common.h (class Allocate_commons_task): Remove symtab_lock_
1543 field, and corresponding constructor parameter.
1544 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
1545 symtab_lock_.
1546 (Allocate_commons_task::locks): Likewise.
1547
114dfbe1
ILT
15482010-02-11 Ian Lance Taylor <iant@google.com>
1549
1550 * gold-threads.h (class Once): Define.
1551 (class Initialize_lock): Rewrite as child of Once.
1552 * gold-threads.cc (class Once_initialize): Define.
1553 (once_pointer_control): New static variable.
1554 (once_pointer, once_arg): New static variables.
1555 (c_run_once): New static function.
1556 (Once::Once, Once::run_once, Once::internal_run): New functions.
1557 (class Initialize_lock_once): Remove.
1558 (initialize_lock_control): Remove.
1559 (initialize_lock_pointer): Remove.
1560 (initialize_lock_once): Remove.
1561 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
1562 (Initialize_lock::initialize): Rewrite.
1563 (Initialize_lock::do_run_once): New function.
1564 * archive.cc (Archive::interpret_header): Only clear name if it is
1565 not already empty.
1566 * fileread.cc: Include "gold-threads.h"
1567 (file_counts_lock): New static variable.
1568 (file_counts_initialize_lock): Likewise.
1569 (File_read::release): Only increment counts when using --stats.
1570 Use a lock around the increment.
1571 * parameters.cc (class Set_parameters_target_once): Define.
1572 (set_parameters_target_once): New static variable.
1573 (Parameters::Parameters): Move here from parameters.h.
1574 (Parameters::set_target): Rewrite.
1575 (Parameters::set_target_once): New function.
1576 (Parameters::clear_target): Move here and rewrite.
1577 * parameters.h (class Parameters): Update declarations. Add
1578 set_parameters_target_once_ field.
1579 (Parameters::Parameters): Move to parameters.cc.
1580 (Parameters::clear_target): Likewise.
1581 * readsyms.cc (Read_symbols::do_group): Create a Start_group
1582 task.
1583 (Start_group::~Start_group): New function.
1584 (Start_group::is_runnable): New function.
1585 (Start_group::locks, Start_group::run): New functions.
1586 (Finish_group::run): Change saw_undefined to size_t.
1587 * readsyms.h (class Start_group): Define.
1588 (class Finish_group): Change saw_undefined_ field to size_t.
1589 (Finish_group::Finish_group): Remove saw_undefined and
1590 this_blocker parameters. Change all callers.
1591 (Finish_group::set_saw_undefined): New function.
1592 (Finish_group::set_blocker): New function.
1593 * symtab.h (class Symbol_table): Change saw_undefined to return
1594 size_t. Change saw_undefined_ field to size_t.
1595 * target-select.cc (Set_target_once::do_run_once): New function.
1596 (Target_selector::Target_selector): Initialize set_target_once_
1597 field. Don't initialize lock_ and initialize_lock_ fields.
1598 (Target_selector::instantiate_target): Rewrite.
1599 (Target_selector::set_target): New function.
1600 * target-select.h (class Set_target_once): Define.
1601 (class Target_selector): Update declarations. Make
1602 Set_target_once a friend. Remove lock_ and initialize_lock_
1603 fields. Add set_target_once_ field.
1604
fa17a3f4
ILT
16052010-02-10 Ian Lance Taylor <iant@google.com>
1606
1607 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
1608 queueing any tasks.
1609 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
1610 (queue_middle_tasks): Add all blockers before queueing any tasks.
1611 (queue_final_tasks): Likewise.
1612 * token.h (Task_token::add_blockers): New function.
1613 * object.h (Input_objects::number_of_relobjs): New function.
1614
c7177d31
ILT
16152010-02-10 Ian Lance Taylor <iant@google.com>
1616
5de0e392
ILT
1617 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
1618 shared, not if not position independent.
1619 * x86_64.cc (Relocate::relocate_tls): Likewise.
1620 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
1621 (tls_pie_pic_test): New target.
1622 * testsuite/Makefile.in: Rebuild.
1623
c7177d31
ILT
1624 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
1625 (tls_test_main_pie.o, tls_test_pie.o): New targets.
1626 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
1627 * testsuite/Makefile.in: Rebuild.
1628
684b268a
DM
16292010-02-09 David S. Miller <davem@davemloft.net>
1630
1631 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
1632 R_SPARC_RELATIVE using ->add_local_relative().
1633 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
1634
612a8d3d
DM
1635 * output.h (Output_data_dynamic::add_section_size): New method
1636 that takes two Output_data objects.
1637 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
1638 entry param. Handle it in initializers.
1639 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
1640 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
1641 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
1642 arg.
1643 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
1644 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
1645 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
1646 for dynrel_includes_plt.
1647 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1648 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1649 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
1650 before .rela.plt
1651 (Target_sparc::do_finalize_sections): Update to pass true for
1652 dynrel_includes_plt.
1653 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
1654 output before .rela.plt
1655 (Target_powerpc::do_finalize_sections): Update to pass true for
1656 dynrel_includes_plt when 32-bit.
1657
cb1be87e
DK
16582010-02-08 Doug Kwan <dougkwan@google.com>
1659
1660 * arm.cc (Arm_relobj::simple_input_section_output_address): New
1661 method.
1662 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
1663 Arm_relobj::scan_section_for_cortex_a8_stubs,
1664 Arm_relobj::do_relocation_section): Instead of calling
1665 Output_section::output_address, use faster
1666 Arm_relobj::simple_input_section_output_address.
1667
705b5121
DM
16682010-02-08 David S. Miller <davem@davemloft.net>
1669
1670 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
1671 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
1672 relocation helper function.
1673
024c4466
DM
1674 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
1675 just like R_SPARC_GOT{10,13,22}.
1676 (Target_sparc::Scan::local): Likewise.
1677 (Target_sparc::Relocate:relocate): Likewise.
1678
9109c078
ILT
16792010-02-06 Ian Lance Taylor <iant@google.com>
1680
1681 * configure.ac: Rewrite targetobjs duplicate removal code to use
1682 only shell constructs.
1683 * configure: Rebuild.
1684
cf846138
DK
16852010-02-05 Doug Kwan <dougkwan@google.com>
1686
1687 PR 11247
1688 * arm.cc (Arm_relobj::section_is_scannable): New method.
1689 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
1690 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
1691
6cfaf60b
DK
16922010-02-04 Doug Kwan <dougkwan@google.com>
1693
1694 PR 11247
1695 * arm-reloc-property.cc (cstdio): Include.
1696 * configure.ac (targetobjs): Remove duplicates.
1697 * configure: Regenerate.
1698 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
1699 big and little endian version for a given address size.
1700
5c57f1be
DK
17012010-02-03 Doug Kwan <dougkwan@google.com>
1702
1703 * arm-reloc-property.cc
1704 (Arm_reloc_property_table::reloc_name_in_error_message): New method
1705 definition.
1706 * arm-reloc-property.h
1707 (Arm_reloc_property_table::get_implemented_static_reloc_property):
1708 New method definition.
1709 (Arm_reloc_property_table::reloc_name_in_error_message): New method
1710 declaration.
1711 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
1712 overflow to N.
1713 (GOT_PREL): Change implemented to Y.
1714 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
1715 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
1716 (Arm_relocate_functions::movw_abs_nc): Remove method.
1717 (Arm_relocate_functions::movt_abs): Ditto.
1718 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
1719 (Arm_relocate_functions::thm_movt_abs): Ditto.
1720 (Arm_relocate_functions::movw_rel_nc): Ditto.
1721 (Arm_relocate_functions::movw_rel): Ditto.
1722 (Arm_relocate_functions::movt_rel): Ditto.
1723 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
1724 (Arm_relocate_functions:thm_movw_rel): Ditto.
1725 (Arm_relocate_functions:thm_movt_rel): Ditto.
1726 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
1727 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
1728 New method definitions.
1729 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
1730 (Arm_relocation_functions::arm_grp_ldr): Ditto.
1731 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
1732 (Arm_relocation_functions::arm_grp_ldc): Ditto.
1733 (Target_arm::Relocate::relocate): Check for non-static or
1734 unimplemented relocation code and exit early. Change calls to
1735 Target_arm::reloc_uses_thumb_bit and
1736 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
1737 instead. Refactor code to handle similar relocations to increase
1738 code sharing. Remove check for unsupported relocation code in switch
1739 statement.
1740 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
1741 relocation property table to find out size. Change error message to
1742 print out the name of a relocation code instead of the numeric value.
1743 (Target_arm::scan_reloc_for_stub): Use relocation property table
1744 instead of calling Target_arm::reloc_uses_thumb_bit().
1745
218c5831
DK
17462010-02-02 Doug Kwan <dougkwan@google.com>
1747
1748 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
1749 types of relaxed input section.
1750
0d31c79d
DK
17512010-02-02 Doug Kwan <dougkwan@google.com>
1752
1753 * Makefile.am (HFILES): Add arm-reloc-property.h.
1754 (DEFFILES): New.
1755 (TARGETSOURCES): Add arm-reloc-property.cc
1756 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
1757 (libgold_a_SOURCES): $(DEFFILES)
1758 * Makefile.in: Regenerate.
1759 * arm-reloc-property.cc: New file.
1760 * arm-reloc-property.h: New file.
1761 * arm-reloc.def: New file.
1762 * arm.cc: Update comments.
1763 (arm-reloc-property.h): New included header.
1764 (arm_reloc_property_table): New global variable.
1765 (Target_arm::do_select_as_default_target): New method definition.
1766 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
1767 arm-reloc-property to targ_extra_obj.
1768 * parameters.cc (set_parameters_target): Call
1769 Target::select_as_default_target().
1770 * target.h (Target::select_as_default_target): New method definition.
1771 (Target::do_select_as_default_target): Same.
1772
546c7457
DK
17732010-02-01 Doug Kwan <dougkwan@google.com>
1774
1775 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
1776 first_output_text_section_.
1777 (Arm_exidx_fixup::first_output_text_section): New method definition.
1778 (Arm_exidx_fixup::first_output_text_section_): New data member.
1779 (Arm_exidx_fixup::process_exidx_section): Record the first text
1780 output section seen.
1781 (Arm_output_section::fix_exidx_coverage): Set correct linked section
1782 and entsize in output section header.
1783
11b861d5
DK
17842010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1785
1786 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
1787 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
1788 (Arm_relocate_functions::thm_alu11): New Method.
1789 (Arm_relocate_functions::thm_pc8): New Method.
1790 (Arm_relocate_functions::thm_pc12): New Method.
1791 (Target_arm::Scan::local): Handle the relocations.
1792 (Target_arm::Scan::global): Likewise.
1793 (Target_arm::Relocate::relocate): Likewise.
1794 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1795
c9a2c125
DK
17962010-01-29 Doug Kwan <dougkwan@google.com>
1797
1798 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
1799 of relocation types as ld.
1800
1521477a
DK
18012010-01-29 Doug Kwan <dougkwan@google.com>
1802
1803 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
1804 to public.
1805 (Arm_relocate_functions::thumb_branch_common): Ditto.
1806 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
1807 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
1808 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
1809 Arm_relocate_functions::jump24): Remove.
1810 (Target_arm::Relocate::relocate): Adjust code to call
1811 Arm_relocation_functions::arm_branch_common and
1812 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 1813 wrappers. Merge switch-cases together to reduce source code size.
1521477a 1814
e7eca48c
DK
18152010-01-29 Doug Kwan <dougkwan@google.com>
1816
1817 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
1818 output_local_symbol_count_needs_update_.
1819 (Arm_relobj::output_local_symbol_count_needs_update,
1820 Arm_relobj::set_output_local_symbol_count_needs_update,
1821 Arm_relobj::update_output_local_symbol_count): New methods.
1822 (Arm_relobj::output_local_symbol_count_needs_update_): New data
1823 member.
1824 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
1825 of pointed function as in a R_ARM_PREL31 relocation.
1826 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
1827 for output local symbol count updating.
1828 (Target_arm::do_relax): Update output local symbol counts in objects
1829 if necessary.
1830 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
1831
02961d7e
ILT
18322010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1833
1834 * arm.cc: Added support for the ARM relocations:
1835 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
1836 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
1837 (Arm_relocate_functions::movw_rel_nc): Renamed (was
1838 movw_prel_nc).
1839 (Arm_relocate_functions::movw_rel): New method.
1840 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
1841 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
1842 thm_movw_prel_nc).
1843 (Arm_relocate_functions::thm_movw_rel): New method.
1844 (Arm_relocate_functions::thm_movt_rel): Renamed (was
1845 thm_movt_prel).
1846 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
1847 relocations.
1848 (Target_arm::Scan::global): Likewise.
1849 (Target_arm::Relocate::relocate): Likewise.
1850 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1851 Likewise.
1852
b10d2873
ILT
18532010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1854
1855 * arm.cc: Added support for ARM group relocations.
1856 (Target_arm::reloc_needs_sym_origin): New method.
1857 (Arm_relocate_functions::calc_grp_kn): New method.
1858 (Arm_relocate_functions::calc_grp_residual): New method.
1859 (Arm_relocate_functions::calc_grp_gn): New method.
1860 (Arm_relocate_functions::arm_grp_alu): New Method.
1861 (Arm_relocate_functions::arm_grp_ldr): New Method.
1862 (Arm_relocate_functions::arm_grp_ldrs): New Method.
1863 (Arm_relocate_functions::arm_grp_ldc): New Method.
1864 (Target_arm::Scan::local): Handle the ARM group relocations.
1865 (Target_arm::Scan::global): Likewise.
1866 (Target_arm::Relocate::relocate): Likewise.
1867 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1868 Likewise.
1869
2b328d4e
DK
18702010-01-26 Doug Kwan <dougkwan@google.com>
1871
1872 * arm.cc (set): Include.
1873 (class Arm_exidx_fixup): Change type of last_input_section_ to const
1874 pointer type.
1875 (Arm_output_section::Text_section_list): New type.
1876 (Arm_output_section::append_text_sections_to_list): New method.
1877 (Arm_output_section::fix_exidx_coverage): Ditto.
1878 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
1879 (Arm_relobj::convert_input_section_to_relaxed_section): Use
1880 Relobj::set_section_offset() instead of
1881 Sized_relobj::invalidate_section_offset().
1882 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
1883 parameter for section headers. Ignore relocation sections for
1884 unallocated sections and EXIDX sections.
1885 (Target_arm::fix_exidx_coverage): New method.
1886 (Target_arm::output_section_address_less_than): New type.
1887 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
1888 linked text section instead of the EXIDX section.
1889 (Arm_output_section::create_stub_group): Add an assertion to check
1890 that this is not an EXIDX output section.
1891 (Arm_output_section::append_text_sections_to_list): New method.
1892 (Arm_output_section::fix_exidx_coverage): Ditto.
1893 (Arm_relobj::scan_sections_for_stubs): Adjust call to
1894 Arm_relobj::section_needs_reloc_stub_scanning.
1895 (Target_arm::do_relax): Fix EXIDX output section coverage in the
1896 first pass.
1897 (Target_arm::fix_exidx_coverage): New method.
1898 * object.h (Relobj::set_output_section): New method.
1899 (Sized_relobj::invalidate_section_offset): Remove method.
1900 (Sized_relobj::do_invalidate_section_offset): Remove method.
1901 (Sized_relobj::do_set_section_offset): Handle offset value -1.
1902
c7f3c371
DK
19032010-01-25 Doug Kwan <dougkwan@google.com>
1904
1905 * arm.cc (Arm_exidx_merged_section::do_output_offset):
1906 Fix warning due to signed and unsigned comparison on a 32-bit host.
1907
8923b24c
DK
19082010-01-22 Doug Kwan <dougkwan@google.com>
1909
1910 * arm.cc (Target_arm::do_relax): Record an output section for section
1911 offset adjustment it contains any stub table that has changed.
1912 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
1913 offsets in an output section if necessary.
1914 * output.cc (Output_section::Output_section): Initialize
1915 section_offsets_need_adjustments_.
1916 (Output_section::add_input_section_for_script): Renamed to
1917 Output_section::add_simple_input_section.
1918 (Output_section::save_states): Add a comment.
1919 (Output_section::discard_states): New method defintion.
1920 (Output_section::adjust_section_offsets): Same.
1921 * output.h (Output_section::add_input_section_for_script): Renamed to
1922 Output_section::add_simple_input_section.
1923 (Output_section::discard_states): New method declaration.
1924 (Output_section::adjust_section_offsets): Same.
1925 (Output_section::section_offsets_need_adjustment,
1926 Output_section::set_section_offsets_need_adjustment): New method
1927 definitions.
1928 (Output_section::section_offsets_need_adjustment_): New data member.
1929 * script-sections.cc
1930 (Output_section_element_input::set_section_address): Adjust code for
1931 renaming of Output_section::add_input_section_for_script.
1932 (Orphan_output_section::set_section_address): Same.
1933
9b2fd367
DK
19342010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1935
1936 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
1937 Fix_v4bx enum values .
1938 * gold/options.h (General_options): New option definitions.
1939 (General_options::fix_v4bx): New method.
1940 (General_options::Fix_v4bx): New enum.
1941 * gold/options.cc (General_options::parse_fix_v4bx): New method.
1942 (General_options::parse_fix_v4bx_interworking): New method.
1943
80d0d023
DK
19442010-01-22 Doug Kwan <dougkwan@google.com>
1945
1946 * arm.cc (Arm_exidx_fixup): New class.
1947
af2cdeae
DK
19482010-01-21 Doug Kwan <dougkwan@google.com>
1949
1950 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
1951 classes.
1952 (Arm_exidx_section_offset_map): New type.
1953
993d07c1
DK
19542010-01-21 Doug Kwan <dougkwan@google.com>
1955
1956 * arm.cc (Arm_exidx_input_section): New class.
1957 (Arm_relobj::exidx_input_section_by_link,
1958 Arm_relobj::exidx_input_section_by_shndx,
1959 Arm_relobj::make_exidx_input_section): New methods.
1960 (read_arm_attributes_section): Remove.
1961 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
1962 information about them.
1963 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
1964 to here.
1965
5ac169d4
DK
19662010-01-20 Doug Kwan <dougkwan@google.com>
1967
1968 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
1969 Input_section_specifier to Section_id.
1970 (Target_arm::new_arm_input_section: Adjust code for change of key
1971 type.
1972 (Target_arm::find_arm_input_section): Ditto.
1973 * gc.h (object.h): Include for Section_id nand Section_id_hash.
1974 (Section_id): Remove.
1975 (Garbage_collection::Section_id_hash): Remove.
1976 * icf.h (object.h): Include for Section_id nand Section_id_hash.
1977 (Section_id): Remove.
1978 (Icf::Section_id_hash): Remove.
1979 * object.h (Section_id, Const_section_id, Section_id_hash,
1980 Const_section_id_hash): New type definitions.
1981 * output.cc (Output_section::add_relaxed_input_section): Change to
1982 use Const_section_id instead of Input_section_specifier as key type.
1983 (Output_section::add_merge_input_section): Ditto.
1984 (Output_section::build_relaxation_map): Change to use Section_id
1985 instead of Input_section_specifier as key type.
1986 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1987 Ditto.
1988 (Output_section::convert_input_sections_to_relaxed_sections): Change
1989 to use Const_section_id instead of Input_section_specifier as key type.
1990 (Output_section::find_merge_section): Ditto.
1991 (Output_section::find_relaxed_input_section): Ditto.
1992 * output.h (Input_section_specifier): Remove class.
1993 (Output_section::Output_section_data_by_input_section_map): Change
1994 key type to Const_section_id.
1995 (Output_section::Output_relaxed_input_section_by_input_section_map):
1996 Ditto.
1997 (Output_section::Relaxation_map): Change key type to Section_id.
1998
a2162063
ILT
19992010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2000
2001 * gold/arm.cc: Added support for R_ARM_V4BX relocation
2002 (class Arm_v4bx_stub): New class.
2003 (DEF_STUBS): Updated definition to support v4_veneer_bx.
2004 (Stub_factory::make_arm_v4bx_stub): New method.
2005 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
2006 (Stub_table::empty): Handle v4bx stubs.
2007 (Stub_table::add_arm_v4bx_stub): New method.
2008 (Stub_table::find_arm_v4bx_stub): New method.
2009 (Arm_relocate_functions::v4bx): New method.
2010 (Target_arm::fix_v4bx): New method.
2011 (Target_arm::Target_arm): Handle R_ARM_V4BX.
2012 (Stub_table::relocate_stubs): Likewise.
2013 (Stub_table::do_write): Likewise.
2014 (Stub_table::update_data_size_and_addralign): Likewise.
2015 (Stub_table::finalize_stubs): Likewise.
2016 (Target_arm::Scan::local): Likewise.
2017 (Target_arm::Scan::global): Likewise.
2018 (Target_arm::do_finalize_sections): Likewise.
2019 (Target_arm::Relocate::relocate): Likewise.
2020 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2021 Likewise.
2022 (Target_arm::scan_reloc_for_stub): Likewise.
2023 (Target_arm::scan_reloc_section_for_stubs): Likewise.
2024
5696ab0b
ILT
20252010-01-19 Ian Lance Taylor <iant@google.com>
2026
2027 * output.cc (Output_section_headers::do_sized_write): Write large
2028 segment count to sh_info field.
2029 (Output_file_header::do_sized_write): For large segment count,
2030 write PN_XNUM to e_phnum field.
2031
800d0f56
ILT
20322010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2033
2034 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
2035 (Arm_relocate_functions::thm_jump8): New function.
2036 (Arm_relocate_functions::thm_jump11): New function.
2037 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
2038 R_ARM_THM_JUMP11.
2039 (Target_arm::Scan::global): Likewise.
2040 (Target_arm::Relocate::relocate): Likewise.
2041 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2042 Likewise.
2043
41263c05
DK
20442010-01-14 Doug Kwan <dougkwan@google.com>
2045
2046 * arm.cc (map, utility): Include headers.
2047 (Target_arm::apply_cortex_a8_workaround): New method.
2048 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
2049 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
2050 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
2051 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
2052 the --[no-]fix-cortex-a8 command line options.
2053 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
2054 (Target_arm::relocate_stub): Use addend in instruction template.
2055 * options.h (DEFINE_bool): Set the user-set flag.
2056 (General_options): Add --[no-]-fix-cortex options.
2057 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 2058 : Update fast look-up map after conversion.
41263c05 2059
459e9b03
ST
20602010-01-14 Sriraman Tallam <tmsriram@google.com>
2061
2062 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
2063 in the first pass of do_layout.
2064
b521dfe4
DK
20652010-01-13 Doug Kwan <dougkwan@google.com>
2066
2067 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2068 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
2069 apparent compiler problem of not folding static constant integral
2070 data members of elfcpp::Elf_sizes<32>.
2071
44272192
DK
20722010-01-13 Doug Kwan <dougkwan@google.com>
2073
2074 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2075 Arm_relobj::section_needs_cortex_a8_stub_scanning,
2076 Arm_relobj::scan_section_for_cortex_a8_erratum,
2077 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
2078 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
2079 sections to scan for relocation stubs into a new method
2080 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
2081 relocation and Cortex-A8 stub scanning.
2082 (Target_arm::do_relax): Force stubs to be after stubbed sections
2083 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 2084 the beginning of a new relaxation pass. Update a comment.
44272192
DK
2085 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
2086
44b71ece
ILT
20872010-01-12 Ian Lance Taylor <iant@google.com>
2088
2089 * target-reloc.h (visibility_error): New inline function.
2090 (relocate_section): Call visibility_error.
2091 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
2092 (MOSTLYCLEANFILES): Likewise.
2093 (protected_4_pic.o, protected_3.err): New targets.
2094 * testsuite/protected_4.cc: New file.
2095
a120bc7f
DK
20962010-01-12 Doug Kwan <dougkwan@google.com>
2097
2098 * arm.cc (Cortex_a8_reloc): New class.
2099 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
2100 and cortex_a8_relocs_info_.
2101 (Target_arm::fix_cortex_a8): New method definition.
2102 (Target_arm::Cortex_a8_relocs_info): New type.
2103 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
2104 New data member declarations.
2105 (Target_arm::scan_reloc_for_stub): Record information about
2106 relocations for THUMB branches that might be exempted from the
2107 Cortex-A8 workaround.
2108 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
2109 at the beginning of a relaxation pass.
2110
20138696
DK
21112010-01-12 Doug Kwan <dougkwan@google.com>
2112
2113 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
2114 (Arm_relobj::Mapping_symbol_position,
2115 Arm_reloj::Mapping_symbol_position_less,
2116 Arm_relobj::Mapping_symbols_info): New types.
2117 (Target_arm::is_mapping_symbol_name): New method definition.
2118 (Arm_relobj::do_count_local_symbols): Save information about mapping
2119 symbols.
2120
089d69dc
DK
21212010-01-11 Doug Kwan <dougkwan@google.com>
2122
2123 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
2124 Arm_relocate_functions::thumb32_branch_upper,
2125 Arm_relocate_functions::thumb32_branch_lower,
2126 Arm_relocate_functions::thumb32_cond_branch_offset,
2127 Arm_relocate_functions::thumb32_cond_branch_upper,
2128 Arm_relocate_functions::thumb32_cond_branch_lower,
2129 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
2130 branch offset encoding.
2131 (Arm_relocate_functions::thumb_branch_common): Use new branch
2132 offset encoding methods to avoid code duplication.
2133 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
2134 (Stub_addend_reader::operator()): Use new branch encoding method
2135 to avoid code duplication.
2136
99e5bff2
DK
21372010-01-11 Doug Kwan <dougkwan@google.com>
2138
2139 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
2140 (Target_arm::do_finalize_sections): Define special EXIDX section
2141 symbols only if referenced.
2142 * gc.h (Garbage_collection::add_reference): New method.
2143 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
2144 code duplication.
2145
98e090bd
ILT
21462010-01-11 Ian Lance Taylor <iant@google.com>
2147
d0a91bd8
ILT
2148 * script.cc (Version_script_info::build_expression_list_lookup):
2149 Change complaing about duplicate wildcard match from error to
2150 warning.
2151
98e090bd
ILT
2152 * script.cc (class Lazy_demangler): Recreate--revert part of patch
2153 of 2009-12-30.
2154 (Version_script_info::Version_script_info): Initialize globs_,
2155 default_version_, default_is_global_, and exact_. Don't
2156 initialize globals_ or locals_.
2157 (Version_script_info::build_lookup_tables): Build local symbols
2158 first.
2159 (Version_script_info::unquote): New function.
2160 (Version_script_info::add_exact_match): New function.
2161 (Version_script_info::build_expression_list_lookup): Remove lookup
2162 parameter. Add is_global parameter. Change all callers. Handle
2163 wildcard pattern specially. Unquote pattern. Call
2164 add_exact_match.
2165 (Version_script_info::get_name_to_match): New function.
2166 (Version_script_info::get_symbol_version): New function.
2167 (Version_script_info::get_symbol_version_helper): Remove.
2168 (Version_script_info::check_unmatched_names): Call unquote.
2169 * script.h (class Version_script_info): Change get_symbol_version
2170 to be non-inline and add is_global parameter; change all callers.
2171 Rewrite symbol_is_local. Update declarations. Define struct
2172 Version_tree_match, Exact, Globs. Don't define struct Lookup.
2173 Remove globals_ and locals_ members. Add exact_, globs_,
2174 default_version_, is_global_.
2175 (Version_script_info::Glob): Remove pattern, add expression and
2176 is_global. Update constructor. Change all callers.
2177 * dynobj.cc (Versions::finalize): Mark the version symbol as the
2178 default version.
2179 (Versions::symbol_section_contents): If a symbol is undefined, or
2180 defined in a dynamic object, set the version index to
2181 VER_NDX_LOCAL.
2182 * symtab.cc (Symbol_table::add_from_relobj): Don't call
2183 symbol_is_local.
2184 (Symbol_table::add_from_pluginobj): Likewise.
2185 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
2186
d56962d3
DK
21872010-01-11 Doug Kwan <dougkwan@google.com>
2188
2189 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
2190 (incremental_dump_LDADD): Add linking option for libintl.
2191 * Makefile.in: Regenerate.
2192
94e6ee91
L
21932010-01-11 H.J. Lu <hongjiu.lu@intel.com>
2194
2195 PR gold/11144
2196 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
2197 instead of -Ds.
2198 * testsuite/Makefile.in: Regenerated.
2199
e96c574b
DK
22002010-01-10 Doug Kwan <dougkwan@google.com>
2201
2202 * options.h (DEFINE_var): Use parentheses around argument varname__
2203 in macro body to avoid any unintended subsequent substitutions.
2204
7198066b
ILT
22052010-01-10 Ian Lance Taylor <iant@google.com>
2206
ba4d53bf
ILT
2207 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
2208 candidates before doing symbol resolution.
2209
7198066b
ILT
2210 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
2211 ODR candidates if only one is weak.
2212
a2beed37
ILT
22132010-01-08 Ian Lance Taylor <iant@google.com>
2214
2215 * script.cc (Version_script_info::build_expression_list_lookup):
2216 Don't warn about ambiguous version, just record the ambiguity.
2217 (Version_script_info::get_symbol_version_helper): Give error if
2218 version is ambiguous.
2219
2fb7225c
DK
22202010-01-08 Doug Kwan <dougkwan@google.com>
2221
2222 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
2223 prev_data_size_ and prev_addralign_. Remove initializer for
2224 deleted data member has_been_changed_.
2225 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
2226 to determine if the table is empty.
2227 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
2228 Remove.
2229 (Stub_table::add_reloc_stub): Define method in class definition
2230 instead of just declaring it there.
2231 (Stub_table::add_cortex_a8_stub): New method definition.
2232 (Stub_table::update_data_size_and_addralign): Ditto.
2233 (Stub_table::finalize_stubs): Ditto.
2234 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
2235 (Stub_table::do_addralign_): Return address alignment in the
2236 (Stub_table::do_reset_address_and_file_offset): Define method in
2237 class definition instead of declaring it there. Set current data
2238 size to be the data size of the previous pass.
2239 (Stub_table::set_final_data_size): Use current data size as the
2240 final data size.
2241 (Stub_table::relocate_stub): Change parameter type of stub from
2242 Reloc_stub pointer to Stub pointer.
2243 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
2244 (Stub_table::Cortex_a8_stub_list): New typedef.
2245 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
2246 Stub_table::prev_addralign_): New data member.
2247 (Arm_relobj::Arm_relobj): Initialize data member
2248 section_has_cortex_a8_workaround_.
2249 (Arm_relobj::section_has_cortex_a8_workaround,
2250 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
2251 definitions.
2252 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
2253 declarations.
2254 (Target_arm::relocate_stub): Change parameter type of stub from
2255 Reloc_stub pointer to Stub pointer.
2256 (Insn_template::size, Insn_template::alignment): Handle
2257 THUMB16_SPECIAL_TYPE.
2258 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
2259 Stub_table::update_data_size_and_addralign,
2260 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
2261 definitions.
2262 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
2263 (Stub_table::do_write): Ditto.
2264 (Target_arm::do_relax): Adjust code for changes in Stub_table.
2265
880cd20d
ILT
22662010-01-08 Ian Lance Taylor <iant@google.com>
2267
2268 PR 11108
2269 * symtab.h (class Symbol): Remove fields is_target_special_ and
2270 has_plt_offset_. Add field is_defined_in_discarded_section_.
2271 (Symbol::is_defined_in_discarded_section): New function.
2272 (Symbol::set_is_defined_in_discarded_section): New function.
2273 (Symbol::has_plt_offset): Rewrite.
2274 (Symbol::set_plt_offset): Verify that new offset is not -1U.
2275 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
2276 Don't initialize is_target_special_ or has_plt_offset_.
2277 Initialize is_defined_in_discarded_section_.
2278 (Symbol_table::add_from_relobj): If appropriate, set
2279 is_defined_in_discarded_section.
2280 * resolve.cc (Symbol::override_base_with_special): Don't test
2281 is_target_special_. Change has_plt_offset_ to has_plt_offset().
2282 * target-reloc.h (relocate_section): Do special handling for
2283 symbols defined in discarded sections for global symbols as well
2284 as local symbols.
2285
2703e3eb
ILT
22862010-01-08 Ian Lance Taylor <iant@google.com>
2287
2288 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
2289 the SHT_SYMTAB case.
2290
339d40a3
ILT
22912010-01-08 Ian Lance Taylor <iant@google.com>
2292
2293 * object.cc (Sized_relobj::do_layout): Don't get confused if
2294 layout_eh_frame returns NULL.
2295
abecea76
ILT
22962010-01-08 Ian Lance Taylor <iant@google.com>
2297
2298 PR 11084
2299 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
2300 dynamic symbol table, use the normal symbol table.
2301 (Sized_dynobj::do_read_symbols): Remove assertion about type of
2302 symbol table.
2303
6b7dd3f3
ILT
23042010-01-08 Ian Lance Taylor <iant@google.com>
2305
2306 PR 11072
2307 * layout.cc (Layout::include_section): Remove .gnu_debuglink
2308 sections.
2309
36c50e63
L
23102010-01-08 H.J. Lu <hongjiu.lu@intel.com>
2311
2312 * version.cc (print_version): Change to "Copyright 2010".
2313
e291e7b9
ILT
23142010-01-08 Ian Lance Taylor <iant@google.com>
2315
2316 PR 10287
2317 PR 11063
2318 * i386.cc (class Target_i386): Change return type of plt_section
2319 to be non-const.
2320 (class Output_data_plt_i386): Add tls_desc_rel_ field.
2321 (Output_data_plt_i386::Output_data_plt_i386): Initialize
2322 tls_desc_rel_ field.
2323 (Output_data_plt_i386::rel_tls_desc): New function.
2324 (Target_i386::rel_tls_desc_section): New function.
2325 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
2326 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
2327 R_386_TLS_DESC reloc in rel_tls_desc_section.
2328 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
2329 Define struct Tlsdesc_info.
2330 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
2331 (Target_x86_64::do_reloc_symbol_index): New function.
2332 (Target_x86_64::add_tlsdesc_info): New function.
2333 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
2334 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
2335 tlsdesc_rel_ field.
2336 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
2337 all callers.
2338 (Output_data_plt_x86_64::rela_tlsdesc): New function.
2339 (Target_x86_64::rela_tlsdesc_section): New function.
2340 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
2341 handling.
2342 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
2343 (Target_x86_64::do_reloc_addend): New function.
2344 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
2345 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
2346 declarations. Define TARGET_CODE. Add arg field to u1_ union.
2347 (Output_reloc::type): New function.
2348 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
2349 (Output_reloc::is_target_specific): New function.
2350 (Output_reloc::target_arg): New function.
2351 (class Output_reloc) [SHT_RELA]: Add four new constructors for
2352 absolute relocs and target specific relocs.
2353 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
2354 add_target_specific.
2355 (class Output_data_reloc) [SHT_RELA]: Likewise.
2356 * output.cc (Output_reloc::Output_reloc): Add four new versions
2357 for absolute relocs and target specific relocs.
2358 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
2359 (Output_reloc::get_symbol_index): Likewise.
2360 (Output_reloc::local_section_offset): Check that local_sym_index_
2361 is not TARGET_CODE or 0.
2362 (Output_reloc::symbol_value): Likewise.
2363 (Output_reloc::write) [SHT_RELA]: Call target for target specific
2364 reloc.
2365 * target.h (class Target): Add reloc_symbol_index and reloc_addend
2366 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
2367 functions.
2368 * layout.cc (add_target_dynamic_tags): Use output section for
2369 DT_PLTRELSZ and DT_JMPREL.
2370
3a44184e
ILT
23712010-01-07 Ian Lance Taylor <iant@google.com>
2372
2373 PR 11061
2374 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
2375 function.
2376 (class Output_data_reloc_generic): Define.
2377 (class Output_data_reloc_base): Change base class to
2378 Output_data_reloc_generic. Change add() method to call
2379 bump_relative_reloc_count for a relative reloc. Remove
2380 sort_relocs_ field.
2381 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
2382 to sort_relocs().
2383 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
2384 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
2385 appropriate.
2386 * layout.h (class Layout): Update declaration.
2387
ea715a34
ILT
23882010-01-07 Ian Lance Taylor <iant@google.com>
2389
2390 * output.h (class Output_data): Add const version of
2391 output_section and do_output_section.
2392 (class Output_section_data): Add const version of
2393 do_output_section.
2394 (class Output_section): Likewise.
2395 * layout.cc (Layout::add_target_dynamic_tags): New function.
2396 * layout.h (class Layout): Update declarations.
2397 * arm.cc (Target_arm::do_finalize_sections): Use
2398 add_target_dynamic_tags.
2399 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2400 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2401 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2402 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2403
659948a4
ILT
24042010-01-07 Ian Lance Taylor <iant@google.com>
2405
2406 PR 11042
2407 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
2408 object as needed.
2409
9d3b86f6
ILT
24102010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
2411 Ian Lance Taylor <iant@google.com>
2412
2413 PR 11019
2414 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
2415 Xindex::read_symtab_xindex.
2416
bb0d3eb0
DK
24172010-01-07 Doug Kwan <dougkwan@google.com>
2418
2419 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
2420 (Insn_template::thumb16_bcond_insn): New method declaration.
2421 (Insn_template): Fix spelling.
2422 (Stub::thumb16_special): New method declaration.
2423 (Stub::do_write): Define virtual method which was previously pure
2424 virtual.
2425 (Stub::do_thumb16_special): New method declaration.
2426 (Stub::do_fixed_endian_write): New template member.
2427 (Reloc_stub::do_write): Remove.
2428 (Reloc_stub::do_fixed_endian_write): Remove.
2429 (Cortex_a8_stub): New class definition.
2430 (Stub_factory::make_cortex_a8_stub): New method definition.
2431 (Stub_factory::Stub_factory): Add missing static storage class
2432 qualifier for elf32_arm_stub_a8_veneer_blx.
2433
ffeef7df
ILT
24342010-01-07 Ian Lance Taylor <iant@google.com>
2435
dc3f80fe
ILT
2436 PR 10980
2437 * options.h (class General_options): Add --warn-unresolved-symbols
2438 and --error-unresolved-symbols.
2439 * errors.cc (Errors::undefined_symbol): Implement
2440 --warn-unresolved-symbols.
2441
ffeef7df
ILT
2442 * options.h (class General_options): Add -z text and -z textoff.
2443 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
2444
f1ec9ded
ST
24452010-01-06 Sriraman Tallam <tmsriram@google.com>
2446
2447 * gc.h (Garbage_collection::Cident_section_map): New typedef.
2448 (Garbage_collection::cident_sections): New function.
2449 (Garbage_collection::add_cident_section): New function.
2450 (Garbage_collection::cident_sections_): New member.
2451 (gc_process_relocs): Add references to sections whose names are C
2452 identifiers.
2453 * gold.h (cident_section_start_prefix): New constant.
2454 (cident_section_stop_prefix): New constant.
2455 (is_cident): New function.
2456 * layout.cc (Layout::define_section_symbols): Replace string constants
2457 with the newly defined constants.
2458 * object.cc (Sized_relobj::do_layout): Track sections whose names are
2459 C identifiers.
2460 * testsuite/Makefile.am: Add gc_orphan_section_test.
2461 * testsuite/Makefile.in: Regenerate.
2462 * testsuite/gc_orphan_section_test.cc: New file.
2463 * testsuite/gc_orphan_section_test.sh: New file.
2464
6eda8c29
ILT
24652010-01-06 Ian Lance Taylor <iant@google.com>
2466
b9674e17
ILT
2467 PR 10980
2468 * options.h (class General_options): Add --warn-shared-textrel.
2469 * layout.cc (Layout::finish_dynamic_section): Implement
2470 --warn-shared-textrel.
2471
6eda8c29
ILT
2472 PR 10980
2473 * options.h (class General_options): Add --warn-multiple-gp.
2474
32dcd44e
ILT
24752010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2476
2477 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
2478 $(THREADSLIB) and $(LIBDL).
2479 * Makefile.in: Rebuild.
2480
a192ba05
ILT
24812010-01-06 Ian Lance Taylor <iant@google.com>
2482
2483 PR 10980
2484 * options.cc (General_options::parse_section_start): New function.
2485 (General_options::section_start): New function.
2486 (General_options::General_options): Initialize all members.
2487 * options.h: Include <map>
2488 (class General_options): Add --section-start. Add section_starts_
2489 member.
2490 * layout.cc (Layout::attach_allocated_section_to_segment): If
2491 --section-start was used, set the address of the segment. Remove
2492 local sort_sections.
2493 (Layout::relaxation_loop_body): If the address of the load segment
2494 has been set by --section-start, don't use it.
2495 * output.h (Output_segment::update_flags_for_output_section): New
2496 function.
2497 * output.cc (Output_segment::add_output_section): Call
2498 update_flags_for_output_section.
2499
dde3f402
ILT
25002010-01-05 Ian Lance Taylor <iant@google.com>
2501
62dfdd4d
ILT
2502 PR 10980
2503 * options.h (class General_options): Add --undefined-version.
2504 * script.cc (struct Version_expression): Add was_matched_by_symbol
2505 field.
2506 (Version_script_info::matched_symbol): New function.
2507 (Version_script_info::get_symbol_version_helper): Call
2508 matched_symbol.
2509 (Version_script_info::check_unmatched_names): New function.
2510 * script.h (class Version_script_info): Update declarations.
2511 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
2512
9c4ae156
ILT
2513 * options.h (class General_options): Use DEFINE_bool_alias for
2514 allow_multiple_definition.
2515 * resolve.cc (Symbol_table::should_override): Don't test
2516 allow_multiple_definition.
2517
dde3f402
ILT
2518 PR 10980
2519 * options.h (class General_options): Add --cref.
2520 * main.cc (main): Print cref table if --cref. Don't close mapfile
2521 until after printing cref table.
2522 * cref.cc: Include "symtab.h".
2523 (class Cref_inputs): Define Cref_table_compare and Cref_table.
2524 (Cref_table_compare::operator()): New function.
2525 (Cref_inputs::gather_cref): New function.
2526 (filecol): New static const.
2527 (Cref_inputs::print_cref): New function.
2528 (Cref::print_cref): New function.
2529 * cref.h: Include <cstdio>.
2530 (class Cref): Update declarations.
2531 * mapfile.h (Mapfile::file): New function.
2532 * object.h (class Object): Define Symbols. Declare virtual
2533 do_get_global_symbols.
2534 (Object::get_global_symbols): New function.
2535 * object.cc (Input_objects::add_object): Pass object to cref_ if
2536 --cref.
2537 (Input_objects::archive_start): Likewise.
2538 (Input_objects::archive_stop): Likewise.
2539 (Input_objects::print_cref): New function.
2540 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
2541 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
2542 --cref.
2543 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
2544 function.
2545 * plugin.h (class Sized_pluginobj): Update declarations.
2546
8781f709
ILT
25472010-01-05 Ian Lance Taylor <iant@google.com>
2548
2549 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
2550 to is_default_version. Rename insdef to insdefault.
2551 (Symbol_table::add_from_relobj): Rename def to is_default_version
2552 and local to is_forced_local.
2553 (Symbol_table::add_from_pluginobj): Likewise.
2554 (Symbol_table::add_from_dynobj): Likewise.
2555 (Symbol_table::define_special_symbol): Rename insdef to
2556 insdefault.
2557
fe35d28d
ILT
25582010-01-04 Ian Lance Taylor <iant@google.com>
2559
30bc8c46
ILT
2560 PR 10980
2561 * options.h (class General_options): Add
2562 --allow-multiple-definition and -z muldefs.
2563 * resolve.cc (Symbol_table::should_override): Don't warn about a
2564 multiple symbol definition if --allow-multiple-definition or -z
2565 muldefs.
2566
7eaea549
ILT
2567 PR 10980
2568 * options.h (class General_options): Add --add-needed and
2569 --copy-dt-needed-entries. Tweak --as-needed help entry.
2570 * object.cc (Input_objects::check_dynamic_dependencies): Give an
2571 error if --copy-dt-needed-entries aka --add-needed is used and
2572 would cause a change in behaviour.
2573
fe35d28d
ILT
2574 PR 10980
2575 * options.h (class General_options): Add -G as a short version of
2576 --shared. Add no-op options -assert, -g, and -i.
2577
55a2bb35
ST
25782010-01-04 Sriraman Tallam <tmsriram@google.com>
2579
2580 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
2581 check for .text or .gnu.linkonce.t sections.
2582 * icf.cc (Icf::find_identical_sections): Ditto.
2583 Change the detection for mangled function name within the section
2584 name.
2585 * icf.h (is_section_foldable_candidate): New function.
2586
719328e1
ILT
25872009-12-30 Ian Lance Taylor <iant@google.com>
2588
2589 PR 10980
2590 * options.h (class General_options): Permit two dashes with
2591 --retain-symbols-file.
2592
d7bb5745
ILT
25932009-12-30 Ian Lance Taylor <iant@google.com>
2594
403a15dd
ILT
2595 PR 10979
2596 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
2597 don't put the file header and segment headers in the text
2598 segment.
2599
eda294df
ILT
2600 PR 10979
2601 * common.cc (Sort_commons::operator()): Stabilize sort when both
2602 entries are NULL.
2603 (Symbol_table::do_allocate_commons_list): When allocating common
2604 symbols, skip a symbol which is no longer common.
2605 * symtab.h (Symbol::is_common): Test whether the symbol comes from
2606 an object before checking its type.
2607 * testsuite/common_test_2.c: New file.
2608 * testsuite/common_test_3.c: New file.
2609 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
2610 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
2611 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
2612 (common_test_2_pic.o, common_test_2.so): New targets.
2613 (common_test_3_pic.o, common_test_3.so): New targets.
2614 * testsuite/Makefile.in: Rebuild.
2615
d7bb5745
ILT
2616 PR 10979
2617 * script.cc (read_input_script): If we see a new SECTIONS clause,
2618 and we have added an input section, give an error.
2619 * layout.h (class Layout): Add have_added_input_section function.
2620 Add have_added_input_section_ field.
2621 * layout.cc (Layout::Layout): Initialize
2622 have_added_input_section_.
2623 (Layout::layout): Set have_added_input_section_.
2624 (Layout::layout_eh_frame): Likewise.
2625
fc59c572
ILT
26262009-12-30 Ian Lance Taylor <iant@google.com>
2627
2628 PR 10931
2629 * options.h (class General_options): Add --sort-common option.
2630 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
2631 * common.cc (Sort_common): Add sort_order parameter to
2632 constructor. Add sort_order_ field.
2633 (Sort_commons::operator): Check sort_order_.
2634 (Symbol_table::allocate_commons): Determine the sort order.
2635 (Symbol_table::do_allocate_commons): Add sort_order parameter.
2636 Change all callers.
2637 (Symbol_table::do_allocate_commons_list): Likewise.
2638
1c74fab0
ILT
26392009-12-30 Ian Lance Taylor <iant@google.com>
2640
2641 PR 10916
2642 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
2643 symbols from this object, don't change the visibility of an
2644 undefined symbol.
2645 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
2646
6affe781
ILT
26472009-12-30 Ian Lance Taylor <iant@google.com>
2648
2649 PR 10861
2650 * script.h (class Version_script_info): Define Language enum.
2651 Update declarations. Define Glob, Exact, and Lookup types. Add
2652 new fields globals_, locals_, and is_finalized_.
2653 * script.cc: Various formatting fixes.
2654 (class Parser_closure): Change language_stack_ from a vector of
2655 std::string to one of Version_script_info::Language. Adjust all
2656 uses accordingly.
2657 (class Lazy_demangler): Remove.
2658 (struct Version_expression): Change language from std::string to
2659 Version_script_info::Language.
2660 (Version_script_info::Version_script_info): New function.
2661 (Version_script_info::~Version_script_info): Don't call clear.
2662 (Version_script_info::finalize): New function.
2663 (Version_script_info::build_lookup_tables): New function.
2664 (Version_script_info::build_expression_list_lookup): New
2665 function.
2666 (Version_script_info::get_symbol_version_helper): Rewrite to use
2667 lookup tables.
2668 (Version_script_info::print_expression_list): Adjust to use
2669 Version_script_info::Language.
2670 (script_push_lex_into_version_mode): Check that the version script
2671 has not been finalized.
2672 (version_script_push_lang): Change language string to
2673 Version_script_info::Language.
2674 * options.cc (Command_line::version_script): New function.
2675 * options.h (class General_options): Add finalize_dynamic_list
2676 function. Change version_script from declaration to definition.
2677 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
2678 * testsuite/version_script.map: Remove duplicate def of foo.
2679 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
2680 version_script.map.
2681 * testsuite/Makefile.in: Rebuild.
2682
818bf354
ILT
26832009-12-30 Ian Lance Taylor <iant@google.com>
2684
2685 PR 10843
2686 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
2687 if the input symbol index is 0, make the output symbol index 0.
2688
ebcc8304
ILT
26892009-12-30 Ian Lance Taylor <iant@google.com>
2690
2691 PR 10670
2692 * options.h (class General_options): Add -x/--discard-all.
2693 * object.cc (Sized_relobj::do_count_local_symbols): Handle
2694 --discard-all. If the local symbol needs a dynamic entry, check
2695 that before handling --discard-locals.
2696
176fe33f
ILT
26972009-12-30 Ian Lance Taylor <iant@google.com>
2698
bb321bb1
ILT
2699 PR 10450
2700 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
2701 flags to PF_R.
2702 (Output_segment::add_output_section): Don't change the flags if
2703 the type is PT_TLS.
2704
176fe33f
ILT
2705 PR 10450
2706 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
2707 GNU hash table if they need a dynamic value. Otherwise, don't add
2708 them if they are defined in a dynamic object or are forced local.
2709
e8cd95c7
ILT
27102009-12-29 Ian Lance Taylor <iant@google.com>
2711
1b81fb71
ILT
2712 PR 10450
2713 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
2714 .gnu.hash table for a 32-bit target.
2715
8d6d383d
ILT
2716 PR 10450
2717 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
2718 regular and a dynamic object only needs a dynamic symbol table
2719 entry if it is externally visible.
2720
e785ec03
ILT
2721 PR 10450
2722 * i386.cc (class Target_i386): Initialize global_offset_table_ in
2723 constructor. Add global_offset_table_ field.
2724 (Target_i386::got_section): Set global_offset_table_.
2725 (Target_i386::do_finalize_sections): Set global_offset_table_
2726 size.
2727 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
2728 in constructor. Add global_offset_table_ field.
2729 (Target_x86_64::got_section): Set global_offset_table_.
2730 (Target_x86_64::do_finalize_sections): Set global_offset_table_
2731 size.
2732
1a2dff53
ILT
2733 * layout.cc (Layout::Layout): Initialize increase_relro_.
2734 (Layout::get_output_section): Add is_relro, is_last_relro, and
2735 is_first_non_relro parameters. Change all callers.
2736 (Layout::choose_output_section): Likewise.
2737 (Layout::add_output_section_data): Likewise.
2738 (Layout::make_output_section): Likewise.
2739 (Layout::set_segment_offsets): Clear increase_relro when using a
2740 linker script.
2741 * layout.h (class Layout): Add increase_relro method. Add
2742 increase_relro_ field. Update declarations.
2743 * output.cc (Output_section::Output_section): Initialize
2744 is_last_relro_ and is_first_non_relro_.
2745 (Output_segment::add_output_section): Group relro sections is
2746 do_sort is true. Handle is_last_relro and is_first_non_relro.
2747 (Output_segment::maximum_alignment): Remove relro handling.
2748 (Output_segment::set_section_addresses): Add increase_relro
2749 parameter. Change all callers. Add initial alignment to align
2750 relro sections on separate page. Remove old relro handling.
2751 (Output_segment::set_section_list_addresses): Remove in_relro
2752 parameter. Change all callers.
2753 (Output_segment::set_offset): Add increase parameter. Change all
2754 callers. Remove old relro handling.
2755 * output.h (class Output_section): Add new methods: is_last_relro,
2756 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
2757 Add is_last_relro_ and is_first_non_relro_ fields.
2758 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
2759 Create separate .got.plt section. Call increase_relro.
2760 * x86_64.cc (Target_x86_64::got_section): Likewise.
2761 * testsuite/relro_script_test.t: Add .got.plt.
2762
f0ba79e2
ILT
2763 PR 10450
2764 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
2765 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
2766 (Layout::finalize): Call set_dynamic_symbol_size.
2767 (Layout::set_dynamic_symbol_size): New function.
2768 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
2769 set_dynamic_symbol_size.
2770
e8cd95c7
ILT
2771 PR 10450
2772 * output.h (class Output_section): Add is_entsize_zero_ field.
2773 * output.cc (Output_section::Output_section): Initialize
2774 is_entsize_zero_.
2775 (Output_section::set_entsize): If two different entsizes are
2776 requested, force it to zero.
2777 (Output_section::add_input_section): Set flags for .debug_str
2778 before updating section flags. Set entsize.
2779 (Output_section::update_flags_for_input_section): Set SHF_MERGE
2780 and SHF_STRING if all input sections have those flags.
2781
3e1b9a8a
RÁE
27822009-12-29 Rafael Espindola <espindola@google.com>
2783
2784 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
2785 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
2786 reporting.
3e1b9a8a 2787
3dcad376
ST
27882009-12-29 Sriraman Tallam <tmsriram@google.com>
2789
2790 * options.cc (General_options::parse_version): Allow -v to exit
2791 without an error if there is nothing to link.
2792
084e2665
ILT
27932009-12-29 Ian Lance Taylor <iant@google.com>
2794
2795 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
2796 using a version of gcc before 4.1.
2797 * configure: Rebuild.
2798
250acde3
CD
27992009-12-28 Chris Demetriou <cgd@google.com>
2800
2801 * attributes.cc (Output_attributes_section_data::do_write): Use
2802 std::vector::front rather than std::vector::data.
2803
99fff23b
ILT
28042009-12-28 Ian Lance Taylor <iant@google.com>
2805
2806 * symtab.h (class Symbol_table): Add enum Defined.
2807 * resolve.cc (Symbol_table::should_override): Add defined
2808 parameter. Change all callers. Test whether object is NULL
2809 before calling a method on it.
2810 (Symbol_table::report_resolve_problem): Add defined parameter.
2811 Change all callers.
2812 (Symbol_table::should_override_with_special): Likewise.
2813 * symtab.cc (Symbol_table::define_in_output_data): Add defined
2814 parameter. Change all callers.
2815 (Symbol_table::do_define_in_output_data): Likewise.
2816 (Symbol_table::define_in_output_segment): Likewise.
2817 (Symbol_table::do_define_in_output_segment): Likewise.
2818 (Symbol_table::define_as_constant): Likewise.
2819 (Symbol_table::do_define_as_constant): Likewise.
2820 * script.h (class Symbol_assignment): Add is_defsym parameter to
2821 constructor; change all callers.
2822 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
2823 parameter. Change all callers. Add is_defsym_ field.
2824 (class Parser_closure): Add parsing_defsym parameter to
2825 constructor; change all callers. Add parsing_defsym accessor
2826 function. Add parsing_defsym_ field.
2827
556bd683
ILT
28282009-12-28 Ian Lance Taylor <iant@google.com>
2829
2830 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 2831 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 2832
1782c879
ILT
28332009-12-23 Ian Lance Taylor <iant@google.com>
2834
2835 * i386.cc (Target_i386::do_calls_non_split): Recognize
2836 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
2837 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
2838 -fsplit-stack prologue when using %r11.
1782c879 2839
329ca2b1
ST
28402009-12-21 Sriraman Tallam <tmsriram@google.com>
2841
2842 * options.cc (General_options::parse_version): Make -v continue and do
2843 the link like GNU ld does.
2844
d675ff46
RÁE
28452009-12-17 Rafael Avila de Espindola <espindola@google.com>
2846
2847 * Makefile.am (CCFILES): Add timer.cc.
2848 (HFILES): Add timer.h.
2849 * configure.ac: Check for sysconf and times.
2850 * main.cc: include timer.h.
2851 (main): Use Timer instead of get_run_time.
2852 * timer.cc: New.
2853 * timer.h: New.
2854 * workqueue.cc: include timer.h.
2855 (Workqueue::find_and_run_task):
2856 Report user, sys and wall time.
2857 * Makefile.in: Regenerate.
2858 * config.in: Regenerate.
2859 * configure: Regenerate.
2860
d6344fb5
DK
28612009-12-16 Doug Kwan <dougkwan@google.com>
2862
2863 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
2864 sections.
2865 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
2866 relaxed input sections.
2867 * output.cc (Output_section::find_relaxed_input_section): Change
2868 return type to Output_relaxed_input_section pointer. Adjust code
2869 for new type of relaxed_input_section_map_.
2870 * output.h (Output_section::find_relaxed_input_section): Change
2871 return type to Output_relaxed_input_section pointer.
2872 (Output_section::Output_relaxed_input_section_by_input_section_map):
2873 New type.
2874 (Output_section::relaxed_input_section_map_): Change type to
2875 Output_section::Output_relaxed_input_section_by_input_section_map.
2876 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
2877 input section.
2878
0e0d5469
ILT
28792009-12-15 Ian Lance Taylor <iant@google.com>
2880
2881 * layout.cc (Layout::create_shstrtab): Only write out after input
2882 sections if we are compressing debug sections.
2883
0649a889
ILT
28842009-12-15 Ian Lance Taylor <iant@google.com>
2885
2886 * archive.cc (Archive::add_symbols): Only look up a symbol without
2887 a version if there is, in fact, a version.
2888
2ea97941
ILT
28892009-12-14 Ian Lance Taylor <iant@google.com>
2890
2891 Revert -Wshadow changes, all changes from:
2892 2009-12-11 Doug Kwan <dougkwan@google.com>
2893 2009-12-11 Nick Clifton <nickc@redhat.com>
2894 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
2895
b0eec2cc
DK
28962009-12-11 Doug Kwan <dougkwan@google.com>
2897
2898 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
2899 due to -Wshadow.
2900 * attributes.cc (Object_attribute::size): Ditto.
2901 (Attributes_section_data::size): Ditto.
2902 (Attributes_section_data::Attributes_section_data): Ditto.
2903 (Output_attributes_section_data::do_write): Ditto.
2904 * attributes.h (Object_attribute::set_type): Ditto.
2905 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
2906
91d6fa6a
NC
29072009-12-11 Nick Clifton <nickc@redhat.com>
2908
2909 * archive.cc: Fix shadowed variable warnings.
2910 * arm.cc: Likewise.
2911 * compressed_output.cc: Likewise.
2912 * compressed_output.h: Likewise.
2913 * configure: Likewise.
2914 * dwarf_reader.cc: Likewise.
2915 * dynobj.cc: Likewise.
2916 * dynobj.h: Likewise.
2917 * ehframe.cc: Likewise.
2918 * ehframe.h: Likewise.
2919 * errors.cc: Likewise.
2920 * expression.cc: Likewise.
2921 * fileread.cc: Likewise.
2922 * fileread.h: Likewise.
2923 * freebsd.h: Likewise.
2924 * i386.cc: Likewise.
2925 * icf.cc: Likewise.
2926 * incremental.h: Likewise.
2927 * layout.cc: Likewise.
2928 * layout.h: Likewise.
2929 * mapfile.cc: Likewise.
2930 * merge.cc: Likewise.
2931 * merge.h: Likewise.
2932 * object.cc: Likewise.
2933 * object.h: Likewise.
2934 * options.h: Likewise.
2935 * output.cc: Likewise.
2936 * output.h: Likewise.
2937 * parameters.cc: Likewise.
2938 * plugin.cc: Likewise.
2939 * powerpc.cc: Likewise.
2940 * reduced_debug_output.cc: Likewise.
2941 * reduced_debug_output.h: Likewise.
2942 * reloc.cc: Likewise.
2943 * reloc.h: Likewise.
2944 * resolve.cc: Likewise.
2945 * script-sections.cc: Likewise.
2946 * script.cc: Likewise.
2947 * script.h: Likewise.
2948 * sparc.cc: Likewise.
2949 * symtab.cc: Likewise.
2950 * symtab.h: Likewise.
2951 * target-select.cc: Likewise.
2952 * target-select.h: Likewise.
2953 * token.h: Likewise.
2954 * workqueue.cc: Likewise.
2955 * workqueue.h: Likewise.
2956 * x86_64.cc: Likewise.
2957
a0351a69
DK
29582009-12-10 Doug Kwan <dougkwan@google.com>
2959
2960 * arm.cc (attributes.h): New include.
2961 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
2962 (Arm_relobj::~Arm_relobj): Delete object pointed by
2963 attributes_section_data_.
2964 (Arm_relobj::attributes_section_data): New method definition.
2965 (Arm_relobj::attributes_section_data_): New data member declaration.
2966 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
2967 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
2968 attributes_section_data_.
2969 (Arm_dynobj::attributes_section_data): New method definition.
2970 (Arm_dynobj::attributes_section_data_): New data member declaration.
2971 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
2972 initialization value of may_use_blx_ to false.
2973 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
2974 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
2975 object attributes to compute results instead of hard-coding.
2976 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
2977 Target_arm::get_secondary_compatible_arch,
2978 Target_arm::set_secondary_compatible_arch
2979 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
2980 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
2981 New method declarations.
2982 (Target_arm::get_aeabi_object_attribute): New method definition.
2983 (Target_arm::attributes_section_data_): New data member declaration.
2984 (read_arm_attributes_section): New template definition.
2985 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
2986 (Arm_dynobj::do_read_symbols): Ditto.
2987 (Target_arm::do_finalize_sections): Merge attributes sections from
2988 input. Check for BLX use after attributes section merging.
2989 Fix __exidx_start and __exidx_end visibility. Create an
2990 .ARM.attributes section if necessary.
2991 (Target_arm::get_secondary_compatible_arch,
2992 Target_arm::set_secondary_compatible_arch,
2993 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
2994 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 2995 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
2996 New method definitions.
2997
b59befec
ILT
29982009-12-09 Ian Lance Taylor <iant@google.com>
2999
3000 * plugin.cc (Plugin::load): Don't cast from void* to a function
3001 pointer.
3002
1276bc89
ILT
30032009-12-09 Ian Lance Taylor <iant@google.com>
3004
3005 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
3006 information fields.
3007
2f2de248
L
30082009-12-09 H.J. Lu <hongjiu.lu@intel.com>
3009
3010 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
3011 Replace two_file_shared_1.so with two_file_shared_2.so.
3012 * testsuite/Makefile.in: Regenerated.
3013
4f787271
DK
30142009-12-08 Doug Kwan <dougkwan@google.com>
3015
3016 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
3017 (HFILES): Add attributes.h and int_encoding.h.
3018 * Makefile.in: Regenerate.
3019 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
3020 function definitions to int_encoding.cc
3021 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
3022 prototypes to int_encoding.h
3023 * reduced_debug_output.cc (int_encoding.h): New include.
3024 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
3025 function definitions to int_encoding.cc
3026 (insert_into_vector, read_from_pointer): Move template definitions to
3027 int_encoding.h
3028 * attributes.cc: New file.
3029 * attributes.h: New file.
3030 * int_encoding.cc: New file.
3031 * int_encoding.h: New file.
3032
20b52f1a
RÁE
30332009-12-07 Rafael Avila de Espindola <espindola@google.com>
3034
3035 PR gold/11055
3036 * incremental-dump.cc (dump_incremental_inputs): New.
3037 (main): Use dump_incremental_inputs.
3038
53d7974c
L
30392009-12-07 H.J. Lu <hongjiu.lu@intel.com>
3040
3041 PR gold/10893
3042 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
3043 checking elfcpp::STT_FUNC.
3044 (Target_i386::Relocate::relocate): Likewise.
3045 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3046
3047 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
3048 symbols from shared libraries into normal FUNC symbols.
3049
3050 * symtab.h (Symbol): Add is_func and use it.
3051
05a352e6
DK
30522009-12-05 Doug Kwan <dougkwan@google.com>
3053
3054 * arm.cc (Target_arm::arm_info): Initialize new fields
3055 attributes_section and attributes_vendor.
3056 * i386.cc (Target_i386::i386_info): Same.
3057 * object.cc (Sized_relobj::do_layout): Skip attribute section.
3058 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
3059 fields attributes_section and attributes_vendor.
53d7974c 3060 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
3061 * target.h (Target::attributes_section, Target::attributes_vendor,
3062 Target::is_attributes_section, Target::attribute_arg_type,
3063 Target::attributes_order): New method definitions.
3064 (Target::Target_info::attributes_section,
3065 Target::Target_info::attributes_vendor): New fields.
3066 (Target::do_attribute_arg_type, Target::do_attributes_order): New
3067 virtual method definitions.
3068 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
3069 attributes_section and attributes_vendor.
3070 * testsuite/testfile.cc (Target_test::test_target_info): Same.
3071
f4e5969c
DK
30722009-12-05 Doug Kwan <dougkwan@google.com>
3073
3074 * arm.cc: Update comments about interworking and stub generation.
3075 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
3076 considered as non-PIC.
3077 (Arm_relocate_functions::base_abs): Fix formatting.
3078 (Arm_relocate_functions::got_prel): Fix comment. Change interface
3079 of function to use GOT entry address instead of offset.
3080 (Target_arm::Scan::global): Issue an error if a symbol would need a
3081 PLT does not get one because it is untyped. Remove code to create
3082 dynamic symbols for relative branches.
3083 (Target_arm::Relocate::relocate: Use 0 instead of false since function
3084 takes unsigned integer instead of boolean.
3085
1abce4a6
L
30862009-12-05 H.J. Lu <hongjiu.lu@intel.com>
3087
3088 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
3089 (two_file_test_LDADD): Likewise.
3090 (common_test_1_LDADD): Likewise.
3091 (exception_test_LDADD) Likewise.
3092 (weak_test_LDADD): Likewise.
3093 (many_sections_test_LDADD): Likewise.
3094 (initpri1_LDADD): Likewise.
3095 (script_test_1_LDADD): Likewise.
3096 (script_test_2_LDADD): Likewise.
3097 (justsyms_LDADD): Likewise.
3098 (binary_test_LDADD): Likewise.
3099 (large_LDADD): Likewise.
3100 * testsuite/Makefile.in: Regenerated.
3101
adcf2816 31022009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 3103
adcf2816
L
3104 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
3105 (Symbol_table::override_with_special): Likewise.
3106 (Symbol_table::add_from_object): Likewise.
3107
28e67f5d
RÁE
31082009-12-04 Rafael Avila de Espindola <espindola@google.com>
3109
3110 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3111 Don't set the data_offset twice.
3112
ae10a101
RÁE
31132009-12-04 Rafael Avila de Espindola <espindola@google.com>
3114
3115 * testsuite/Makefile.in: Regenerate.
3116
f59f41f3
DK
31172009-12-03 Doug Kwan <dougkwan@google.com>
3118
3119 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
3120 (Target_arm::do_finalize_sections): Add parameter for symbol table
3121 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
3122 * i386.cc (Target_i386::do_finalize_sections): Add an additional
3123 parameter for symbol table pointer.
3124 * layout.cc (Layout::finalize): Call Target::finalize_sections with
3125 an additional parameter for a pointer to symbol table.
3126 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
3127 parameter for a symbol table pointer.
3128 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
3129 * target.h (Target::finalize_sections, Target::do_finalize_sections):
3130 Ditto.
3131 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
3132 parameter for a symbol table pointer.
3133
ca55d848
RÁE
31342009-12-03 Rafael Avila de Espindola <espindola@google.com>
3135
3136 * incremental.cc (Incremental_inputs_header)
3137 (Incremental_inputs_header_write, Incremental_inputs_entry)
3138 (Incremental_inputs_entry_write): Move ...
3139 * incremental.h (Incremental_inputs_header)
3140 (Incremental_inputs_header_write, Incremental_inputs_entry)
3141 (Incremental_inputs_entry_write): here.
3142
3aec4f9c
RÁE
31432009-12-02 Rafael Avila de Espindola <espindola@google.com>
3144
3145 * incremental.cc (make_sized_incremental_binary): Set the target.
3146 Error if it is incompatible.
3147 * output.h (Output_file): Add filename method.
3148
9c0ae74d
RÁE
31492009-12-02 Rafael Avila de Espindola <espindola@google.com>
3150
3151 * incremental.cc (Incremental_inputs_entry): Remove unused argument
3152 from the get_* methods.
3153
a45500ae
RÁE
31542009-12-02 Rafael Avila de Espindola <espindola@google.com>
3155
3156 * incremental-dump.cc (main): Check that the offeset of a script is 0.
3157 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3158 Write 0 for the data_offset of scripts.
3159
325e6408
RÁE
31602009-12-02 Rafael Avila de Espindola <espindola@google.com>
3161
3162 * testsuite/Makefile.am: Add the incremental_test.sh test.
3163 * testsuite/incremental_test.sh: New.
3164 * testsuite/incremental_test_1.c: New.
3165 * testsuite/incremental_test_2.c: New.
3166
954c3e2e
RÁE
31672009-12-01 Rafael Avila de Espindola <espindola@google.com>
3168
3169 * incremental-dump.cc (main): Fix typos.
3170
f8086623
RÁE
31712009-11-27 Rafael Avila de Espindola <espindola@google.com>
3172
3173 PR gold/11025
3174 * incremental-dump.cc (main): Use llu to print 64 bit values.
3175
3b0dd6ac
L
31762009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
3177 H.J. Lu <hongjiu.lu@intel.com>
3178
3179 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
3180 $(LIBDL).
3181 (incremental_dump_LDADD): Likewise.
3182 * Makefile.in: Regenerated.
3183
a6d1ef57 31842009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 3185
a6d1ef57
DK
3186 Revert:
3187
3188 2009-11-25 Doug Kwan <dougkwan@google.com>
3189
3190 * arm.cc (Target_arm::Target_arm): Move method definition
3191 outside of class definition. Add code to handle
3192 --target1-rel, --target1-abs and --target2= options.
3193 (Target_arm::get_reloc_reloc_type): Change method to be
3194 non-static and const.
3195 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
3196 New data member declaration.
3197 (Target_arm::Scan::local, Target_arm::Scan::global,
3198 Target_arm::Relocate::relocate,
3199 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3200 Adjust call to Target_arm::get_real_reloc_type.
3201 (Target_arm::get_real_reloc_type): Use command line options
3202 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3203 * options.h (--target1-rel, --target1-abs, --target2): New
3204 ARM-only options.
3205
50aeb7d4
DK
32062009-11-25 Doug Kwan <dougkwan@google.com>
3207
3208 * arm.cc (Target_arm::Target_arm): Move method definition outside of
3209 class definition. Add code to handle --target1-rel, --target1-abs
3210 and --target2= options.
3211 (Target_arm::get_reloc_reloc_type): Change method to be non-static
3212 and const.
3213 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
3214 member declaration.
3215 (Target_arm::Scan::local, Target_arm::Scan::global,
3216 Target_arm::Relocate::relocate,
3217 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
3218 call to Target_arm::get_real_reloc_type.
3219 (Target_arm::get_real_reloc_type): Use command line options to
3220 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3221 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
3222 options.
3223
51938283
DK
32242009-11-25 Doug Kwan <dougkwan@google.com>
3225
3226 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
3227 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
3228 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
3229 formatting.
3230 (Arm_relocate_functions::thm_call): Replace body with a call to
3231 Arm_relocate_functions::thumb_branch_common.
3232 (Arm_relocate_functions::thm_jump24,
3233 Arm_relocate_functions::thm_xpc22): New method definitions.
3234 (Arm_relocate_functions::thumb_branch_common): New method definition.
3235 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
3236 operator.
3237 (Target_arm::Relocate::relocate): Adjust call to thm_call.
3238 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
3239
e2b8f3c4
RÁE
32402009-11-24 Rafael Avila de Espindola <espindola@google.com>
3241
3242 * Makefile.am: Build incremental-dump
3243 * Makefile.in: Regenerate.
3244 * incremental-dump.cc: New.
3245 * incremental.cc (Incremental_inputs_header_data,
3246 Incremental_inputs_entry_data): Move to incremental.h
3247 * incremental.h: (Incremental_inputs_header_data,
3248 Incremental_inputs_entry_data): Move from incremental.cc
3249
bcba9aec
RÁE
32502009-11-24 Rafael Avila de Espindola <espindola@google.com>
3251
3252 * incremental.cc (Incremental_inputs_header,
3253 Incremental_inputs_header_write, Incremental_inputs_entry,
3254 Incremental_inputs_entry_write): Add a typedef with the data type.
3255
7c3afe08
RÁE
32562009-11-24 Rafael Avila de Espindola <espindola@google.com>
3257
3258 * incremental.cc (Incremental_inputs_header,
3259 Incremental_inputs_header_write, Incremental_inputs_entry,
3260 Incremental_inputs_entry_write): Update comment about which
3261 type has the filed descriptions.
3262
d204b6e9
DK
32632009-11-15 Doug Kwan <dougkwan@google.com>
3264
3265 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
3266 (Arm_relocate_functions::arm_branch_common): Change method defintion
3267 in class definition to a method declaration and update list of formal
3268 parameters.
3269 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
3270 Arm_relocation_functions::jump24): Adjust call to
3271 Arm_relocate_functions::arm_branch_common. Update list of formal
3272 parameters.
3273 (Arm_relocate_functions::xpc25): New method definition.
3274 (Arm_relocate_functions::arm_branch_common): Move method defintion
3275 out from class definition. Use stubs for mode-switching and extending
3276 branch ranges.
3277 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
3278 specially. Change code to enable use of stubs in ARM branches.
3279
43d12afe
DK
32802009-11-10 Doug Kwan <dougkwan@google.com>
3281
3282 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
3283 in method declaration.
3284 (Target_arm::relocate_stub): New method declaration.
3285 (Target_arm::default_target): Change to return a pointer instead of
3286 a const reference.
3287 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
3288 Target_arm::default_target.
3289 (Arm_Relobj::do_relocate_sections): Remove options paramater in
3290 method definition.
3291 (Target_arm::relocate_section): Adjust view.
3292 (Target_arm::relocate_stub): New method definition.
3293
ac33a407
DK
32942009-11-10 Doug Kwan <dougkwan@google.com>
3295
3296 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
3297 a format warning.
3298 * incremental.cc (open_incremental_binary): Initialized local
3299 variables to avoid warnings.
3300 * object.cc (make_elf_object): Ditto.
3301 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
3302 a format warning.
e1df38aa 3303
88ee28e9
L
3304009-11-09 H.J. Lu <hongjiu.lu@intel.com>
3305
3306 PR gold/10930
3307 * testsuite/plugin_test.c: Include "config.h".
3308
2daedcd6
DK
33092009-11-09 Doug Kwan <dougkwan@google.com>
3310
3311 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
3312 (arm_symbol_value): Remove.
3313 (Arm_relocate_functions::arm_branch_common,
3314 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
3315 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
3316 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
3317 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
3318 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
3319 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
3320 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
3321 Arm_relocate_functions::thm_mobw_abs_nc,
3322 Arm_relocate_functions::thm_mov_abs,
3323 Arm_relocate_functions::movw_prel_nc,
3324 Arm_relocate_functions::thm_movt_abs,
3325 Arm_relocate_functions::movt_prel,
3326 Arm_relocate_functions::thm_movw_prel_nc,
3327 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
3328 (Target_arm::Relocate::relocate): Only decompose address into two
3329 parts if relocation type uses the thumb-bit and pass the actual
3330 bit instead of a flag indicating that the thumb-bit is used. Adjust
3331 calls to methods in Arm_relocate_functions for this change.
3332
1276bc89 33332009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
3334
3335 PR 10925
3336 * reloc.cc: Instantiate
3337 Sized_relobj::initialize_input_to_output_maps and
3338 Sized_relobj:free_input_to_output_maps.
3339
e53ad1b5
ILT
33402009-11-06 Ian Lance Taylor <iant@google.com>
3341
3342 PR 10876
3343 * defstd.cc (in_segment): Set only_if_ref true for "end".
3344
eb44217c
DK
33452009-11-06 Doug Kwan <dougkwan@google.com>
3346
3347 * arm.cc (class Reloc_stub): Correct a comment.
3348 (Target_arm::Target_arm): Initialize arm_input_section_map_.
3349 (Target_arm::scan_section_for_stubs): New method declaration.
3350 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
3351 Change methods from private to protected.
3352 (Target_arm::do_may_relax): New method definition.
3353 (Target_arm::do_relax, Target_arm::group_sections,
3354 Target_arm::scan_reloc_for_stub,
3355 Target_arm::scan_reloc_section_for_stubs): New method declarations.
3356 (Target_arm::arm_input_section_map_): New data member declaration.
3357 (Target_arm::scan_reloc_for_stub,
3358 Target_arm::scan_reloc_section_for_stubs,
3359 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
3360 Target_arm::do_relax): New method definitions.
3361
5d329b7d
ILT
33622009-11-06 Mikolaj Zalewski <mikolaj@google.com>
3363
3364 * configure.ac: Check for (struct stat)::st_mtim
3365 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
3366 * config.in: Regenerate.
3367 * configure: Regenerate.
3368
96a0d71b
ILT
33692009-11-05 Ian Lance Taylor <iant@google.com>
3370
3371 PR 10910
3372 * output.cc (Output_segment::add_output_section): Add missing
3373 return statement.
3374
594c8e5e
ILT
33752009-11-04 Ian Lance Taylor <iant@google.com>
3376
3377 PR 10880
3378 * object.h (class Object): Add is_needed and set_is_needed
3379 methods. Add is_needed_ field. Make bool fields into bitfields.
3380 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
3381 defined in a dynamic object and referenced by a regular object,
3382 set is_needed for the dynamic object.
3383 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
3384 if the file is marked with as_needed and it is not needed.
3385
22b127cc
ILT
33862009-11-04 Ian Lance Taylor <iant@google.com>
3387
3388 PR 10887
3389 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
3390 tags if data is discarded by linker script.
3391 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3392 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3393 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3394 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3395
f5c870d2
ILT
33962009-11-04 Ian Lance Taylor <iant@google.com>
3397
3398 * layout.cc (Layout::get_output_section): Add is_interp and
3399 is_dynamic_linker_section parameters. Change all callers.
3400 (Layout::choose_output_section): Likewise.
3401 (Layout::make_output_section): Likewise.
3402 (Layout::add_output_section_data): Add is_dynamic_linker_section
3403 parameter. Change all callers.
3404 * layout.h (class Layout): Update declarations.
3405 * output.h (class Output_section): Add is_interp, set_is_interp,
3406 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
3407 Add is_interp_, is_dynamic_linker_section_ fields. Change
3408 generate_code_fills_at_write_ to a bitfield.
3409 * output.cc (Output_section::Output_sections): Initialize new
3410 fields.
3411 (Output_segment::add_output_section): Add do_sort parameter.
3412 Change all callers.
3413
1ae4d23b
ILT
34142009-11-03 Ian Lance Taylor <iant@google.com>
3415
3416 PR 10860
3417 * options.h (class General_options): Add --warn-common.
3418 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
3419 merging two common symbols.
3420 (Symbol_table::should_override): Handle --warn-common when merging
3421 a common symbol with a defined symbol. Use report_resolve_problem
3422 for multiple definitions.
3423 (Symbol_table::report_resolve_problem): New function.
3424 * symtab.h (class Symbol_table): Declare report_resolve_problem.
3425
55da9579
DK
34262009-11-03 Doug Kwan <dougkwan@google.com>
3427
3428 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
3429 stub_factory_.
3430 (Target_arm::stub_factory): New method definition.
3431 (Target_arm::new_arm_input_section,
3432 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
3433 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 3434 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
3435 New type definitions.
3436 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
3437 member declarations.
3438 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
3439 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
3440 New method definitions.
3441
37a9ac43
ILT
34422009-11-03 Ian Lance Taylor <iant@google.com>
3443
3444 * options.h (class General_options): Add --warn_constructors.
3445
b3d6a3d4
ILT
34462009-11-03 Ian Lance Taylor <iant@google.com>
3447
3448 PR 10893
3449 * defstd.cc (in_section): Add entries for __rel_iplt_start,
3450 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
3451
934b01dd
ILT
34522009-11-03 Ian Lance Taylor <iant@google.com>
3453
3454 PR 10895
3455 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
3456 --msgid-bugs-address.
3457 (install-pdf): New target.
3458 (install-data_yes): Look up one directory to find mkinstalldirs.
3459
03c1939b
L
34602009-11-03 H.J. Lu <hongjiu.lu@intel.com>
3461
3462 * po/Make-in (.po.gmo): Don't generate .gmo files in source
3463 tree.
3464
ebd95253
DK
34652009-10-30 Doug Kwan <dougkwan@google.com>
3466
3467 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
3468
e9bbb538
DK
34692009-10-30 Doug Kwan <dougkwan@google.com>
3470
3471 * arm.cc (Stub_addend_reader): New struct template definition
3472 and partial specializations.
3473 (Stub_addend_reader::operator()): New method definition for a
3474 partially specialized template.
3475
d5b40221
DK
34762009-10-30 Doug Kwan <dougkwan@google.com>
3477
3478 * arm.cc (Arm_relobj::processor_specific_flags): New method
3479 definition.
3480 (Arm_relobj::do_read_symbols): New method declaration.
3481 (Arm_relobj::processor_specific_flags_): New data member declaration.
3482 (Arm_dynobj): New class definition.
3483 (Target_arm::do_finalize_sections): Add input_objects parameter.
3484 (Target_arm::do_adjust_elf_header): New method declaration.
3485 (Target_arm::are_eabi_versions_compatible,
3486 (Target_arm::merge_processor_specific_flags): New method declaration.
3487 (Target_arm::do_make_elf_object): New overloaded method definitions
3488 and declaration.
3489 (Arm_relobj::do_read_symbols): New method definition.
3490 (Arm_dynobj::do_read_symbols): Ditto.
3491 (Target_arm::do_finalize_sections): Add input_objects parameters.
3492 Merge processor-specific flags from all input objects.
3493 (Target_arm::are_eabi_versions_compatible,
3494 Target_arm::merge_processor_specific_flags,
3495 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
3496 New method definitions.
3497 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
3498 Input_objects pointer type parameter.
3499 * layout.cc (Layout::finalize): Pass input objects to target's.
3500 finalize_sections function.
3501 * output.cc (Output_file_header::do_sized_write): Set ELF file
3502 header's processor-specific flags.
3503 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
3504 Input_objects pointer type parameter.
3505 * sparc.cc (Target_sparc::do_finalize_sections): Same.
3506 * target.h (Input_objects): New forward class declaration.
3507 (Target::processor_specific_flags,
3508 Target::are_processor_specific_flags_sect): New method definitions.
3509 (Target::finalize_sections): Add input_objects parameter.
3510 (Target::Target): Initialize processor_specific_flags_ and
3511 are_processor_specific_flags_set_.
3512 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
3513 parameter.
3514 (Target::set_processor_specific_flags): New method definition.
3515 (Target::processor_specific_flags_,
3516 Target::are_processor_specific_flags_set_): New data member
3517 declarations.
3518 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
3519 Input_objects pointer type parameter.
3520
ebabffbd
DK
35212009-10-30 Doug Kwan <dougkwan@google.com>
3522
3523 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
3524
ad0f2072
ILT
35252009-10-28 Ian Lance Taylor <iant@google.com>
3526
3527 * object.h (class Relobj): Drop options parameter from
3528 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
3529 do_scan_relocs, do_relocate. Change all callers.
3530 (class Sized_relobj): Drop options parameters from
3531 do_gc_process_relocs, do_scan_relocs, do_relocate,
3532 do_relocate_sections, relocate_sections, emit_relocs_scan,
3533 emit_relocs_scan_reltype. Change all callers.
3534 (struct Relocate_info): Remove options field and all references to
3535 it.
3536 * reloc.h (class Read_relocs): Remove options constructor
3537 parameter and options_ field. Change all callers.
3538 (class Gc_process_relocs, class Scan_relocs): Likewise.
3539 (class Relocate_task): Likewise.
3540 * target-reloc.h (scan_relocs): Remove options parameter. Change
3541 all callers.
3542 (scan_relocatable_relocs): Likewise.
3543 * target.h (class Sized_target): Remove options parameter from
3544 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
3545 all callers.
3546 * gc.h (gc_process_relocs): Remove options parameter. Change all
3547 callers.
3548 * arm.cc: Update functions to remove options parameters.
3549 * i386.cc: Likewise.
3550 * powerpc.cc: Likewise.
3551 * sparc.cc: Likewise.
3552 * x86_64.cc: Likewise.
3553 * testsuite/testfile.cc: Likewise.
3554
8ffa3667
DK
35552009-10-28 Doug Kwan <dougkwan@google.com>
3556
3557 * arm.cc (Arm_relobj): New class definition.
e1df38aa 3558 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
3559 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
3560 New method definitions.
3561
40f36857
CC
35622009-10-28 Cary Coutant <ccoutant@google.com>
3563
3564 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
3565 (Plugin::cleanup_done_): New member.
3566 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
3567 (Plugin_manager::cleanup_done_): Remove.
3568 (Plugin_manager::add_input_file): Edit error message.
3569 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
3570 (Plugin_manager::cleanup): Remove use of cleanup_done_.
3571
2c849493
ILT
35722009-10-27 Mikolaj Zalewski <mikolajz@google.com>
3573
3574 * fileread.cc: (File_read::View::~View): Use the new
3575 data_ownership_ filed.
3576 (File_read::~File_read): Dispose the new whole_file_view_.
3577 (File_read::open): Mmap the whole file if needed.
3578 (File_read::open): Use whole_file_view_ instead of contents_.
3579 (File_read::find_view): Use whole_file_view_ if applicable.
3580 (File_read::do_read): Use whole_file_view_ instead of contents_.
3581 (File_read::make_view): Use whole_file_view_ instead of contents_,
3582 update File_read::View::View call.
3583 (File_read::find_or_make_view): Update File_read::View::View
3584 call.
3585 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
3586 remove contents_
3587 (File_read::View::Data_ownership): New enum.
3588 (File_read::View::View): Replace bool mapped_ with Data_ownership
3589 argument.
3590 (File_read::View::mapped_): Remove (replaced by data_ownership_).
3591 (File_read::View::data_ownership_): New field.
3592 (File_read::contents_): Remove (replaced by whole_file_view_).
3593 (File_read::whole_file_view_): New field.
3594 * options.h (class General_options): Add --keep-files-mapped.
3595
24998053
CC
35962009-10-27 Cary Coutant <ccoutant@google.com>
3597
3598 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
3599 * testsuite/Makefile.am (plugin_test_5): New test case.
3600 * testsuite/Makefile.in: Regenerate.
3601
72adc4fa
DK
36022009-10-25 Doug Kwan <dougkwan@google.com>
3603
3604 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
3605 from private to protected to allow access by child class.
3606 (Sized_relobj::do_relocate_sections): New method declaration.
3607 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 3608 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
3609 Sized_relobj::relocate_sections. Instantiate template explicitly
3610 for different target sizes and endianity.
3611
07f508a2
DK
36122009-10-24 Doug Kwan <dougkwan@google.com>
3613
3614 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
3615 (Arm_input_section::as_arm_input_section): New method.
3616 (Arm_output_section): New class definition.
3617 (Arm_output_section::create_stub_group,
3618 Arm_output_section::group_sections): New method definitions.
3619
10ad9fe5
DK
36202009-10-22 Doug Kwan <dougkwan@google.com>
3621
3622 * arm.cc (Arm_input_section): New class definition.
3623 (Arm_input_section::init, Arm_input_section:do_write,
3624 Arm_input_section::set_final_data_size,
3625 Arm_input_section::do_reset_address_and_file_offset): New method
3626 definitions.
3627
56ee5e00
DK
36282009-10-21 Doug Kwan <dougkwan@google.com>
3629
3630 * arm.cc (Stub_table, Arm_input_section): New forward class
3631 declarations.
3632 (Stub_table): New class defintion.
3633 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
3634 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
3635 New method definition.
3636
b569affa
DK
36372009-10-21 Doug Kwan <dougkwan@google.com>
3638
3639 * arm.cc: Update copyright comments.
3640 (Target_arm): New forward class template declaration.
3641 (Arm_address): New type.
3642 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
3643 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
3644 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
3645 constants.
3646 (Insn_template): Same.
3647 (DEF_STUBS): New macro.
3648 (Stub_type): New enum type.
3649 (Stub_template): New class definition.
3650 (Stub): Same.
3651 (Reloc_stub): Same.
3652 (Stub_factory): Same.
3653 (Target_arm::Target_arm): Initialize may_use_blx_ and
3654 should_force_pic_veneer_.
3655 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
3656 Target_arm::should_force_pic_veneer,
3657 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
3658 Target_arm::using_thumb_only, Target_arm:;default_target): New
3659 method defintions.
3660 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
3661 New data member declarations.
3662 (Insn_template::size, Insn_template::alignment): New method defintions.
3663 (Stub_template::Stub_template): New method definition.
3664 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
3665 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
3666 (Stub_factory::Stub_factory): New method definition.
3667 * gold.h (string_hash): New template.
3668 * output.h (Input_section_specifier::hash_value): Use
3669 gold::string_hash.
3670 (Input_section_specifier::string_hash): Remove.
3671 * stringpool.cc (Stringpool_template::string_hash): Use
3672 gold::string_hash.
3673
6c172549
DK
36742009-10-20 Doug Kwan <dougkwan@google.com>
3675
3676 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
3677 symbols of relaxed input sections.
3678 * output.h (Output_section::find_relaxed_input_section): Make
3679 method public.
3680
c5617f2f
DK
36812009-10-16 Doug Kwan <dougkwan@google.com>
3682
3683 * dynobj.cc (Versions::Versions): Initialize version_script_.
3684 Only insert base version symbol definition for a shared object
3685 if version script defines any version versions.
3686 (Versions::define_base_version): New method definition.
3687 (Versions::add_def): Check that base version is not needed.
3688 (Versions::add_need): Define base version lazily.
3689 * dynobj.h (Versions::define_base_version): New method declaration.
3690 (Versions::needs_base_version_): New data member declaration.
3691 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
3692 (check_DATA): Add no_version_test.stdout.
3693 (libno_version_test.so, no_version_test.o no_version_test.stdout):
3694 New make rules.
3695 * testsuite/Makefile.in: Regenerate.
3696 * testsuite/no_version_test.c: New file.
3697 * testsuite/no_version_test.sh: Ditto.
3698
3c12dcdb
DK
36992009-10-16 Doug Kwan <dougkwan@google.com>
3700
3701 * expression.cc (class Segment_start_expression): New class definition.
3702 (Segment_start_expression::value): New method definition.
3703 (script_exp_function_segment_start): Return a new
3704 Segment_start_expression.
3705 * gold/script-c.h (script_saw_segment_start_expression): New function
3706 prototype.
3707 * script-sections.cc (Script_sections::Script_sections): Initialize
3708 SAW_SEGMENT_START_EXPRESSION_ to false.
3709 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
3710 and -Tbbs options to specify section addresses if given in
3711 command line and no SEGMENT_START expression is seen in a script.
3712 * script-sections.h (Script_sections::saw_segment_start_expression,
3713 Script_sections::set_saw_segment_start_expression): New method
3714 definition.
3715 (Script_sections::saw_segment_start_expression_): New data member
3716 declaration.
3717 * script.cc (script_saw_segment_start_expression): New function.
3718 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
3719 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
3720 script_test_7.sh and script_test_8.sh.
3721 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
3722 script_test_8.stdout.
3723 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
3724 (script_test_6, script_test_6.stdout, script_test_7,
3725 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
3726 * Makefile.in: Regenerate.
3727 * testsuite/script_test_6.sh: New file.
3728 * testsuite/script_test_6.t: Same.
3729 * testsuite/script_test_7.sh: Same.
3730 * testsuite/script_test_7.t: Same.
3731 * testsuite/script_test_8.sh: Same.
3732
64b1ae37
DK
37332009-10-16 Doug Kwan <dougkwan@google.com>
3734
3735 * output.cc (Output_segment::set_section_list_address): Cast
3736 expressions to unsigned long long type to avoid format warnings.
3737
661be1e2
ILT
37382009-10-15 Ian Lance Taylor <iant@google.com>
3739
12edd763 3740 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 3741 dot assignment to script_sections_.
12edd763
ILT
3742 * script-sections.cc (Script_sections::add_dot_assignment):
3743 Initialize if necessary.
3744
68b6574b
ILT
3745 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
3746 program headers with no load segment if there is a linker script.
3747
661be1e2
ILT
3748 * layout.cc (Layout::set_segment_offsets): Align the file offset
3749 to the segment aligment for -N or -n with no load segment.
3750 * output.cc (Output_segment::add_output_section): Don't crash if
3751 the first section is a TLS section.
3752 (Output_segment::set_section_list_addresses): Print an error
3753 message if the address moves backward in a linker script.
3754 * script-sections.cc
3755 (Output_section_element_input::set_section_addresses): Don't
3756 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
3757 (Orphan_output_section::set_section_addresses): Likewise.
3758
f15f61a7
DK
37592009-10-15 Doug Kwan <dougkwan@google.com>
3760
3761 * layout.cc (Layout::finish_dynamic_section): Generate tags
3762 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
3763 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
3764 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
3765
82bb573a
ILT
37662009-10-14 Ian Lance Taylor <iant@google.com>
3767
3768 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
3769 fields.
3770 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
3771 data_shdr fields of relinfo.
3772 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
3773 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
3774 R_386_TLS_LDO_32, adjust based on section flags.
3775 (Target_i386::Relocate::fix_up_ldo): Remove.
3776
374ad285
ILT
37772009-10-13 Ian Lance Taylor <iant@google.com>
3778
3779 Add support for -pie.
3780 * options.h (class General_options): Add -pie and
3781 --pic-executable.
3782 (General_options::output_is_position_independent): Test -pie.
3783 (General_options::output_is_executable): Return true if not shared
3784 and not relocatable.
3785 (General_options::output_is_pie): Remove.
3786 * options.cc (General_options::finalize): Reject incompatible uses
3787 of -pie.
3788 * gold.cc (queue_middle_tasks): A -pie link is not static.
3789 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
3790 * symtab.cc (Symbol::final_value_is_known): Return false if
3791 output_is_position_independent.
3792 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
3793 output_is_position_independent.
3794 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
3795 output_is_position_independent.
3796 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
3797 output_is_position_independent.
3798 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
3799 two_file_pie_test.
3800 (basic_pie_test.o, basic_pie_test): New targets.
3801 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
3802 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
3803 (two_file_pie_test): New target.
3804 * testsuite/Makefile.in: Rebuild.
3805 * README: Remove note saying that -pie is not supported.
3806
c6585162
ILT
38072009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
3808
3809 * options.h (class General_options): Add -init and -fini.
3810 * layout.cc (Layout::finish_dynamic_section): Emit
3811 given init and fini functions.
3812
032ce4e9
ST
38132009-10-13 Sriraman Tallam <tmsriram@google.com>
3814
3815 * gc.h (gc_process_relocs): Check if icf is enabled using new
3816 function.
3817 * gold.cc (queue_initial_tasks): Likewise.
3818 (queue_middle_tasks): Likewise.
3819 * object.cc (do_layout): Likewise.
3820 * symtab.cc (is_section_folded): Likewise.
3821 * main.cc (main): Likewise.
3822 * reloc.cc (Read_relocs::run): Likewise.
3823 (Sized_relobj::do_scan_relocs): Likewise.
3824 * icf.cc (is_function_ctor_or_dtor): New function.
3825 (Icf::find_identical_sections): Check if function is ctor or dtor when
3826 safe icf is chosen.
3827 * options.h (General_options::icf): Change option to be an enum.
3828 (Icf_status): New enum.
3829 (icf_enabled): New method.
3830 (icf_safe_folding): New method.
3831 (set_icf_status): New method.
3832 (icf_status_): New variable.
3833 * (options.cc) (General_options::finalize): Set icf_status_.
3834 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
3835 icf_test and icf_keep_unique_test to use the --icf enum flag.
3836 * testsuite/icf_safe_test.sh: New file.
e1df38aa 3837 * testsuite/icf_safe_test.cc: New file.
032ce4e9 3838
f345227a
ST
38392009-10-12 Sriraman Tallam <tmsriram@google.com>
3840
3841 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
3842 includes to gc.h and icf.h.
3843 * arm.cc: Include gc.h.
3844 * gold.cc: Likewise.
3845 * i386.cc: Likewise.
3846 * powerpc.cc: Likewise.
3847 * sparc.cc: Likewise.
3848 * x86_64.cc: Likewise.
3849 * gc.h: Include icf.h.
3850
1c7814ed
ILT
38512009-10-11 Ian Lance Taylor <iant@google.com>
3852
3853 * plugin.cc: Include "gold.h" before other header files.
3854
ae3b5189
CD
38552009-10-10 Chris Demetriou <cgd@google.com>
3856
3857 * options.h (Input_file_argument::Input_file_type): New enum.
3858 (Input_file_argument::is_lib_): Replace with...
3859 (Input_file_argument::type_): New member.
3860 (Input_file_argument::Input_file_argument): Take Input_file_type
3861 'type' rather than boolean 'is_lib' as second argument.
3862 (Input_file_argument::is_lib): Use type_.
3863 (Input_file_argument::is_searched_file): New function.
3864 (Input_file_argument::may_need_search): Handle is_searched_file.
3865 * options.cc (General_options::parse_library): Support -l:filename.
3866 (General_options::parse_just_symbols): Update for Input_file_argument
3867 changes.
3868 (Command_line::process): Likewise.
3869 * archive.cc (Archive::get_file_and_offset): Likewise.
3870 * plugin.cc (Plugin_manager::release_input_file): Likewise.
3871 * script.cc (read_script_file, script_add_file): Likewise.
3872 * fileread.cc (Input_file::Input_file): Likewise.
3873 (Input_file::will_search_for): Handle is_searched_file.
3874 (Input_file::open): Likewise.
3875 * readsyms.cc (Read_symbols::get_name): Likewise.
3876 * testsuite/Makefile.am (searched_file_test): New test.
3877 * testsuite/Makefile.in: Regenerate.
3878 * testsuite/searched_file_test.cc: New file.
3879 * testsuite/searched_file_test_lib.cc: New file.
3880
f3048a1d
ILT
38812009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3882 Ian Lance Taylor <iant@google.com>
3883
3884 * descriptor.cc: Include <cstdio> and "binary-io.h".
3885 (Descriptors::open): Open the files in binary mode always.
3886 * script.cc (Lex::get_token): Treat \r as whitespace.
3887
d4780e57
ILT
38882009-10-09 Ian Lance Taylor <iant@google.com>
3889
3890 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
3891
d9a893b8
ILT
38922009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3893 Ian Lance Taylor <iant@google.com>
3894
3895 * configure.ac: Check for readv function also.
3896 * fileread.cc (readv): Define if not HAVE_READV.
3897 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
3898 does not exist.
3899 * config.in: Regenerate.
3900 * configure: Regenerate.
3901
c0a62865
DK
39022009-10-09 Doug Kwan <dougkwan@google.com>
3903
3904 * layout.cc (Layout::make_output_section): Call target hook to make
3905 ordinary output section.
3906 (Layout::finalize): Adjust parameter list of call the
3907 Target::may_relax().
3908 * layout.h (class Layout::section_list): New method.
3909 * merge.h (Output_merge_base::entsize): Change visibility to public.
3910 (Output_merge_base::is_string, Output_merge_base::do_is_string):
3911 New methods.
3912 (Output_merge_string::do_is_string): New method.
3913 * object.cc (Sized_relobj::do_setup): renamed from
3914 Sized_relobj::set_up.
3915 * object.h (Sized_relobj::adjust_shndx,
3916 Sized_relobj::initializ_input_to_output_maps,
3917 Sized_relobj::free_input_to_output_maps): Change visibilities to
3918 protected.
3919 (Sized_relobj::setup): Virtualize.
3920 (Sized_relobj::do_setup): New method declaration.
3921 (Sized_relobj::invalidate_section_offset,
3922 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
3923 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
3924 * options.cc (parse_int): New function.
3925 * options.h (parse_int): New declaration.
3926 (DEFINE_int): New macro.
3927 (stub_group_size): New option.
3928 * output.cc (Output_section::Output_section): Initialize memebers
3929 merge_section_map_, merge_section_by_properties_map_,
3930 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
3931 (Output_section::add_input_section): Handled deferred code-fill
3932 generation and remove an old comment.
3933 (Output_section::add_relaxed_input_section): New method definition.
3934 (Output_section::add_merge_input_section): Use merge section by
3935 properties map to speed to search. Update merge section maps
3936 as appropriate.
3937 (Output_section::build_relaxation_map): New method definition.
3938 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3939 Same.
3940 (Output_section::relax_input_section): Renamed to
3941 Output_section::convert_input_sections_to_relaxed_sections and change
3942 interface to take a vector of pointers to relaxed sections.
3943 (Output_section::find_merge_section,
3944 Output_section::find_relaxed_input_section): New method definitions.
3945 (Output_section::is_input_address_mapped,
3946 Output_section::output_offset, Output_section::output_address):
3947 Use output section data maps to speed up searching.
3948 (Output_section::find_starting_output_address): Add comments.
3949 (Output_section::do_write,
3950 Output_section::write_to_postprocessing_buffer): Do code-fill
3951 generation as appropriate.
3952 (Output_section::get_input_sections): Invalidate relaxed input section
3953 map.
3954 (Output_section::restore_states): Adjust type of checkpoint .
3955 Invalidate relaxed input section map.
3956 * output.h (Output_merge_base): New class declaration.
3957 (Input_section_specifier): New class defintion.
3958 (class Output_relaxed_input_section) Change base class to
3959 Output_section_data_build.
3960 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
3961 base class initializer.
3962 (Output_section::add_relaxed_input_section): New method declaration.
3963 (Output_section::Input_section): Change visibility to protected.
3964 (Output_section::Input_section::relobj,
3965 Output_section::Input_section::shndx): Handle relaxed input sections.
3966 Output_section::input_sections) Change visibility to protected. Also
3967 define overload to return a non-const pointer.
3968 (Output_section::Merge_section_properties): New class defintion.
3969 (Output_section::Merge_section_by_properties_map,
3970 Output_section::Output_section_data_by_input_section_map,
3971 Output_section::Relaxation_map): New types.
3972 (Output_section::relax_input_section): Rename method to
3973 Output_section::convert_input_sections_to_relaxed_sections and change
3974 interface to take a vector of relaxed section pointers.
3975 (Output_section::find_merge_section,
3976 Output_section::find_relaxed_input_section,
3977 Output_section::build_relaxation_map,
3978 Output_section::convert_input_sections_in_list_to_relaxed_sections):
3979 New method declarations.
3980 (Output_section::merge_section_map_
3981 Output_section::merge_section_by_properties_map_,
3982 Output_section::relaxed_input_section_map_,
3983 Output_section::is_relaxed_input_section_map_valid_,
3984 Output_section::generate_code_fills_at_write_): New data members.
3985 * script-sections.cc
3986 (Output_section_element_input::set_section_addresses): Call
3987 current_data_size and addralign methods of relaxed input sections.
3988 (Orphan_output_section::set_section_addresses): Call current_data_size
3989 and addralign methods of relaxed input sections.
3990 * symtab.cc (Symbol_table::compute_final_value): Extract template
3991 from the body of Symbol_table::sized_finalize_symbol.
3992 (Symbol_table::sized_finalized_symbol): Call
3993 Symbol_table::compute_final_value.
3994 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
3995 (Symbol_table::compute_final_value): New templated method declaration.
3996 * target.cc (Target::do_make_output_section): New method defintion.
3997 * target.h (Target::make_output_section): New method declaration.
3998 (Target::relax): Add more parameters for input objects, symbol table
3999 and layout. Adjust call to do_relax.
4000 (Target::do_make_output_section): New method declaration.
4001 (Target::do_relax): Add parameters for input objects, symbol table
4002 and layout.
4003
d446d6c4
ILT
40042009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4005
4006 * pread.c: Include stdio.h.
4007
bc06c745
ILT
40082009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4009
4010 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
4011 defined.
4012
75aea3d0
ILT
40132009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4014
4015 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4016 Change read_shndx type to unsigned int.
4017 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4018 int.
4019 (Sized_dwarf_line_info::read_line_mappings): Likewise.
4020 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
4021 Change read_shndx type to unsigned int.
4022 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4023 int.
4024 (Sized_dwarf_line_info::read_line_mappings): Likewise.
4025 * layout.cc (Layout::create_symtab_sections): Cast the result of
4026 local_symcount * symsize to off_t in the gold_assert.
4027
be8fcb75
ILT
40282009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4029
4030 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
4031 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
4032 R_ARM_BASE_ABS.
4033 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
4034 (Arm_relocate_functions::thm_abs5): New function.
4035 (Arm_relocate_functions::abs12): New function.
4036 (Arm_relocate_functions::abs16): New function.
4037 (Arm_relocate_functions::base_abs): New function.
4038 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
4039 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
4040 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
4041 R_ARM_BASE_ABS.
4042 (Scan::global): Likewise.
4043 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
4044 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
4045 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
4046 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
4047 R_ARM_BASE_ABS.
4048
c2a122b6
ILT
40492009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4050
4051 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
4052 (Arm_relocate_functions::movt_prel): New function.
4053 (Arm_relocate_functions::thm_movw_prel_nc): New function.
4054 (Arm_relocate_functions::thm_movt_prel): New function.
4055 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
4056 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
4057 (Scan::global, Relocate::relocate): Likewise.
4058 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4059
c4aa1e2d
ILT
40602009-10-09 Mikolaj Zalewski <mikolajz@google.com>
4061
4062 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
4063 Incremental_checker.
4064 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
4065 unsigned int.
4066 (class Incremental_inputs_header): New class.
4067 (Incremental_inputs_header_writer): Edit comment.
4068 (Incremental_inputs_entry): New class.
4069 (Incremental_inputs_entry_writer): Edit comment.
4070 (Sized_incremental_binary::do_find_incremental_inputs_section):
4071 Add *strtab_shndx parameter, fill it.
4072 (Sized_incremental_binary::do_check_inputs): New method.
4073 (Incremental_checker::can_incrementally_link_output_file): Use
4074 Sized_incremental_binary::check_inputs.
4075 (Incremental_inputs::report_command_line): Save command line in
4076 command_line_.
4077 * incremental.h:
4078 (Incremental_binary::find_incremental_inputs_section): New
4079 method.
4080 (Incremental_binary::do_find_incremental_inputs_section): Add
4081 strtab_shndx parameter.
4082 (Incremental_binary::do_check_inputs): New pure virtual method.
4083 (Sized_incremental_binary::do_check_inputs): Declare.
4084 (Incremental_checker::Incremental_checker): Add incremental_inputs
4085 parameter, use it to initialize incremental_inputs_.
4086 (Incremental_checker::incremental_inputs_): New field.
4087 (Incremental_checker::command_line): New method.
4088 (Incremental_checker::inputs): New method.
4089 (Incremental_checker::command_line_): New field.
4090
c549a694
ILT
40912009-10-09 Mikolaj Zalewski <mikolajz@google.com>
4092
4093 * incremental.cc: Include <cstdarg> and "target-select.h".
4094 (vexplain_no_incremental): New function.
4095 (explain_no_incremental): New function.
4096 (Incremental_binary::error): New method.
4097 (Sized_incremental_binary::do_find_incremental_inputs_section): New
4098 method.
4099 (make_sized_incremental_binary): New function.
4100 (open_incremental_binary): New function.
4101 (can_incrementally_link_file): Add checks if output is ELF and has
4102 inputs section.
4103 * incremental.h: Include "elfcpp_file.h" and "output.h".
4104 (Incremental_binary): New class.
4105 (Sized_incremental_binary): New class.
4106 (open_incremental_binary): Declare.
4107 * object.cc (is_elf_object): Use
4108 elfcpp::Elf_recognizer::is_elf_file.
4109 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
4110 * output.h (Output_file::filesize): New method.
4111
fd3c5f0b
ILT
41122009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4113
4114 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
4115 New function.
4116 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
4117 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
4118 function.
4119 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
4120 function.
4121 (Arm_relocate_functions::movw_abs_nc): New function.
4122 (Arm_relocate_functions::movt_abs): New function.
4123 (Arm_relocate_functions::thm_movw_abs_nc): New function.
4124 (Arm_relocate_functions::thm_movt_abs): New function.
4125 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
4126 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
4127 (Scan::global): Likewise.
4128 (Relocate::relocate): Likewise.
4129 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4130
7f5309a5
ILT
41312009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4132
4133 * arm.cc (Arm_relocate_functions::got_prel) New function.
4134 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
4135 (Relocate::relocate): Likewise.
4136 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4137
364c7fa5
ILT
41382009-10-06 Ian Lance Taylor <iant@google.com>
4139
4140 * options.h (class General_options): Define
4141 split_stack_adjust_size parameter.
4142 * object.h (class Object): Add uses_split_stack_ and
4143 has_no_split_stack_ fields. Add uses_split_stack and
4144 has_no_split_stack accessor functions. Declare
4145 handle_split_stack_section.
4146 (class Reloc_symbol_changes): Define.
4147 (class Sized_relobj): Define Function_offsets. Declare
4148 split_stack_adjust, split_stack_adjust_reltype, and
4149 find_functions.
4150 * object.cc (Object::handle_split_stack_section): New function.
4151 (Sized_relobj::do_layout): Call handle_split_stack_section.
4152 * dynobj.cc (Sized_dynobj::do_layout): Call
4153 handle_split_stack_section.
4154 * reloc.cc (Sized_relobj::relocate_sections): Call
4155 split_stack_adjust for executable sections in split_stack
4156 objects. Pass reloc_map to relocate_section.
4157 (Sized_relobj::split_stack_adjust): New function.
4158 (Sized_relobj::split_stack_adjust_reltype): New function.
4159 (Sized_relobj::find_functions): New function.
4160 * target-reloc.h: Include "object.h".
4161 (relocate_section): Add reloc_symbol_changes parameter. Change
4162 all callers.
4163 * target.h (class Target): Add calls_non_split method. Declare
4164 do_calls_non_split virtual method. Declare match_view and
4165 set_view_to_nop.
4166 * target.cc: Include "elfcpp.h".
4167 (Target::do_calls_non_split): New function.
4168 (Target::match_view): New function.
4169 (Target::set_view_to_nop): New function.
4170 * gold.cc (queue_middle_tasks): Give an error if mixing
4171 split-stack and non-split-stack objects with -r.
4172 * i386.cc (Target_i386::relocate_section): Add
4173 reloc_symbol_changes parameter.
4174 (Target_i386::do_calls_non_split): New function.
4175 * x86_64.cc (Target_x86_64::relocate_section): Add
4176 reloc_symbol_changes parameter.
4177 (Target_x86_64::do_calls_non_split): New function.
4178 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
4179 parameter.
4180 * powerpc.cc (Target_powerpc::relocate_section): Add
4181 reloc_symbol_changes parameter.
4182 * sparc.cc (Target_sparc::relocate_section): Add
4183 reloc_symbol_changes parameter.
4184 * configure.ac: Call AM_CONDITIONAL for the default target.
4185 * configure: Rebuild.
4186 * testsuite/Makefile.am (TEST_AS): New variable.
4187 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
4188 (check_DATA): Add split_i386 and split_x86_64 files.
4189 (SPLIT_DEFSYMS): Define.
4190 (split_i386_[1234n].o): New targets.
4191 (split_i386_[124]): New targets.
4192 (split_i386_[1234r].stdout): New targets.
4193 (split_x86_64_[1234n].o): New targets.
4194 (split_x86_64_[124]): New targets.
4195 (split_x86_64_[1234r].stdout): New targets.
4196 (MOSTLYCLEANFILES): Add new executables.
4197 * testsuite/split_i386.sh: New file.
4198 * testsuite/split_x86_64.sh: New file.
4199 * testsuite/split_i386_1.s: New file.
4200 * testsuite/split_i386_2.s: New file.
4201 * testsuite/split_i386_3.s: New file.
4202 * testsuite/split_i386_4.s: New file.
4203 * testsuite/split_i386_n.s: New file.
4204 * testsuite/split_x86_64_1.s: New file.
4205 * testsuite/split_x86_64_2.s: New file.
4206 * testsuite/split_x86_64_3.s: New file.
4207 * testsuite/split_x86_64_4.s: New file.
4208 * testsuite/split_x86_64_n.s: New file.
4209 * testsuite/testfile.cc (Target_test): Update relocation_section
4210 function.
4211 * testsuite/Makefile.in: Rebuild.
4212
e8a9fcda
ILT
42132009-10-06 Ian Lance Taylor <iant@google.com>
4214
4215 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
4216 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
4217 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
4218 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
4219 the address on ldo_addrs_.
4220 (Target_i386::Relocate::fix_up_ldo): New function.
4221
e99daf92
ILT
42222009-10-06 Rafael Espindola <espindola@google.com>
4223
4224 * plugin.cc (add_input_library): New.
4225 (Plugin::load): Add add_input_library to tv.
4226 (Plugin_manager::add_input_file): Add the is_lib argument.
4227 (add_input_file): Update call to Plugin_manager::add_input_file.
4228 (add_input_library): New.
4229 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
4230
966d4097
DK
42312009-09-30 Doug Kwan <dougkwan@google.com>
4232
4233 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
4234 symbol and call Symbol::may_need_copy_reloc to determine if
4235 a copy reloc is needed.
4236 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
4237 nocopyreloc is given in command line.
4238 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
4239 given in command line.
4240 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
4241 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
4242 of the removed Target_i386::may_need_copy_reloc.
4243 * options.h (copyreloc): New option with default value false.
4244 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4245 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
4246 instead of the removed Target_powerpc::may_need_copy_reloc.
4247 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4248 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
4249 instead of the removed Target_sparc::may_need_copy_reloc.
4250 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
4251 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
4252 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
4253 instead of the removed Target_x86_64::may_need_copy_reloc.
4254
029ba973
ILT
42552009-09-30 Ian Lance Taylor <iant@google.com>
4256
4257 * object.h (class Object): Remove target_ field, and target,
4258 sized_target, and set_target methods.
4259 (Object::sized_target): Remove.
4260 (class Sized_relobj): Update declarations. Remove sized_target.
4261 * object.cc (Sized_relobj::setup): Remove target parameter.
4262 Change all callers.
4263 (Input_objects::add_object): Don't do anything with the target.
4264 (make_elf_sized_object): Add punconfigured parameter. Change all
4265 callers. Set or test parameter target.
4266 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
4267 Change all callers.
4268 * parameters.cc (Parameters::set_target): Change parameter type to
4269 be non-const.
4270 (Parameters::default_target): Remove.
4271 (set_parameters_target): Change parameter type to be non-const.
4272 (parameters_force_valid_target): New function.
4273 (parameters_clear_target): New function.
4274 * parameters.h (class Parameters): Update declarations. Remove
4275 default_target method. Add sized_target and clear_target
4276 methods. Change target_ to be non-const.
4277 (set_parameters_target): Update declaration.
4278 (parameters_force_valid_target): Declare.
4279 (parameters_clear_target): Declare.
4280 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
4281 as NULL if we aren't searching.
4282 (Add_symbols::run): Don't check for compatible target.
4283 * fileread.cc (Input_file::open_binary): Call
4284 parameters_force_valid_target.
4285 * gold.cc (queue_middle_tasks): Likewise.
4286 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
4287 set_target on object.
4288 * dynobj.h (class Sized_dynobj): Update declarations.
4289 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
4290 make_elf_object returns NULL.
4291 (Archive::include_member): Don't check whether object target is
4292 compatible.
4293 * output.cc (Output_section::add_input_section): Get target from
4294 parameters.
4295 (Output_section::relax_input_section): Likewise.
4296 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
4297 parameters.
4298 (Sized_relobj::do_scan_relocs): Likewise.
4299 (Sized_relobj::relocate_sections): Likewise.
4300 * resolve.cc (Symbol_table::resolve): Likewise.
4301 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
4302 parameter. Change all callers.
4303 (Symbol_table::add_from_object): Get target from parameters.
4304 (Symbol_table::add_from_relobj): Don't check object target.
4305 (Symbol_table::add_from_dynobj): Likewise.
4306 (Symbol_table::define_special_symbol): Get target from
4307 parameters.
4308 * symtab.h (class Symbol_table): Update declaration.
4309 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
4310 parameter. Change all callers. Clear parameter target.
4311 (Binary_test): Test target here.
4312 * testsuite/object_unittest.cc (gold_testsuite): Remove
4313 target_test_pointer parameter. Change all callers.
4314 (Object_test): Test target here.
4315
a6a22b83
ILT
43162009-09-26 Ian Lance Taylor <iant@google.com>
4317
4318 * testsuite/initpri1.c: Don't try to use constructor priorities if
4319 compiling with gcc before 4.3.
4320
6a8f49fe
ILT
43212009-09-22 Mikolaj Zalewski <mikolajz@google.com>
4322
4323 * testsuite/retain_symbols_file_test.sh (check_present): Change
4324 output file name to retain_symbols_file_test.stdout.
4325 (check_absent): Likewise.
4326
8c604651
CS
43272009-09-18 Craig Silverstein <csilvers@google.com>
4328
4329 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
4330 * options.cc: Include <cerrno> and <fstream>.
4331 (General_options::finalize): Parse -retain-symbols-file tag.
4332 * options.h: New flag.
4333 (General_options): New method should_retain_symbol, new
4334 variable symbols_to_retain.
4335 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
4336 should_retain_symbol map.
4337 * testsuite/Makefile.am (retain_symbols_file_test): New test.
4338 * testsuite/Makefile.in: Regenerate.
4339 * testsuite/retain_symbols_file_test.sh: New file.
4340
ca58b19f
NC
43412009-09-18 Nick Clifton <nickc@redhat.com>
4342
4343 * po/es.po: Updated Spanish translation.
4344
20e6d0d6
DK
43452009-09-17 Doug Kwan <dougkwan@google.com>
4346
4347 * debug.h (DEBUG_RELAXATION): New constant.
4348 (DEBUG_ALL): Add DEBUG_RELAXATION.
4349 (debug_string_to_enum): Add relaxation debug option.
4350 * layout.cc
4351 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
4352 Layout::Relaxation_debug_check::read_sections,
4353 Layout::Relaxation_debug_check::read_sections): New method definitions.
4354 (Layout::Layout): Initialize data members
4355 record_output_section_data_from_scrips_,
4356 script_output_section_data_list_ and relaxation_debug_check_.
4357 (Layout::save_segments, Layout::restore_segments,
4358 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4359 Layout::relaxation_loop_body): New method definitions.
4360 (Layout::finalize): Support relaxation. Move section layout code to
4361 Layout::relaxation_loop_body.
4362 (Layout::set_asection_address_from_script): Move code for orphan
4363 section placement out.
4364 (Layout::place_orphan_sections_in_script): New method definition.
4365 * layout.h (Output_segment_headers, Output_file_header):
4366 New forward class declarations.
4367 (Layout::~Layout): Define.
4368 (Layout::new_output_section_data_from_script): New method definition.
4369 (Layout::place_orphan_sections_in_script): New method declaration.
4370 (Layout::Segment_states): New type declaration.
4371 (Layout::save_segments, Layout::restore_segments,
4372 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4373 Layout::relaxation_loop_body): New method declarations.
4374 (Layout::Output_section_data_list): New type declaration.
4375 (Layout::Relaxation_debug_check): New class definition.
4376 (Layout::record_output_section_data_from_script_,
4377 Layout::script_output_section_data_list_, Layout::segment_states_,
4378 Layout::relaxation_debug_check_): New data members.
4379 * output.cc: (Output_section_headers::do_size): New method definition.
4380 (Output_section_headers::Output_section_headers): Move size
4381 computation to Output_section_headers::do_size.
4382 (Output_segment_headers::do_size): New method definition.
e1df38aa 4383 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
4384 Output_file_header::do_size and call it.
4385 (Output_file_header::do_size): New method definition.
4386 (Output_data_group::Output_data_group): Adjust call to
4387 Output_section_data.
4388 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
4389 (Output_symtab_xindex::do_write): Add array bound check.
4390 (Output_section::Input_section::print_to_mapfile): Handle
4391 RELAXED_INPUT_SECTION_CODE.
4392 (Output_section::Output_section): Initialize data member checkpoint_.
4393 (Output_section::~Output_section): Delete checkpoint object pointed
4394 by checkpoint_.
4395 (Output_section::add_input_section): Always add an Input_section if
4396 relaxing.
4397 (Output_section::add_merge_input_section): Add assert.
4398 (Output_section::relax_input_section): New method definition.
4399 (Output_section::set_final_data_size): Set load address to zero for
4400 an unallocated section.
4401 (Output_section::do_address_and_file_offset_have_reset_values):
4402 New method definition.
4403 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
4404 Handle relaxed input section.
4405 (Output_section::sort_attached_input_sections): Checkpoint input
4406 section list lazily.
4407 (Output_section::get_input_sections): Change type of input_sections to
4408 list of Simple_input_section pointers. Checkpoint input section list
4409 lazily. Also handle relaxed input sections.
4410 (Output_section::add_input_section_for_script): Take a reference to
4411 a Simple_input_section object instead of Relobj pointer and section
4412 index as parameter. Handle relaxed input sections.
4413 (Output_section::save_states, Output_section::restore_states): New
4414 method definitions.
4415 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
4416 (Output_data::is_data_size_fixed): New method definition.
4417 (Output_data::reset_addresss_and_file_offset): Do not reset data size
4418 if it is fixed.
4419 (Output_data::address_and_file_offset_have_reset_values): New method
4420 definition.
4421 (Output_data::do_address_and_file_offset_have_reset_values): New method
4422 definition.
4423 (Output_data::set_data_size): Check that data size is not fixed.
4424 (Output_data::fix_data_size): New method definition.
4425 (Output_data::is_data_size_fixed_): New data member.
4426 (Output_section_headers::set_final_data_size): New method definition.
4427 (Output_section_headers::do_size): New method declaration.
4428 (Output_segment_headers::set_final_data_size): New method definition.
4429 (Output_segment_headers::do_size): New method declaration.
4430 (Output_file_header::set_final_data_size)::New method definition.
4431 (Output_file_header::do_size)::New method declaration.
4432 (Output_section_data::Output_section_data): Add new parameter
4433 is_data_size_fixed and use it to fix data size.
4434 (Output_data_const::Output_data_const): Adjust call to base class
4435 constructor and fix data size.
4436 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
4437 base class constructor and fix data size.
4438 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
4439 base class constructor and fix data size.
4440 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
4441 class constructor and fix data size.
4442 (Output_data_group::set_final_data_size): New method definition.
4443 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
4444 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
4445 class constructor and fix data size.
4446 (Output_relaxed_input_section): New class definition.
4447 (Output_section::Simple_input_section): New class definition.
4448 (Output_section::get_input_sections): Adjust parameter list.
4449 (Output_section::add_input_section_for_script): Same.
4450 (Output_section::save_states, Output_section::restore_states,
4451 Output_section::do_address_and_file_offset_have_reset_values,
4452 (Output_section::Input_section::Input_section): Handle
4453 RELAXED_INPUT_SECTION_CODE. Add new overload for
4454 Output_relaxed_input_section.
4455 (Output_section::Input_section::is_input_section,
4456 Output_section::Input_section::set_output_section): Handle relaxed
4457 input section.
4458 (Output_section::Input_section::is_relaxed_input_section,
4459 Output_section::Input_section::output_section_data,
4460 Output_section::Input_section::relaxed_input_section): New method
4461 definitions.
4462 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
4463 value.
4464 (Output_section::Input_section::u1_): Update comments.
4465 (Output_section::Input_section::u2_): Add new union member poris.
4466 (Output_section::Checkpoint_output_section): New classs definition.
4467 (Output_section::relax_input_section): New method declaration.
4468 (Output_section::checkpoint_): New data member.
4469 (Output_segment): Update comments.
4470 (Output_segment::Output_segment): Un-privatize copy constructor.
4471 (Output_segment::operator=): Un-privatize.
4472 * script-sections.cc (Output_section_element::Input_section_list):
4473 Change element type to Output_section::Simple_input_section.
4474 (Output_section_element_dot_assignment::set_section_addresses):
4475 Register output section data for relaxation clean up.
4476 (Output_data_exression::Output_data_expression): Adjust call to base
4477 constructor to fix data size.
4478 (Output_section_element_data::set_section_addresses): Register
4479 Output_data_expression object for relaxation clean up.
4480 (struct Input_section_info): Replace Relobj pointer and section index
4481 pair with Output_section::Simple_input_section and Convert struct to a
4482 class.
4483 (Input_section_sorter::operator()): Adjust access to
e1df38aa 4484 Input_section_info data member to use accessors.
20e6d0d6
DK
4485 (Output_section_element_input::set_section_addresses): Use layout
4486 parameter. Adjust code to use Output_section::Simple_input_section
4487 and Input_secction_info classes. Register filler for relaxation
4488 clean up.
4489 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
4490 and section index pair with Output_section::Simple_input_section
4491 class. Adjust code accordingly.
4492 (Phdrs_element::release_segment): New method definition.
4493 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
4494 segment list.
4495 (Script_sections::release_segments): New method definition.
4496 * gold/script-sections.h (Script_sections::release_segments): New
4497 method declaration.
4498 * gold/target.h (Target::may_relax, Target::relax,
4499 Target::do_may_relax, Target::do_relax): New method definitions.
4500
5e445df6
ILT
45012009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4502
4503 * arm.cc (has_signed_unsigned_overflow): New function.
4504 (Arm_relocate_functions::abs8): New function.
4505 (Target_arm::Scan::local): Handle R_ARM_ABS8.
4506 (Target_arm::Scan::global): Likewise.
4507 (Target_arm::relocate::relocate): Likewise.
4508 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4509 Likewise.
4510
8c604651 45112009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
4512
4513 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
4514 * testsuite/Makefile.in: Regenerate.
4515
1e9cc1c2
NC
45162009-09-11 Nick Clifton <nickc@redhat.com>
4517
4518 * po/gold.pot: Updated by the Translation project.
4519
6a89f575
CC
45202009-09-08 Cary Coutant <ccoutant@google.com>
4521
4522 * output.cc (Output_file::open): Add execute permission to empty file.
4523 * testsuite/Makefile.am (permission_test): New test.
4524 * testsuite/Makefile.in: Regenerate.
4525
fdcac5af
ILT
45262009-09-02 Ian Lance Taylor <iant@google.com>
4527
4528 * output.cc (Output_file::resize): Call map_no_anonymous rather
4529 than map.
4530
44453f85
ILT
45312009-09-01 Mikolaj Zalewski <mikolajz@google.com>
4532
4533 * gold.cc: Include "incremental.h".
4534 (queue_initial_tasks): Call Incremental_checker methods.
4535 * incremental.cc: Include "output.h".
4536 (Incremental_checker::can_incrementally_link_output_file): New
4537 method.
4538 * incremental.h (Incremental_checker): New class.
4539
4540 * output.cc (Output_file::open_for_modification): New method.
4541 (Output_file::map_anonymous): Changed return type to bool. Record
4542 map in base_ field.
4543 (Output_file::map_no_anonymous): New method, broken out of map.
4544 (Output_file::map): Use map_no_anonymous and map_anonymous.
4545 * output.h (class Output_file): Update declarations.
4546
293c1386
CC
45472009-08-24 Cary Coutant <ccoutant@google.com>
4548
4549 * options.h (Command_line::Pre_options): New class.
4550 (Command_line::pre_options): New member.
4551 * options.cc (gold::options::ready_to_register): New variable.
4552 (One_option::register_option): Do nothing if not registering options.
4553 Assert if same short option registered twice.
4554 (General_options::General_options): Turn off option registration when
4555 done constructing.
4556 (Command_line::Pre_options::Pre_options): New constructor.
4557
f773f3d2
CC
45582009-08-24 Cary Coutant <ccoutant@google.com>
4559
06a73cfe
CC
4560 * options.h (General_options::no_keep_memory): Remove incorrect
4561 short option.
f773f3d2 4562
a15af8e2
RW
45632009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4564
4565 * Makefile.am (am__skiplex, am__skipyacc): New.
4566 * Makefile.in: Regenerate.
4567
c462b41b
RW
45682009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4569
14ec8efd
RW
4570 * Makefile.am (AM_CPPFLAGS): Renamed from ...
4571 (INCLUDES): ... this.
4572 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
4573 (AM_CPPFLAGS): Renamed from ...
4574 (INCLUDE): ... this.
4575 * Makefile.in, testsuite/Makefile.in: Regenerate.
4576
81ecdfbb
RW
4577 * Makefile.in: Regenerate.
4578 * aclocal.m4: Likewise.
4579 * config.in: Likewise.
4580 * configure: Likewise.
4581 * testsuite/Makefile.in: Likewise.
4582
c462b41b
RW
4583 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4584 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4585 * Makefile.in: Regenerate.
4586 * testsuite/Makefile.in: Regenerate.
4587
2da73f13
CC
45882009-08-19 Cary Coutant <ccoutant@google.com>
4589
4590 * resolve.cc (Symbol_table::resolve): Don't complain about defined
4591 symbols in shared libraries overridden by hidden or internal symbols
4592 in the main program.
4593
2db70501
CD
45942009-08-19 Chris Demetriou <cgd@google.com>
4595
4596 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
4597 checking source file names in error messages.
4598
f733487b
DK
45992009-08-18 Doug Kwan <dougkwan@google.com>
4600
4601 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
4602 an elcpp::Ehdr as parameter. Adjust call to set_target.
4603 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
4604 an elfcpp::Ehdr as parameter.
4605 * object.cc (Object::set_target): Remove the version that looks up
4606 a target and sets it.
4607 (Sized_relobj::setup): Take a Target object instead of
4608 an elfcpp::Ehdr as parameter. Adjust call to set_target.
4609 (make_elf_sized_object): Find target and ask target to
4610 make an ELF object.
4611 * object.h: (Object::set_target): Remove the version that looks up
4612 a target and sets it.
4613 (Sized_relobj::setup): Take a Target object instead of
4614 an elfcpp:Ehdr as parameter.
4615 * target.cc: Include dynobj.h.
4616 (Target::do_make_elf_object_implementation): New.
4617 (Target::do_make_elf_object): New.
4618 * target.h (Target::make_elf_object): New template declaration.
4619 (Target::do_make_elf_object): New method declarations.
4620 (Target::do_make_elf_object_implementation): New template declaration.
4621
cc70f101
ILT
46222009-08-14 Ian Lance Taylor <iant@google.com>
4623
4624 * gold.h (FUNCTION_NAME): Define.
4625 (gold_unreachable): Use FUNCTION_NAME.
4626
ef5e0cb1
ST
46272009-08-12 Sriraman Tallam <tmsriram@google.com>
4628
4629 * icf.cc (Icf::find_identical_sections): Issue a warning when a
4630 symbol in the --keep-unique list is not found.
4631
48c187ce
ST
46322009-08-12 Sriraman Tallam <tmsriram@google.com>
4633
4634 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
4635 been maked as --keep-unique.
4636 (Icf::unfold_section): New function.
4637 * icf.h (Icf::unfold_section): New function.
4638 * options.h (General_options::keep_unique): New option.
4639 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
4640 * testsuite/Makefile.in: Regenerate.
4641 * testsuite/icf_keep_unique_test.sh: New file.
4642 * testsuite/icf_keep_unique_test.cc: New file.
4643
645afe0c
CC
46442009-08-12 Cary Coutant <ccoutant@google.com>
4645
4646 PR 10471
4647 * resolve.cc (Symbol_table::resolve): Check for references from
4648 dynamic objects to hidden and internal symbols.
4649 * testsuite/Makefile.am (hidden_test.sh): New test.
4650 * testsuite/Makefile.in: Regenerate.
4651 * testsuite/hidden_test.sh: New script.
4652 * testsuite/hidden_test_1.c: New test source.
4653 * testsuite/hidden_test_main.c: New test source.
4654
11af873f
DK
46552009-08-11 Doug Kwan <dougkwan@google.com>
4656
4657 * arm.cc: Update comments.
4658 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
4659 segment to locate the .ARM.exidx section if present.
4660
b9f7d72d
DK
46612009-08-09 Doug Kwan <dougkwan@google.com>
4662
4663 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
4664 patch.
4665
ddd3c53c
ST
46662009-08-07 Sriraman Tallam <tmsriram@google.com>
4667 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
4668 compiler warnings.
4669
27721062
ST
46702009-08-06 Sriraman Tallam <tmsriram@google.com>
4671
4672 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
4673 valid tls_segment only for non-debug-section relocations.
4674 * testsuite/Makefile.am: Add gc_tls_test.
4675 * testsuite/Makefile.in: Regenerate.
4676 * testsuite/gc_tls_test.cc: New file.
4677 * testsuite/gc_tls_test.sh: New file.
4678
ef15dade 46792009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 4680
ef15dade
ST
4681 * icf.cc: New file.
4682 * icf.h: New file.
4683 * Makefile.am (CCFILES): Add icf.cc.
4684 (HFILES): Add icf.h
4685 * Makefile.in: Regenerate.
4686 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
4687 * gc.h (gc_process_relocs): Populate lists used by icf to contain
4688 section, symbol and addend information for the relocs.
4689 * gold.cc (queue_middle_tasks): Call identical code folding.
4690 * gold.h: Add defines for multimap.
4691 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
4692 to the call of finalize_local_symbols.
4693 * main.cc (main): Create object of class Icf.
4694 * object.cc (Sized_relobj::do_layout): Allow this function to be
4695 called twice during icf.
4696 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
4697 to sections marked as identical by icf.
4698 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
4699 when available.
4700 (Sized_relobj::do_section_entsize): New function.
4701 * object.h (Object::section_entsize): New function.
4702 (Object::do_section_entsize): New pure virtual function.
4703 (Relobj::finalize_local_symbols): Add new parameter.
4704 (Relobj::do_section_entsize): New function.
4705 * options.h (General_options::icf): New option.
4706 (General_options::icf_iterations): New option.
4707 (General_options::print_icf_sections): New option.
4708 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
4709 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
4710 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
4711 icf.
4712 * symtab.cc (Symbol_table::is_section_folded): New function.
4713 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
4714 to sections marked as identical by icf.
4715 * symtab.h (Symbol_table::set_icf): New function.
4716 (Symbol_table::icf): New function.
4717 (Symbol_table::is_section_folded): New function.
4718 (Symbol_table::icf_): New data member.
4719 * target-reloc.h (relocate_section): Ignore sections folded by icf.
4720 * testsuite/Makefile.am: Add commands to build icf_test.
4721 * testsuite/Makefile.in: Regenerate.
4722 * testsuite/icf_test.sh: New file.
4723 * testsuite/icf_test.cc: New file.
4724
c3b65ac4
CD
47252009-07-24 Chris Demetriou <cgd@google.com>
4726
4727 * layout.cc (is_compressible_debug_section): Fix incorrect
4728 comment about compressed section names.
4729
1caf2c51
ILT
47302009-07-20 Ian Lance Taylor <ian@airs.com>
4731
4732 PR 10419
4733 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
4734
1ef4d87f
ILT
47352009-07-16 Ian Lance Taylor <iant@google.com>
4736
4737 PR 10400
4738 * layout.h: #include <map>.
4739 (class Kept_section): Change from struct to class. Add accessors
4740 and setters. Add section size to Comdat_group mapping. Change
4741 Comdat_group to std::map. Add is_comdat_ field. Add
4742 linkonce_size field in union.
4743 (class Layout): Update declaration of find_or_add_kept_section.
4744 Don't declare find_kept_object.
4745 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
4746 parameter. Add object, shndx, is_comdat, and is_group_name
4747 parameters. Change all callers. Adjust for new Kept_section.
4748 (Layout::find_kept_object): Remove.
4749 * object.cc (Sized_relobj::include_section_group): Update use of
4750 Kept_section. Rename secnum to shndx. Only record
4751 Kept_comdat_section if sections are the same size.
4752 (Sized_relobj::include_linkonce_section): Update use of
4753 Kept_section. Only record Kept_comdat_section if sections are the
4754 same size. Set size of linkonce section.
4755 (Sized_relobj::map_to_kept_section): Update call to
4756 get_kept_comdat_section.
4757 * object.h (class Sized_relobj): Rename fields in
4758 Kept_comdat_section to drop trailing underscores; change object
4759 field to Relobj*. Change Kept_comdat_section_table to store
4760 struct rather than pointer.
4761 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
4762 Add kept_object and kept_shndx parameters. Change all callers.
4763 (Sized_relobj::get_kept_comdat_section): Change return type to
4764 bool. Add kept_object and kept_shndx parameters. Change all
4765 callers.
4766 * plugin.cc (Pluginobj::include_comdat_group): Update call to
4767 Layout::find_or_add_kept_section.
4768
37c3b7b0
ILT
47692009-07-09 Ian Lance Taylor <iant@google.com>
4770
4771 * merge.cc (Object_merge_map::initialize_input_to_output_map):
4772 Reserve space in the hash table.
4773
98fa85cb
ILT
47742009-07-06 Mikolaj Zalewski <mikolajz@google.com>
4775
4776 * fileread.cc (File_read::get_mtime): New method.
4777 * fileread.h (Timespec): New structure.
4778 (File_read::get_mtime): New method.
4779 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
4780 Renamed from timestamp_nsec.
4781 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
4782 Elf_Xword.
e1df38aa 4783 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 4784 timestamp_nsec.
e1df38aa 4785 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
4786 (Incremental_inputs::report_obejct): Save mtime; style fix.
4787 (Incremental_inputs::report_script): Save mtime; style fix.
4788 (Incremental_inputs::finalize_inputs): Style fix.
4789 (Incremental_inputs::finalize): Style fix.
4790 (Incremental_inputs::create_input_section_data): Store inputs
4791 mtime.
4792 * incremental.h (Incremental_inputs::report_script): Add mtime
4793 argument.
4794 (Incremental_inputs::Input_info::Input_info): Intialize only one
4795 union member.
4796 (Incremental_inputs::Input_info::archive): Move to nameless
4797 union.
4798 (Incremental_inputs::Input_info::obejct): Move to nameless union.
4799 (Incremental_inputs::Input_info::script): Move to nameless union.
4800 (Incremental_inputs::mtime): New field.
4801 * script.cc (read_input_script): Pass file mtime to
4802 Incremental_input.
4803 * script.h (Script_info::inputs): Style fix.
4804
c9d70757
ILT
48052009-07-01 Ian Lance Taylor <ian@airs.com>
4806
4807 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
4808 instead of 32.
4809
9c547ec3
ILT
48102009-06-24 Ian Lance Taylor <iant@google.com>
4811
4812 PR 10156
4813 * layout.cc (Layout::choose_output_section): If we find an
4814 existing section, update the flags.
4815 (Layout::create_notes): New function, broken out of
4816 Layout::finalize.
4817 (Layout::finalize): Don't create note sections.
4818 (Layout::create_note): Don't crash if linker script discards
4819 section.
4820 (Layout::create_gold_note): Likewise.
4821 (Layout::create_build_id): Likewise. Don't set
4822 after_input_sections on the section.
4823 (Layout::create_executable_stack_info): Remove target parameter.
4824 Change caller.
4825 * layout.h (class Layout): Declare create_notes. Update
4826 declaration of create_executable_stack_info.
4827 * gold.cc (queue_middle_tasks): Call create_notes.
4828 * output.cc (Output_section::update_flags_for_input_section): Move
4829 here from output.h. If SHF_ALLOC flag is newly set, mark address
4830 invalid.
4831 * output.h (Output_data::mark_address_invalid): New function.
4832 (class Output_section): Only declare, not define,
4833 update_flags_for_input_section. Remove set_flags.
4834
55458500
ILT
48352009-06-24 Ian Lance Taylor <iant@google.com>
4836
4837 * script-sections.cc (Output_section_definition::
4838 set_section_addresses): Rename shadowing local load_address to
4839 laddr.
4840
1307d6cd
ILT
48412009-06-24 Ian Lance Taylor <iant@google.com>
4842
4843 PR 10244
4844 * reloc.cc (relocate_sections): Skip empty relocation sections.
4845
ec3f783e
ILT
48462009-06-23 Ian Lance Taylor <iant@google.com>
4847
4848 PR 10156
4849 * layout.cc (Layout::create_note): Use choose_output_section
4850 rather than make_output_section.
4851
459c9f1c
ILT
48522009-06-23 Ian Lance Taylor <iant@google.com>
4853
4854 PR 10237
4855 * options.cc (General_options::parse_V): Set printed_version_.
4856 (General_options::General_options): Initialize printed_version_.
4857 * options.h (class General_options): Add printed_version_ field.
4858 * gold.cc (queue_initial_tasks): If there are no input files,
4859 don't give a fatal error if we printed the version information.
4860 (queue_middle_tasks): If using -r with a shared object, give a
4861 fatal error rather than an ordinary error.
4862
1518dc8f
ILT
48632009-06-23 Ian Lance Taylor <iant@google.com>
4864
4865 PR 10219
4866 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
4867 (Layout::make_output_section): Set have_stabstr_section_ if we see
4868 a .stab*str section.
4869 (Layout::finalize): Call link_stabs_sections.
4870 (Layout::link_stabs_sections): New file.
4871 * layout.h (class Layout): Add have_stabstr_section_ field.
4872 Declare link_stabs_sections.
4873
3d857b98
DK
48742009-06-23 Doug Kwan <dougkwan@google.com>
4875
4876 * Makefile.am (libgold_a_LIBADD): New.
4877 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
4878 * Makefile.in: Regenerate.
4879 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
4880 * configure: Regenerate.
4881 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
4882 * fileread.cc: Include sys/state.h
4883 * gold.h: Declare memmem and strndup if found missing.
4884 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
4885
0639a6f6
ILT
48862009-06-23 Ian Lance Taylor <iant@google.com>
4887
4888 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
4889 * configure: Rebuild.
4890
8d63875c
ILT
48912009-06-23 Ian Lance Taylor <iant@google.com>
4892
4893 PR 10147
4894 * object.cc (Object::section_contents): Don't try to get a view if
4895 the section has length zero.
4896 (Object::handle_gnu_warning_section): If the section is empty, use
4897 the name of the section as the warning.
4898
f7c8a183
ILT
48992009-06-23 Ian Lance Taylor <iant@google.com>
4900
4901 PR 10133
4902 * stringpool.h (class Stringpool_template): Add optimize_ field.
4903 (Stringpool_template::set_optimize): New function.
4904 * stringpool.cc (Stringpool_template::Stringpool_template):
4905 Initialize optimize_ field.
4906 (Stringpool_template::set_string_offsets): Test local optimize
4907 fild rather than parameter.
4908 * layout.cc (Layout::Layout): Call set_optimize on the section
4909 name stringpool.
4910
e6a307ba
ILT
49112009-06-22 Ian Lance Taylor <iant@google.com>
4912
4913 PR 10030
4914 * yyscript.y: Parse TARGET.
4915 * script.cc (script_set_target): New function.
4916 * script-c.h (script_set_target): Declare.
4917 * options.cc (General_options::string_to_object_format): Rename
4918 from string_to_object_format in anonymous namespace. Change
4919 callers.
4920 * options.h (class General_options): Declare
4921 string_to_object_format.
4922
3ee173de
ILT
49232009-06-22 Ian Lance Taylor <iant@google.com>
4924
4925 * script-sections.cc (Script_sections::create_segments): Don't put
4926 program headers in a PT_LOAD segment if -n or -N.
4927
49282009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
4929
4930 PR 10141
4931 * options.h (class General_options): Add -z lazy and -z now. Sort
4932 -z options into alphabetical order.
4933 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
4934
cd6739a1 49352009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
4936
4937 * layout.cc (Layout::make_output_section): Call
4938 Target::new_output_section.
4939 (Layout::attach_allocated_section_to_segment): Put large section
4940 sections in a separate load segment with the large segment flag
4941 set.
4942 (Layout::segment_precedes): Sort large data segments after other
4943 load segments.
4944 (align_file_offset): New static function.
4945 (Layout::set_segment_offsets): Use align_file_offset.
4946 * output.h (class Output_section): Add is_small_section_ and
4947 is_large_section_ fields.
4948 (Output_section::is_small_section): New function.
4949 (Output_section::set_is_small_section): New function.
4950 (Output_section::is_large_section): New function.
4951 (Output_section::set_is_large_section): New function.
4952 (Output_section::is_large_data_section): New function.
4953 (class Output_segment): Add is_large_data_segment_ field.
4954 (Output_segment::is_large_data_segment): New function.
4955 (Output_segment::set_is_large_data_segment): New function.
4956 * output.cc (Output_section::Output_section): Initialize new
4957 fields.
4958 (Output_segment::Output_segment): Likewise.
4959 (Output_segment::add_output_section): Add assertion that large
4960 data sections always go in large data segments. Force small data
4961 sections to the end of the list of data sections. Force small BSS
4962 sections to the start of the list of BSS sections. For large BSS
4963 sections to the end of the list of BSS sections.
4964 * symtab.h (class Symbol): Declare is_common_shndx.
4965 (Symbol::is_defined): Check Symbol::is_common_shndx.
4966 (Symbol::is_common): Likewise.
4967 (class Symbol_table): Define enum Commons_section_type. Update
4968 declarations. Add small_commons_ and large_commons_ fields.
4969 * symtab.cc (Symbol::is_common_shndx): New function.
4970 (Symbol_table::Symbol_table): Initialize new fields.
4971 (Symbol_table::add_from_object): Put small and large common
4972 symbols in the right list.
4973 (Symbol_table::sized_finalized_symbol): Check
4974 Symbol::is_common_shndx.
4975 (Symbol_table::sized_write_globals): Likewise.
4976 * common.cc (Symbol_table::do_allocate_commons): Allocate new
4977 common symbol lists. Don't call do_allocate_commons_list if the
4978 list is empty.
4979 (Symbol_table::do_allocate_commons_list): Remove is_tls
4980 parameter. Add comons_section_type parameter. Change all
4981 callers. Handle small and large common symbols.
4982 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
4983 Symbol::is_common_shndx.
4984 * resolve.cc (symbol_to_bits): Likewise.
4985 * target.h (Target::small_common_shndx): New function.
4986 (Target::small_common_section_flags): New function.
4987 (Target::large_common_shndx): New function.
4988 (Target::large_common_section_flags): New function.
4989 (Target::new_output_section): New function.
4990 (Target::Target_info): Add small_common_shndx, large_common_shndx,
4991 small_common_section_flags, and large_common_section_flags
4992 fields.
4993 (Target::do_new_output_section): New virtual function.
4994 * arm.cc (Target_arm::arm_info): Initialize new fields.
4995 * i386.cc (Target_i386::i386_info): Likewise.
4996 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4997 Likewise.
4998 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
4999 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5000 (Target_x86_64::do_new_output_section): New function.
5001 * configure.ac: Define conditional MCMODEL_MEDIUM.
5002 * testsuite/Makefile.am (check_PROGRAMS): Add large.
5003 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
5004 (large_LDFLAGS): Define.
5005 * testsuite/large.c: New file.
5006 * testsuite/testfile.cc (Target_test::test_target_info):
5007 Initialize new fields.
5008 * configure, testsuite/Makefile.in: Rebuild.
5009
bb04269c
DK
50102009-06-05 Doug Kwan <dougkwan@google.com>
5011
5012 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 5013 * Makefile.in: Regenerate.
bb04269c
DK
5014 * i386.cc (class Target_i386): Define new virtual method to
5015 override do_is_local_label_name in parent.
5016 * object.cc (Sized_relobj::do_count_local_symbols): Discard
5017 local symbols if --discard-locals or -X is given.
5018 * options.h (class General_options): Declare new options
5019 '--discard-locals' and '-X' for discarding locals.
5020 * target.h (class Target): Define new methods is_local_label_name.
5021 Declare new virtual method do_is_local_label_name.
5022 * target.cc: New file.
5023 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
5024 (check_SCRIPTS): Add discard_locals_test.sh.
5025 (check_DATA): Add discard_local_tests.syms.
5026 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
5027 (discard_local_tests.syms, discard_locals_test.o): New make rules.
5028 * testsuite/Makefile.in: Regenerate.
5029 * testsuite/discard_locals_test.c: New file.
5030 * testsuite/discard_locals_test.sh: Same.
5031
805bb01c
DK
50322009-06-05 Doug Kwan <dougkwan@google.com>
5033
5034 * object.cc (Sized_relobj::Sized_relobj): Initialize
5035 discarded_eh_frame_shndx_ to -1U.
5036 (Sized_relobj::do_layout): Record index of a discard .eh_frame
5037 section.
5038 (Sized_relobj::do_count_local_symbols): Skip local symbols in
5039 a discarded .eh_frame section.
5040 (Sized_relobj::do_finalize_local_symbols): Ditto.
5041 * object.h (class Sized_relobj): Declare new member
5042 discarded_eh_frame_shndx_.
5043 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
5044 (local_labels_test.o, local_labels_test): New rules.
5045 * testsuite/Makefile.in: Regenerate.
5046
1dcd334d
DK
50472009-06-04 Doug Kwan <dougkwan@google.com>
5048
5049 * layout.cc (Layout::section_name_mapping): Add mapping for
5050 special ARM sections.
5051
96d49306
DK
50522009-06-03 Doug Kwan <dougkwan@google.com>
5053
5054 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
5055 (utils::has_overflow): Same.
5056
dff16297
ILT
50572009-06-03 Ian Lance Taylor <iant@google.com>
5058
5059 * layout.cc (Layout::section_name_mapping): New array, replacing
5060 Layout::linkonce_mapping.
5061 (Layout::section_name_mapping_count): New variable, replacing
5062 Layout::linkonce_mapping_count.
5063 (Layout::linkonce_output_name): Remove.
5064 (Layout::output_section_name): Rewrite.
5065 * layout.h (class Layout): Rename Linkonce_mapping to
5066 Section_name_mapping, linkonce_mapping to section_name_mapping,
5067 linkonce_mapping_count to section_name_mapping_count. Don't
5068 declare linkonce_output_name.
5069
c121c671
DK
50702009-06-03 Doug Kwan <dougkwan@google.com>
5071
5072 * gold/arm.cc (namespace utils): New.
5073 (Target_arm::reloc_is_non_pic): Define new method.
5074 (class Arm_relocate_functions): New.
5075 (Target_arm::Relocate::relocate): Handle relocation types used by
5076 Android.
5077
07800fab
ILT
50782009-06-03 Ian Lance Taylor <iant@google.com>
5079
5080 * arm.cc (Target_arm::scan::global): Use || instead of |.
5081
c121c671
DK
50822009-06-02 Doug Kwan <dougkwan@google.com>
5083
5084 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
5085 issued_non_pic_error_.
5086 (class Target_arm::Scan): Declare new method check_non_pic.
5087 Define new method symbol_needs_plt_entry.
5088 Declare new data member issued_non_pic_error_.
5089 (class Target_arm::Relocate): Declare new method
5090 should_apply_static_reloc.
5091 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
5092 (Target_arm::Scan::check_non_pic): Define new method.
5093 (Target_arm::Scan::local): Handle a small subset of reloc types used
5094 by Android.
5095 (Target_arm::Scan::local): Same.
5096 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
5097
b19b0c6d
ILT
50982009-05-31 Mikolaj Zalewski <mikolajz@google.com>
5099
5100 * incremental.cc (Incremental_inputs::report_command_line): Filter
5101 out --incremental-* options.
5102
94cdfcff
DK
51032009-05-29 Doug Kwan <dougkwan@google.com>
5104
5105 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
5106 template class.
5107 (class Target_arm): Update comment.
5108 (Target_arm::Target_arm): Initialize new data members GOT_,
5109 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
5110 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
5111 and Target_arm::rel_dyn_section.
5112 Declare new_enum Target_arm::Got_type.
5113 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
5114 and DYNBSS_.
5115 Update commments for member do_dynsym_value.
5116 (Target_arm::got_size, Target_arm::plt_section,
5117 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
5118 new methods inside class defintion.
5119 (Target_arm::got_section): Define new method.
5120 (Target_arm::rel_dyn_section): Same.
5121 (Output_data_plt_arm): New template class.
5122 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
5123 (Output_data_plt_arm:do_adjust_output_section): Define new method.
5124 (Output_data_plt_arm::add_entry): Same.
5125 (Output_data_plt_arm::first_plt_entry): Define new
5126 static data member for PLT instruction template.
5127 (Output_data_plt_arm::plt_entry): Same.
5128 (Output_data_plt_arm::do_write): Define new method.
5129 (Target_arm::make_plt_entry): Same.
5130 (Target_arm::do_finalize_sections): Same.
5131 (Target_arm::do_dynsym_value): Same.
5132
4a657b0d
DK
51332009-05-28 Doug Kwan <dougkwan@google.com>
5134
5135 * Makefile.am (TARGETSOURCES): Add arm.cc.
5136 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
5137 * Makefile.in: Regenerate.
5138 * arm.cc: New file.
5139 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
5140
e7ae8c36
DK
51412009-05-26 Doug Kwan <dougkwan@google.com>
5142
5143 * options.cc (General_options::parse_exclude_libs). Fix a comment.
5144 (General_options::check_excluded_libs): Strip off directories in
5145 archive name before matching like GNU ld does.
5146 * testsuite/Makefile.am (MOSTLYCLEANFILES,
5147 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
5148 (exclude_libs_test_LDFLAGS): Add linker option
5149 -Wl,--exclude-libs,libexclude_libs_test_3
5150 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
5151 an explicit archive without using -l.
5152 (alt/libexclude_libs_test_3.a): New make rule.
5153 * testsuite/Makefile.in: Regenerate.
5154 * testsuite/exclude_libs_test.c : Declare lib3_default().
5155 (main): Call it.
5156 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
5157 * exclude_libs_test_3.c: New file.
5158
f12e7348
NC
51592009-05-26 Nick Clifton <nickc@redhat.com>
5160
5161 * po/id.po: New Indonesian translation.
5162 * po/gold.pot: Updated template file.
5163
4daadc0d
ST
51642009-05-22 Sriraman Tallam <tmsriram@google.com>
5165
e1df38aa 5166 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
5167 gc_comdat_test files. Add -Wl,--gc-sections to build
5168 gc_comdat_test.
5169 * testsuite/Makefile.in: Regenerate.
5170 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
5171
531813ad
ST
51722009-05-21 Sriraman Tallam <tmsriram@google.com>
5173
5174 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
5175 kept comdat section was garbage collected.
5176 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
5177 * testsuite/Makefile.in: Regenerate.
5178 * testsuite/gc_comdat_test.sh: New file.
5179 * testsuite/gc_comdat_test_1.cc: New file.
5180 * testsuite/gc_comdat_test_2.cc: New file.
5181
65514900
CC
51822009-05-19 Doug Kwan <dougkwan@google.com>
5183
5184 * archive.cc (Archive::Archive): Move constructor from archive.h
5185 to here. Initialize no_export_.
5186 (Archive::get_elf_object_for_member): Set no_export flag of object.
5187 * archive.h (Archive::Archive): Move constructor body to
5188 archive.cc.
5189 (Archive::no_export): New method.
5190 (Archive::no_export_): New field.
5191 * object.h (Object::Object): Initialize no_export_ to false.
5192 (Object::no_export, Object::set_no_export): New methods.
5193 (Object::no_export_): New field.
5194 * options.cc (General_options::parse_exclude_libs): New method.
5195 (General_options::check_excluded_libs) Same.
5196 * options.h (exclude_libs): New option.
5197 (General_options::check_excluded_libs): New method declaration.
5198 (General_options::excluded_libs_): New field.
5199 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
5200 default or protected visibility if an object has no-export flag set.
5201 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
5202 (check_SCRIPTS): Add exclude_libs_test.sh.
5203 (check_DATA): Add exclude_libs_test.syms.
5204 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
5205 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
5206 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
5207 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
5208 (exclude_libs_test.syms, libexclude_libs_test_1.a,
5209 libexclude_libs_test_2.a): New rules.
5210 * testsuite/Makefile.in: Regenerate.
5211 * testsuite/exclude_libs_test.c: New file.
5212 * testsuite/exclude_libs_test.sh: Ditto.
5213 * testsuite/exclude_libs_test_1.c: Ditto.
5214 * testsuite/exclude_libs_test_2.c: Ditto.
5215
1b77ea50
ILT
52162009-05-15 Ian Lance Taylor <iant@google.com>
5217
5218 * configure.ac: Check for declarations for cases where libiberty.h
5219 checks HAVE_DECL_xxx.
5220 * configure, config.in: Rebuild.
5221
072fe7ce
ILT
52222009-05-15 Mikolaj Zalewski <mikolajz@google.com>
5223
5224 * gold.h (Incremental_argument_list): Remove (invalid) forward
5225 declaration.
5226 * incremental.cc (Incremental_inputs::report_achive): New method.
5227 (Incremental_inputs::report_object): New method.
5228 (Incremental_inputs::report_script): New method.
5229 (Incremental_inputs::finalize_inputs): New method.
5230 (Incremental_inputs::finalize): Call finalize_inputs().
5231 (Incremental_inputs::sized_create_incremental_inputs_section_data):
5232 Create inputs entries.
5233 * incremental.h (Incremental_input_type): New enum.
5234 (Incremental_inputs::Incremental_input): Initialize new fields.
5235 (Incremental_inputs::report_inputs): New method.
5236 (Incremental_inputs::report_achive): New method.
5237 (Incremental_inputs::report_object): New method.
5238 (Incremental_inputs::report_script): New method.
5239 (Incremental_inputs::finalize_inputs): New method.
5240 (Incremental_inputs::Input_info): New struct.
5241 (Incremental_inputs::Input_info_map): New typedef.
5242 (Incremental_inputs::lock_): New field.
5243 (Incremental_inputs::Inputs_): New field.
5244 (Incremental_inputs::Inputs_map): New field.
5245 * main.cc (main): Call Incremental_input::report_inputs.
5246 * options.h (Input_argument_list): Typedef moved from
5247 Input_arguments.
5248 (Input_file_group::Files): Remove, use ::Input_argument_list.
5249 (Input_file_group::Input_argument_list): Remove, use
5250 ::Input_argument_list.
5251 * plugin.cc (Plugin_manager::add_input_file): Add error in
5252 incremental build.
5253 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
5254 functions.
5255 * script.cc (read_input_script): Call
5256 Incremental_input::report_script.
5257 * script.h (Script_info): New class.
5258
b0481b0b
ILT
52592009-04-27 Ian Lance Taylor <iant@google.com>
5260
5261 * x86_64.cc (do_adjust_output_section): Set entsize to
5262 plt_entry_size.
5263
b22a5a41 52642009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
5265
5266 * output.cc (Output_file::close): After short writes, continue
5267 writing from the correct offset in the buffer being written.
5268
40fde488
CD
52692009-04-23 Chris Demetriou <cgd@google.com>
5270
5271 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
5272 * configure: Regenerate.
5273 * config.in: Regenerate.
5274 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
5275 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
5276
3ce2c28e
ILT
52772009-04-21 Mikolaj Zalewski <mikolajz@google.com>
5278
5279 * incremental.cc (Incremental_inputs_header_data): Renamed from
5280 Incremental_input_header_data.
5281 (Incremental_inputs_header_data::data_size): New field.
5282 (Incremental_inputs_header_data::put_input_file_count): Renamed
5283 from input_file_count.
5284 (Incremental_inputs_header_data::put_command_line_offset): Renamed
5285 from command_line_offset.
5286 (Incremental_inputs_header_data::put_reserved): Renamed from
5287 put_reserved.
5288 (Incremental_inputs_entry_data): Renamed from
5289 Incremental_input_entry_data.
5290 (Incremental_inputs_entry_data::data_size): New field.
5291 (Incremental_inputs::report_command_line): New method.
5292 (Incremental_inputs::finalize): New method.
5293 (Incremental_inputs::create_incremental_inputs_data): New method.
5294 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
5295 * incremental.h: New file.
5296 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
5297 (Layout::finalize): Create incremental inputs section in
5298 incremental builds.
5299 (Layout::create_incremental_info_sections): New method.
5300 * layout.h (Layout::incremental_inputs): New method.
5301 (Layout::create_incremental_info_sections): New method.
5302 (Layout::incremental_inputs_): New field.
5303 * main.cc (main): Notify Incremental_input of the command line.
5304
e55bde5e
ILT
53052009-04-01 Ian Lance Taylor <iant@google.com>
5306 Mikolaj Zalewski <mikolajz@google.com>
5307
5308 * gold.h (reserve_unordered_map): Define, three versions, one for
5309 each version of Unordered_map.
5310 * layout.cc (Layout::Layout): Remove options parameter. Add
5311 number_of_input_files parameter. Don't initialize options_.
5312 Initialize number_of_input_files_ and resized_signatures_. Move
5313 sections_are_attached_.
5314 (Layout::layout_group): Reserve space for group_signatures_.
5315 (Layout::find_or_add_kept_section): Change name parameter to be a
5316 reference. Resize signatures_ map when it gets large enough.
5317 (Layout::layout_eh_frame): Use parameters->options() instead of
5318 this->options_.
5319 (Layout::make_output_section): Likewise.
5320 (Layout::attach_allocated_section_to_segment): Likewise.
5321 (Layout::finalize, Layout::create_executable_stack): Likewise.
5322 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
5323 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
5324 * layout.h (class Layout): Update declarations. Remove options_
5325 field. Add number_of_input_files_ and resized_signatures_
5326 fields. Move sections_are_attached_ field.
5327 * main.cc (main): Pass number of input files to Layout
5328 constructor. Don't pass options.
5329
154b857c
ILT
53302009-03-30 Ian Lance Taylor <iant@google.com>
5331
5332 * ffsll.c (ffsll): Correct implementation.
5333
2f35ab9b
ILT
53342009-03-27 Ian Lance Taylor <iant@google.com>
5335
fd03461a
ILT
5336 * ffsll.c: New file.
5337 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
5338 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
5339 * ftruncate.c (ftruncate): Declare before definition.
5340 * mremap.c (mremap): Likewise.
5341 * pread.c (pread): Likewise.
5342 * configure, Makefile.in, config.in: Rebuild.
5343
2f35ab9b
ILT
5344 * mremap.c: New file.
5345 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
5346 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
5347 (mremap): Declare if HAVE_MREMAP is not defined.
5348 * configure, Makefile.in, config.in: Rebuild.
5349
33aea2fd
CC
53502009-03-27 Cary Coutant <ccoutant@google.com>
5351
5352 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
5353 position independent.
5354 * sparc.cc (Target_sparc::check_non_pic): Likewise.
5355 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
5356
6d479619
CC
53572009-03-24 Cary Coutant <ccoutant@google.com>
5358
5359 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
5360 an executable.
5361 (needs_dynamic_reloc): Likewise.
5362
afc06bb8
ILT
53632009-03-24 Ian Lance Taylor <iant@google.com>
5364
5365 * yyscript.y (file_cmd): Recognize EXTERN.
5366 (extern_name_list, extern_name_list_body): New nonterminals.
5367 * script.cc (script_add_extern): Define.
5368 * script-c.h (script_add_extern): Declare.
5369
f6060a4d
ILT
53702009-03-24 Rafael Avila de Espindola <espindola@google.com>
5371
5372 * object.cc (is_elf_object): Define.
5373 * object.h (is_elf_object): Declare.
5374 * archive.cc (Archive::get_elf_object_for_member): Call
5375 is_elf_object.
33aea2fd 5376 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 5377
26736d8e
ILT
53782009-03-24 Elliott Hughes <enh@google.com>
5379
5380 * output.cc (Output_file::map_anonymous): Define.
5381 (Output_file::map): Use map_anonymous. If the regular mmap fails,
5382 try an anonymous one. Report the size if the mmap fails.
5383 * output.h (class Output_file): Declare map_anonymous.
5384
22fd9730
ILT
53852009-03-24 Ian Lance Taylor <iant@google.com>
5386
5387 * target-select.cc (instantiate_target): Don't acquire the lock if
5388 the instantiated_target_ field has already been set.
5389
cb010894
ILT
53902009-03-23 Ian Lance Taylor <iant@google.com>
5391
7f055c20
ILT
5392 * gold-threads.h (class Initialize_lock): Define.
5393 * gold-threads.cc (class Initialize_lock_once): Define.
5394 (initialize_lock_control): New static variable.
5395 (initialize_lock_pointer): New static variable.
5396 (initialize_lock_once): New static function.
5397 (Initialize_lock::Initialize_lock): Define.
5398 (Initialize_lock::initialize): Define.
5399 * target-select.h: Include "gold-threads.h".
5400 (class Target_selector): Add lock_ and initialize_lock_ fields.
5401 Don't define instantiate_target, just declare it.
5402 * target-select.cc (Target_selector::Target_selector): Initialize
5403 new fields.
5404 (Target_selector::instantiate_target): Define.
5405 * descriptors.h: Include "gold-threads.h".
5406 (class Descriptors): Add initialize_lock_ field.
5407 * descriptors.cc (Descriptors::Descriptors): Initialize new
5408 field.
5409 (Descriptors::open): Use initialize_lock_ field
5410 * errors.h (class Errors): Add initialize_lock_ field.
5411 * errors.cc (Errors::Errors): Initialize new field.
5412 (Errors::initialize_lock): Use initialize_lock_ field.
5413 * powerpc.cc (class Target_selector_powerpc): Remove
5414 instantiated_target_ field. In do_recognize call
5415 instantiate_target rather than do_instantiate_target. In
5416 do_instantiate_target just allocate a new target.
5417 * sparc.cc (class Target_selector_sparc): Likewise.
5418
36959681
ILT
5419 * freebsd.h: New file.
5420 * i386.cc: Include "freebsd.h".
5421 (Target_i386): Derive from Target_freebsd rather than
5422 Sized_target.
5423 (Target_selector_i386): Derive from Target_selector_freebsd rather
5424 than Target_selector.
5425 * x86_64.cc: Include "freebsd.h".
5426 (Target_x86_64): Derive from Target_freebsd rather than
5427 Sized_target.
5428 (Target_selector_x86_64): Derive from Target_selector_freebsd
5429 rather than Target_selector.
5430 * target.h (class Target): Add adjust_elf_header and
5431 do_adjust_elf_header.
5432 * output.cc (Output_file_header:: do_sized_write): Call target
5433 adjust_elf_header routine.
5434 * configure.tgt: Set targ_osabi.
5435 * configure.ac: Define GOLD_DEFAULT_OSABI.
5436 * parameters.cc (Parameters::default_target): Pass
5437 GOLD_DEFAULT_OSABI to select_target.
5438 * target-select.h (class Target_selector): Make instantiate_target
5439 protected rather than private.
5440 * Makefile.am (HFILES): Add freebsd.h.
5441 * configure, Makefile.in, config.in: Rebuild.
5442
cb010894
ILT
5443 * merge.cc (do_add_input_section): Correct pend value. Change
5444 message about last entry not being null terminated from error to
5445 warning.
5446
0e879927
ILT
54472009-03-20 Mikolaj Zalewski <mikolajz@google.com>
5448
5449 * incremental.cc: New file.
5450 * Makefile.am (CCFILES): Add incremental.cc.
5451 * Makefile.in: Rebuild.
5452
41105937
PP
54532009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
5454
5455 * layout.cc (Layout::output_section_name): Preserve names
5456 of '.note.' sections.
e1df38aa 5457
60439920
ILT
54582009-03-19 Ian Lance Taylor <iant@google.com>
5459
5460 * descriptors.cc (Descriptors::open): Check that the options are
5461 valid before using them.
5462
0d371ad3
ILT
54632009-03-18 Ian Lance Taylor <iant@google.com>
5464
5465 * script-sections.h: Include <list>.
5466 (class Script_sections): Change Sections_elements from std::vector
5467 to std::list. Typedef public Elements_iterator. Add
5468 orphan_section_placement_, data_segment_align_start_, and
5469 saw_data_segment_align_ fields. Remove data_segment_align_index_
5470 field.
5471 * script-sections.cc (class Orphan_section_placement): New class.
5472 (class Sections_element): Add virtual functions is_relro and
5473 orphan_section_init. Remove virtual function place_orphan_here.
5474 (class Output_section_definition): Add is_relro and
5475 orphan_section_init. Remove place_orphan_here.
5476 (class Orphan_output_section): Likewise.
5477 (Script_sections::Script_sections): Update for field changes.
5478 (Script_sections::data_segment_align): Set saw_data_segment_align_
5479 and data_segment_align_start_, not data_segment_align_index.
5480 (Script_sections::data_segment_relro_end): Check
5481 saw_data_segment_align_. Use data_segment_align_start_ rather
5482 than data_segment_align_index_.
5483 (Script_sections::place_orphan): Rewrite to use
5484 Orphan_section_placement.
5485
9201d894
ILT
54862009-03-17 Ian Lance Taylor <iant@google.com>
5487
9c5b8369
ILT
5488 * archive.cc (Archive::add_symbols): Check for a version attached
5489 to the symbol name in the archive map.
5490 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
5491 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
5492 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
5493 (ver_test_11.a): New target.
5494 * testsuite/Makefile.in: Rebuild.
5495
9201d894
ILT
5496 * configure.ac: Check for chsize and posix_fallocate. Replace
5497 ftruncate.
5498 * ftruncate.c: New file, from gnulib.
5499 * output.cc (posix_fallocate): Define dummy version if not
5500 HAVE_POSIX_FALLOCATE.
5501 (Output_file::map): Call posix_fallocate rather than lseek and
5502 write.
5503 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
5504 * configure, Makefile.in, config.in: Rebuild.
5505
ef4ab7a8 55062009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 5507
ef4ab7a8
PP
5508 * layout.h (Layout::create_note): Add section_name parameter.
5509 * layout.cc (Layout::create_note): Likewise.
5510 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 5511
8c500701
ILT
55122009-03-17 Ian Lance Taylor <iant@google.com>
5513
e85b18e1
ILT
5514 * descriptors.cc: Include "options.h".
5515 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
5516 (Descriptors::open): Always use O_CLOEXEC when opening a new
5517 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
5518 then set FD_CLOEXEC.
5519
9efe6174
ILT
5520 * sparc.cc (class Target_sparc): Add has_got_section.
5521 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
5522 make sure we have a GOT section.
5523
5524 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
5525 (Target_sparc::Scan::local): Likewise.
5526 (Target_sparc::Scan::global): Likewise.
5527 (Target_sparc::Relocate::relocate): Likewise.
5528 (Target_sparc::Relocate::relocate_tls): Likewise.
5529
8c500701
ILT
5530 * symtab.cc (Symbol_table::define_default_version): New function,
5531 broken out of add_from_object.
5532 (Symbol_table::add_from_object): Call define_default_version.
5533 (Symbol_table::define_special_symbol): Add resolve_oldsym
5534 parameter. Change all callers. If the version for a symbol comes
5535 from a version script, resolve it with the symbol with the same
5536 name with no version. Also add the symbol without a version if
5537 appropriate.
5538 (do_define_in_output_data): If resolving with oldsym, don't delete
5539 sym.
5540 (do_define_in_output_segment): Likewise.
5541 (do_define_as_constant): Likewise.
5542 * symtab.h (class Symbol_table): Update declarations.
5543
f1ed28fb
ILT
55442009-03-13 Ian Lance Taylor <iant@google.com>
5545
15f8229b
ILT
5546 * readsyms.cc (Read_symbols::incompatible_warning): New function.
5547 (Read_symbols::requeue): New function.
5548 (Read_symbols::do_read_symbols): If make_elf_object fails because
5549 the target type is not configured, and the file was searched for,
5550 issue a warning and retry with the next directory.
5551 (Add_symbols::run): If the file has an incompatible format, and
5552 it was searched for, requeue the Read_symbols task. On error,
5553 release the object.
5554 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
5555 dirindex parameter to constructor. Change all callers. Declare
5556 incompatible_warning and requeue.
5557 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
5558 input_argument_ and input_group_ fields. Add them to
5559 constructor. Change all callers.
5560 (class Read_script): Add dirindex_ field. Add it to constructor.
5561 Change all callers.
5562 * archive.cc (Archive::setup): Remove input_objects parameter.
5563 Change all callers.
5564 (Archive::get_file_and_offset): Likewise.
5565 (Archive::read_all_symbols): Likewise.
5566 (Archive::read_symbols): Likewise.
5567 (Archive::get_elf_object_for_member): Remove input_objects
5568 parameter. Add punconfigured parameter. Change all callers.
5569 (Archive::add_symbols): Change return type to bool. Check return
5570 value of include_member.
5571 (Archive::include_all_members): Likewise.
5572 (Archive::include_member): Change return type to bool. Return
5573 false if first included object has incompatible target. Set
5574 included_member_ field.
5575 (Add_archive_symbols::run): If add_symbols returns false, requeue
5576 Read_symbols task.
5577 * archive.h (class Archive): Add included_member_ field.
5578 Initialize it in constructor. Add input_file and searched_for
5579 methods. Update declarations.
5580 (class Add_archive_symbols): Add dirpath_, dirindex_, and
5581 input_argument_ fields. Add them to constructor. Change all
5582 callers.
5583 * script.cc: Include "target-select.h".
5584 (class Parser_closure): Add skip_on_incompatible_target_ and
5585 found_incompatible_target_ fields. Add
5586 skip_on_incompatible_target parameter to constructor. Change all
5587 callers. Add methods skip_on_incompatible_target,
5588 clear_skip_on_incompatible_target, found_incompatible_target, and
5589 set_found_incompatible_target.
5590 (read_input_script): Add dirindex parameter. Change all callers.
5591 If parser finds an incompatible target, requeue Read_symbols
5592 task.
5593 (script_set_symbol): Clear skip_on_incompatible_target in
5594 closure.
5595 (script_add_assertion, script_parse_option): Likewise.
5596 (script_start_sections, script_add_phdr): Likewise.
5597 (script_check_output_format): New function.
5598 * script.h (read_input_script): Update declaration.
5599 * script-c.h (script_check_output_format): Declare.
5600 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
5601 (ignore_cmd): Remove OUTPUT_FORMAT.
5602 * fileread.cc (Input_file::Input_file): Add explicit this.
5603 (Input_file::will_search_for): New function.
5604 (Input_file::open): Add pindex parameter. Change all callers.
5605 * fileread.h (class Input_file): Add input_file_argument method.
5606 Declare will_search_for. Update declarations.
5607 * object.cc (make_elf_object): Add punconfigured parameter.
5608 Change all callers.
5609 * object.h (class Object): Make input_file public. Add
5610 searched_for method.
5611 (make_elf_object): Update declaration.
5612 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
5613 restart search.
5614 * dirsearch.h (class Dirsearch): Update declaration.
5615 * options.h (class General_options): Add --warn-search-mismatch.
5616 * parameters.cc (Parameters::is_compatible_target): New function.
5617 * parameters.h (class Parameters): Declare is_compatible_target.
5618 * workqueue.cc (Workqueue::add_blocker): New function.
5619 * workqueue.h (class Workqueue): Declare add_blocker.
5620
f1ed28fb
ILT
5621 * fileread.cc (Input_file::open): Remove options parameter.
5622 Change all callers.
5623 (Input_file::open_binary): Likewise.
5624 * script.cc (read_input_script): Likewise.
5625 * readsyms.h (class Read_symbols): Remove options_ field. Remove
5626 options parameter from constructor. Change all callers.
5627 (class Read_script): Likewise.
5628 * fileread.h (class Input_file): Update declarations.
5629 * script.h (read_input_script): Update declaration.
5630
34dd024a
NC
56312009-03-10 Nick Clifton <nickc@redhat.com>
5632
5633 * po/es.po: New Spanish translation.
5634
6d71b17c
CC
56352009-03-06 Cary Coutant <ccoutant@google.com>
5636
5637 * options.cc (parse_short_option): Keep dash_z from registering itself.
5638
031cdbed
ILT
56392009-03-03 Ian Lance Taylor <iant@google.com>
5640
5641 PR 9918
5642 * target-reloc.h (relocate_section): Pass output_section to
5643 relocate.
5644 * i386.cc (Target_i386::should_apply_static_reloc): Add
5645 output_section parameter. Change all callers.
5646 (Target_i386::Relocate::relocate): Add output_section parameter.
5647 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
5648 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
5649 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
5650 * testsuite/two_file_shared.sh: New script.
5651 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
5652 (check_DATA): Add two_file_shared.dbg.
5653 (two_file_shared.dbg): New target.
5654 * testsuite/Makefile.in: Rebuild.
5655
15d5fa16
ILT
56562009-03-01 Ian Lance Taylor <iant@google.com>
5657
5658 * configure.ac: Check for byteswap.h.
5659 * configure: Rebuild.
5660 * config.in: Rebuild.
5661
8a4c0b0d
ILT
56622009-03-01 Mikolaj Zalewski <mikolajz@google.com>
5663
5664 * layout.cc (Layout::find_or_add_kept_section): New function.
5665 (Layout::add_comdat): Removed.
5666 * layout.h (struct Kept_section): Move out of class Layout.
5667 Remove trailing underscores from field names. Add group_sections
5668 field. Rename group_ field to is_group. Change all uses.
5669 (class Layout): Declare find_or_add_kept_section, not add_comdat.
5670 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
5671 comdat_groups_ field.
5672 (Sized_relobj::include_section_group): Use
5673 find_or_add_kept_section and Kept_section::group_sections.
5674 (Sized_relobj::include_linkonce_section): Likewise.
5675 * object.cc (class Sized_relobj): Don't define Comdat_group or
5676 Comdat_group_table. Remove find_comdat_group and
5677 add_comdat_group. Remove comdat_groups_ field.
5678 * plugin.cc (include_comdat_group): Use
5679 Layout::find_or_add_kept_section.
5680
b4ecf66b
ILT
56812009-02-28 Ian Lance Taylor <iant@google.com>
5682
14359ca0
ILT
5683 * README: --gc-sections and map files are now supported. Document
5684 some build requirements.
5685
b4ecf66b
ILT
5686 PR 6992
5687 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
5688 relocatable link set the value of the section symbol to zero.
5689 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
5690 relocatable link don't include the section address in the local
5691 symbol value.
5692
0602e05a
ILT
56932009-02-27 Ian Lance Taylor <iant@google.com>
5694
fd9d194f
ILT
5695 PR 6811
5696 * options.h (class Search_directory): Add is_system_directory.
5697 (class General_options): Declare is_in_system_directory.
5698 * options.cc (get_relative_sysroot): Make static.
5699 (get_default_sysroot): Make static.
5700 (General_optoins::is_in_system_directory): New function.
5701 * fileread.cc (Input_file::is_in_system_directory): New function.
5702 * fileread.h (class Input_file): Declare is_in_system_directory.
5703 * object.h (class Object): Add is_in_system_directory.
5704 (class Input_objects): Remove system_library_directory_ field.
5705 * object.cc (Input_objects::add_object): Don't set
5706 system_library_directory_.
5707 (input_objects::found_in_system_library_directory): Remove.
5708 * symtab.cc (Symbol_table::write_globals): Remove input_objects
5709 parameter. Change all callers.
5710 (Symbol_table::sized_write_globals): Likewise.
5711 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
5712 Call Object::is_in_system_directory.
5713 * symtab.h (class Symbol_table): Update declarations.
5714
61edd21f
ILT
5715 PR 5990
5716 * descriptors.h (Open_descriptor): Add is_on_stack field.
5717 * descriptors.cc (Descriptors::open): If the descriptor is on the
5718 top of the stack, remove it. Initialize is_on_stack field.
5719 (Descriptors::release): Only add pod to stack if it is not on the
5720 stack already.
5721 (Descriptors::close_some_descriptor): Clear stack_next and
5722 is_on_stack fields.
5723
e29e076a
ILT
5724 PR 7091
5725 * output.cc (Output_section::find_starting_output_address): Rename
5726 from starting_output_address; add PADDR parameter; change return
5727 type.
5728 * output.h (class Output_section): Declare
5729 find_starting_output_address instead of starting_output_address.
5730 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
5731 section symbol for which we can't find a merge section.
5732
0602e05a
ILT
5733 PR 9836
5734 * symtab.cc (Symbol_table::add_from_object): If the visibility is
5735 hidden or internal, force the symbol to be local.
5736 * resolve.cc (Symbol::override_visibility): Define.
5737 (Symbol::override_base): Use override_visibility.
5738 (Symbol_table::resolve): Likewise.
5739 (Symbol::override_base_with_special): Likewise.
5740 (Symbol_table::override_with_special): If the visibility is hidden
5741 or internal, force the symbol to be local.
5742 * symtab.h (class Symbol): Add set_visibility and
5743 override_visibility.
5744 * testsuite/ver_test_1.sh: New file.
5745 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
5746 (check_DATA): Add ver_test_1.syms.
5747 (ver_test_1.syms): New target.
5748 * testsuite/Makefile.in: Rebuild.
5749
401a9a73
CC
57502009-02-25 Cary Coutant <ccoutant@google.com>
5751
5752 * layout.cc (Layout::choose_output_section): Don't rename sections
5753 when using a linker script that has a SECTIONS clause.
5754 * Makefile.in: Regenerate.
5755
5756 * testsuite/Makefile.am (script_test_5.sh): New test case.
5757 * testsuite/Makefile.in: Regenerate.
5758 * testsuite/script_test_5.cc: New file.
5759 * testsuite/script_test_5.sh: New file.
5760 * testsuite/script_test_5.t: New file.
5761
f488e4b0
CC
57622009-02-13 Rafael Avila de Espindola <espindola@google.com>
5763
5764 * archive.cc (Archive::include_member): Update calls to add_symbols.
5765 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
5766 the Layout argument.
5767 * dynobj.h (do_add_symbols): Add the Layout argument.
5768 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
5769 Layout argument.
5770 * object.h (Object::add_symbols): Add the Layout argument.
5771 (Object::do_add_symbols): Add the Layout argument.
5772 (Sized_relobj::do_add_symbols): Add the Layout argument.
5773 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
5774 Unify the two versions.
5775 (Add_plugin_symbols): Remove.
5776 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
5777 (Sized_pluginobj::do_add_symbols): Unify the two versions.
5778 (Add_plugin_symbols): Remove.
5779 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
5780 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
5781 (Add_symbols::run): Make it work with Pulginobj.
5782
89dd1680
ILT
57832009-02-06 Ian Lance Taylor <iant@google.com>
5784
5785 * object.cc (Sized_relobj::do_layout): Make info message start
5786 with lower case letter.
5787
266d0a74
ILT
57882009-02-06 Mikolaj Zalewski <mikolajz@google.com>
5789
602b464e
ILT
5790 * binary.cc: Fix file comment.
5791
266d0a74
ILT
5792 * options.h (enum Incremental_disposition): Define.
5793 (class General_options): Add new options: --incremental,
5794 --incremental_changed, --incremental_unchanged,
5795 --incremental_unknown. Add incremental_disposition_ and
5796 implicit_incremental_ fields.
5797 (General_options::incremental_disposition): New function.
5798 (class Position_dependent_options): Add incremental_disposition
5799 option.
5800 (Position_dependent_options::copy_from_options): Set incremental
5801 dispositions.
5802 * options.cc (General_options::parse_incremental_changed): New
5803 function.
5804 (General_options::parse_incremental_unchanged): New function.
5805 (General_options::parse_incremental_unknown): New function.
5806 (General_options::General_options): Initialize new fields
5807 incremental_disposition_ and implicit_incremental_.
5808 (General_options::finalize): Check for uasge of --incremental-*
5809 without --incremental.
5810
f073bbf7
CD
58112009-02-06 Chris Demetriou <cgd@google.com>
5812
5813 * gold.h (gold_undefined_symbol): Change to take only a Symbol
5814 pointer and to report location as the file name associated with
5815 the symbol.
5816 (gold_undefined_symbol_at_location): New function to replace the
5817 old gold_undefined_symbol functionality.
5818 * target-reloc.h (relocate_section): Update to use
5819 gold_undefined_symbol_at_location.
5820 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5821 Call gold_undefined_symbol function rather than gold_error.
5822 * errors.h (Errors::undefined_symbol): Take location as a
5823 string, rather than calculating it from a relocation.
5824 * errors.cc (Errors::fatal): Print "fatal error:" before the
5825 formatted message.
5826 (Errors::error, Errors::error_at_location): Print "error: "
5827 before the formatted message.
5828 (Errors::undefined_symbol): Take location as a string, rather
5829 than calculating it from a relocation.
5830 (gold_undefined_symbol_at_location): New function akin to
5831 old gold_undefined_symbol, calculates location from relocation.
5832 (gold_undefined_symbol): Change to take only a Symbol pointer
5833 and to report location as the file name associated with the symbol.
5834 * testsuite/debug_msg.sh: Update for changed error messages.
5835 * testsuite/undef_symbol.sh: Likewise.
5836
8e94a90c
ILT
58372009-02-04 Duncan Sands <baldrick@free.fr>
5838
5839 PR 9812
5840 * reduced_debug_output.h
5841 (Output_reduced_debug_abbrev_section::failed): Use format for
5842 gold_warning.
5843 (Output_reduced_debug_info_section::faild): Likewise.
5844
88a0e15b
ILT
58452009-01-31 Mikolaj Zalewski <mikolajz@google.com>
5846
5847 * script.cc (Lazy_demangler): New class.
5848 (Version_script_info::get_symbol_version_helper): Demangle a
5849 symbol only once.
5850
5efc7cd2
CC
58512009-01-29 Cary Coutant <ccoutant@google.com>
5852
5853 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
5854 to __tls_get_addr.
5855 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
5856
e0ebcf42
ILT
58572009-01-28 Ian Lance Taylor <iant@google.com>
5858
5efc7cd2 5859 * version.cc (version_string): Bump to 1.9.
75fe7426 5860
e0ebcf42
ILT
5861 * gold.h: Include <cstring> and <stdint.h>.
5862 * version.cc: Include <cstdio>.
5863 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
5864 warning.
5865 * reduced_debug_output.cc (insert_into_vector): Rename from
5866 Insert_into_vector; change all callers. Use Swap_unaligned to
5867 avoid aliasing issue; remove union since it is unnecessary.
5868
8e2813be 58692009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
5870
5871 * Makefile.am (CCFILES): Add gc.cc.
5872 (HFILES): Add gc.h.
5873 * Makefile.in: Regenerate.
5874 * gold.cc (Gc_runner): New class.
5875 (queue_initial_tasks): Call garbage collection related tasks
5876 when corresponding options are invoked.
5877 (queue_middle_gc_tasks): New function.
5878 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
5879 processed early before laying out sections during garbage collection.
5880 * gold.h (queue_middle_gc_tasks): New function.
5881 (is_prefix_of): Move from "layout.cc".
5882 * i386.cc (Target_i386::gc_process_relocs): New function.
5883 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
5884 * main.cc (main): Create object of class "Garbage_collection".
5885 * object.cc (Relobj::copy_symbols_data): New function.
5886 (Relobj::is_section_name_included): New function.
e1df38aa
NC
5887 (Sized_relobj::do_layout): Allow this function to be called twice
5888 during garbage collection and defer layout of section during the
6d03d481
ST
5889 first call.
5890 * object.h (Relobj::get_symbols_data): New function.
5891 (Relobj::is_section_name_included): New function.
5892 (Relobj::copy_symbols_data): New function.
5893 (Relobj::set_symbols_data): New function.
5894 (Relobj::get_relocs_data): New function.
5895 (Relobj::set_relocs_data): New function.
5896 (Relobj::is_output_section_offset_invalid): New pure virtual function.
5897 (Relobj::gc_process_relocs): New function.
5898 (Relobj::do_gc_process_relocs): New pure virtual function.
5899 (Relobj::sd_): New data member.
5900 (Sized_relobj::is_output_section_offset_invalid): New function.
5901 (Sized_relobj::do_gc_process_relocs): New function.
5902 * options.h (General_options::gc_sections): Modify to not be a no-op.
5903 (General_options::print_gc_sections): New option.
5904 * plugin.cc (Plugin_finish::run): Remove function call to
5905 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
5906 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
5907 * reloc.cc (Read_relocs::run): Add task to process relocs and
5908 determine unreferenced sections when doing garbage collection.
5909 (Gc_process_relocs): New class.
5910 (Sized_relobj::do_gc_process_relocs): New function.
5911 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
5912 sections that are garbage collected.
5913 * reloc.h (Gc_process_relocs): New class.
5914 * sparc.cc (Target_sparc::gc_process_relocs): New function.
5915 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
5916 symbols whose corresponding sections are garbage collected.
5917 (Symbol_table::Symbol_table): Add new parameter for the garbage
5918 collection object.
5919 (Symbol_table::gc_mark_undef_symbols): New function.
5920 (Symbol_table::gc_mark_symbol_for_shlib): New function.
5921 (Symbol_table::gc_mark_dyn_syms): New function.
5922 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
5923 as garbage.
5924 (Symbol_table::add_from_object): Likewise.
5925 (Symbol_table::add_from_relobj): When building shared objects, do not
5926 treat externally visible symbols as garbage.
5927 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
5928 table information for static and relocatable links.
5929 * symtab.h (Symbol_table::set_gc): New function.
5930 (Symbol_table::gc): New function.
5931 (Symbol_table::gc_mark_undef_symbols): New function.
5932 (Symbol_table::gc_mark_symbol_for_shlib): New function.
5933 (Symbol_table::gc_mark_dyn_syms): New function.
5934 (Symbol_table::gc_): New data member.
e1df38aa 5935 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
5936 function.
5937 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
5938 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
5939
3b293544
CF
59402009-01-20 Chris Faylor <me.sourceware@sourceware.org>
5941
5942 * options.h (General_options::gc_sections): Define as a no-op for now.
5943 (General_options::no_keep_memory): Ditto.
5944 (General_options::Bshareable): Define.
5945 * options.cc (General_options::finalize): Honor -Bshareable.
5946
83d22aa8
AS
59472009-01-20 Andreas Schwab <schwab@suse.de>
5948
5949 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
5950 read the value in the contents, since we don't use it. Use the
5951 template endianness when writing.
5952 (Relocate::relocate): Use it for R_PPC_REL16_HA.
5953
cd536b21
AS
59542009-01-19 Andreas Schwab <schwab@suse.de>
5955
5956 * configure.tgt (powerpc64-*): Fix targ_obj.
5957
99e9a495
ILT
59582009-01-15 Ian Lance Taylor <iant@google.com>
5959
5960 * object.cc (Sized_relobj::write_local_symbols): Don't write out
5961 local symbols when stripping all symbols.
5962
bbbfea06
CC
59632009-01-14 Cary Coutant <ccoutant@google.com>
5964
99e9a495 5965 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 5966
0f7c0701
CC
59672009-01-14 Cary Coutant <ccoutant@google.com>
5968
5969 * archive.cc (Archive::get_elf_object_for_member): Remove call
5970 to File_read::claim_for_plugin.
5971 * descriptors.cc (Descriptors::open): Remove reference to
5972 is_claimed.
5973 (Descriptors::claim_for_plugin): Remove.
5974 * descriptors.h (Descriptors::claim_for_plugin): Remove.
5975 (Descriptors::is_claimed): Remove.
5976 (claim_descriptor_for_plugin): Remove.
5977 * fileread.cc (File_read::claim_for_plugin): Remove.
5978 * fileread.h (File_read::claim_for_plugin): Remove.
5979 (File_read::descriptor): Reopen descriptor if necessary.
5980 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
5981 (Plugin_manager::all_symbols_read): Add task parameter. Change
5982 all callers.
5983 (Plugin_manager::get_input_file): New function.
5984 (Plugin_manager::release_input_file): New function.
5985 (Pluginobj::Pluginobj): Add filesize parameter and initialize
5986 corresponding data member.
5987 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
5988 and pass to base constructor. Change all callers.
5989 (get_input_file, release_input_file): New functions.
5990 (make_sized_plugin_object): Add filesize parameter. Change all callers.
5991 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
5992 (Plugin_manager::all_symbols_read): Add task parameter.
5993 (Plugin_manager::get_input_file): New function.
5994 (Plugin_manager::release_input_file): New function.
5995 (Plugin_manager::task_): New data member.
5996 (Pluginobj::Pluginobj): Add filesize parameter.
5997 (Pluginobj::filename): New function.
5998 (Pluginobj::descriptor): New function.
5999 (Pluginobj::filesize): New function.
6000 (Pluginobj::filesize_): New data member.
6001 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
6002 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
6003 File_read::claim_for_plugin; use Object::unlock to unlock the file.
6004
6005 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
6006 with archive libraries.
6007 * testsuite/Makefile.in: Regenerate.
6008 * testsuite/plugin_test.c (struct sym_info): New type.
6009 (get_input_file, release_input_file): New static variables.
6010 (onload): Capture new transfer vector entries.
6011 (claim_file_hook): Stop reading at end of file according to filesize.
6012 Factor out parsing of readelf output into separate function.
6013 (all_symbols_read_hook): Exercise get_input_file and release_input_file
6014 APIs and get the source file name from the symbol table. Convert
6015 source file name to corresponding object file name. Print info
6016 message when adding new input files.
6017 (parse_readelf_line): New function.
6018 * testsuite/plugin_test_1.sh: Add checks for new info messages.
6019 * testsuite/plugin_test_2.sh: Likewise.
6020 * testsuite/plugin_test_3.sh: Likewise.
6021 * testsuite/plugin_test_4.sh: New test case.
6022
62a6d109
ILT
60232009-01-07 Ian Lance Taylor <iant@google.com>
6024
6025 * version.cc (version_string): Bump to 1.8.
6026
483620e8
CC
60272008-12-23 Cary Coutant <ccoutant@google.com>
6028
6029 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
6030 * plugin.cc (Plugin_manager::finish): Rename as
6031 layout_deferred_objects. Move cleanup to separate function.
6032 (Plugin_manager::cleanup): New function.
6033 (Plugin_finish::run): Call layout_deferred_objects and cleanup
6034 separately.
6035 * plugin.h (Plugin_manager::finish): Rename as
6036 layout_deferred_objects.
6037 (Plugin_manager::cleanup): New function.
6038 (Plugin_manager::cleanup_done): New field.
6039
d66a9eb3
CC
60402008-12-23 Cary Coutant <ccoutant@google.com>
6041
6042 * plugin.cc (is_visible_from_outside): New function.
6043 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
6044 so we don't return "IR only" status for exported symbols or -r links.
6045
6046 * testsuite/Makefile.am (plugin_test_3): New test case.
6047 * testsuite/Makefile.in: Regenerate.
6048 * testsuite/plugin_test_3.sh: New file.
6049
5995b570
CC
60502008-12-22 Cary Coutant <ccoutant@google.com>
6051
6052 * object.cc (Sized_relobj::layout_section): New function.
6053 (Sized_relobj::do_layout): Defer layout of input sections until after
6054 plugin has provided replacement files.
6055 (Sized_relobj::do_layout_deferred_sections): New function.
6056 * object.h (Relobj::set_section_offset): Remove virtual keyword.
6057 (Relobj::layout_deferred_sections): New function.
6058 (Relobj::do_layout_deferred_sections): New function.
6059 (Sized_relobj::do_layout_deferred_sections): New function.
6060 (Sized_relobj::layout_section): New function.
6061 (Sized_relobj::Deferred_layout): New structure.
6062 (Sized_relobj::deferred_layout_): New field.
6063 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
6064 Change all callers. Layout deferred sections.
6065 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
6066 references.
6067 (Plugin_hook::run): Move code from do_plugin_hook inline.
6068 (Plugin_hook::do_plugin_hook): Remove.
6069 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
6070 (Plugin_manager::finish): Renamed, was cleanup.
6071 (Plugin_manager::should_defer_layout): New function.
6072 (Plugin_manager::add_deferred_layout_object): New function.
6073 (Plugin_manager::Deferred_layout_list): New type.
6074 (Plugin_manager::deferred_layout_objects_): New field.
6075 (Plugin_hook::do_plugin_hook): Remove.
6076
ee769c88
ILT
60772008-12-17 Ian Lance Taylor <iant@google.com>
6078
6079 * options.h (class General_options): Add --no case for
6080 --export-dynamic.
6081
abc8dcba
CC
60822008-12-16 Cary Coutant <ccoutant@google.com>
6083
6084 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
6085 vector.
6086 (Plugin_manager::claim_file): Create plugin object even if
6087 plugin did not call the add_symbols callback.
6088 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
6089 asking for more symbols than were added.
6090 * testsuite/Makefile.am (plugin_test_1): Add test case with
6091 no global symbols.
6092 (empty.syms): New target.
6093 * testsuite/Makefile.in: Regenerate.
6094 * testsuite/plugin_test.c (claim_file_hook): Add new debug
6095 message. Don't call add_symbols if no globals.
6096 (all_symbols_read_hook): Don't provide replacement for empty
6097 claimed file.
6098
b0074644
ILT
60992008-12-12 Ian Lance Taylor <iant@google.com>
6100
68943102
ILT
6101 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
6102 r_type == 0 for a local symbol with r_sym == 0.
6103 (scan_relocatable_relocs): Pass r_sym to
6104 local_non_section_strategy.
6105 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
6106 r_sym parameter.
6107
b0074644
ILT
6108 * configure.ac: Update test for TLS descriptors: they are
6109 supported as of glibc 2.9.
6110 * configure: Rebuild.
6111
c2508178
ILT
61122008-12-11 Ian Lance Taylor <iant@google.com>
6113
6114 PR 7091
6115 * target-reloc.h (Default_scan_relocatable_relocs): For each
6116 function, map r_type == 0 to RELOC_DISCARD.
6117
2756a258
CC
61182008-12-10 Cary Coutant <ccoutant@google.com>
6119
6120 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
6121 object to override a kept COMDAT group from a plugin object.
6122
bb6f53d3
ILT
61232008-12-09 Ian Lance Taylor <iant@google.com>
6124
fbc558e1
ILT
6125 PR 7088
6126 * yyscript.y (file_cmd): Handle INPUT.
6127
bb6f53d3
ILT
6128 * testsuite/initpri1.c: Change all declarations to be full
6129 prototypes by adding void, to avoid compiler warnings.
6130
4674ecfc
CC
61312008-12-05 Rafael Avila de Espindola <espindola@google.com>
6132
6133 * options.cc (General_options::parse_plugin_opt): New.
6134 (General_options::add_plugin): The argument now is just the filename.
6135 (General_options::add_plugin_option): New.
6136 * options.h (plugin_opt): New.
6137 (add_plugin): Change argument name.
6138 (add_plugin_option): New.
6139 * plugin.cc (Plugin::load): Don't parse the plugin option.
6140 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
6141 (Plugin::add_option): New.
6142 (Plugin::args_): Change type.
6143 (Plugin::filename_): New.
6144 (Plugin_manager::add_plugin_option): New.
6145 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
6146 * testsuite/Makefile.in: Regenerate.
6147
fd06b4aa
CC
61482008-12-05 Cary Coutant <ccoutant@google.com>
6149
6150 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
6151 Handle --strip-lto-sections option.
6152 * options.h (strip_lto_sections): New option.
6153
6c52134c
CC
61542008-12-01 Cary Coutant <ccoutant@google.com>
6155
6156 * plugin.cc (ld_plugin_message): Change format parameter to const.
6157 Fix mismatch between new[] and delete.
6158
a45248e0
CC
61592008-11-14 Cary Coutant <ccoutant@google.com>
6160
6161 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
6162 instead of -1U.
6163
c82fbeee
CS
61642008-11-05 Craig Silverstein <csilvers@google.com>
6165
6166 * options.cc (General_options::parse_dynamic_list): New function.
6167 * options.h (General_options): New flags dynamic_list,
6168 dynamic_list_data, dynamic_list_cpp_new, and
6169 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
6170 (General_options::in_dynamic_list): New function.
6171 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
6172 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
6173 (Lex::can_continue_name): Likewise.
6174 (yylex): Likewise.
6175 (read_script_file): New parameter script_options.
6176 (read_dynamic_list): New function.
6177 (Script_options::define_dynamic_list): New function.
6178 (dynamic_list_keyword_parsecodes): New variable.
6179 (dynamic_list_keywords): New variable.
6180 * script.h (Script_options::define_dynamic_list): New function
6181 prototype.
6182 (read_dynamic_list): New function prototype.
6183 * symtab.cc (strprefix): New macro.
6184 (Symbol::should_add_dynsym_entry): Support dynamic_list,
6185 dynamic_list_data, dynamic_list_cpp_new, and
6186 dynamic_list_cpp_typeinfo.
6187 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
6188 (dynamic_list_expr): New rule.
6189 (dynamic_list_nodes): Likewise.
6190 (dynamic_list_node): Likewise.
6191 * testsuite/Makefile.am (dynamic_list): New test.
6192 * testsuite/Makefile.in: Regenerated.
6193 * testsuite/dynamic_list.t: New file.
6194 * testsuite/dynamic_list.sh: New file.
6195
e0bb29a5
CS
61962008-11-05 Craig Silverstein <csilvers@google.com>
6197
6198 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
6199 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
6200 (t11_last): Likewise.
6201 * testsuite/ver_test_6.c (main): Likewise.
6202
4e1e25e0
CC
62032008-10-07 Cary Coutant <ccoutant@google.com>
6204
6205 * options.c (General_options::finalize): Add check for -static and
6206 -shared.
6207 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
6208 is not empty.
6209
92f03fcb
CC
62102008-10-02 Cary Coutant <ccoutant@google.com>
6211
6212 * plugin.cc (make_sized_plugin_object): Fix conditional
6213 compilation to work when not all targets are enabled.
6214
fbd8a257
CC
62152008-09-29 Cary Coutant <ccoutant@google.com>
6216
6217 * archive.cc (Archive::get_file_and_offset): Use filename instead
6218 of name to get library path.
6219 (Archive::include_member): Unlock external member of a thin archive.
6220
6221 * testsuite/Makefile.am (TEST_AR): New variable.
6222 (thin_archive_test_1): New test.
6223 (thin_archive_test_2): New test.
81636b3f
CC
6224 * testsuite/Makefile.in: Regenerate.
6225 * testsuite/thin_archive_main.cc: New file.
6226 * testsuite/thin_archive_test_1.cc: New file.
6227 * testsuite/thin_archive_test_2.cc: New file.
6228 * testsuite/thin_archive_test_3.cc: New file.
6229 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 6230
eff45813
CC
62312008-09-29 Cary Coutant <ccoutant@google.com>
6232
6233 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
6234 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
6235 instead of -1U.
6236 (Sized_relobj::do_finalize_local_symbols): Likewise.
6237 (Sized_relobj::map_to_kept_section): Likewise.
6238 * object.h (Sized_relobj::invalid_address): New constant.
6239 (Sized_relobj::do_output_section_offset): Check for invalid_address
6240 and return -1ULL.
6241 * output.cc (Output_reloc::local_section_offset): Use constant
6242 invalid_address instead of -1U.
6243 (Output_reloc::get_address): Likewise.
6244 (Output_section::output_address): Change -1U to -1ULL.
6245 * output.h (Output_reloc::invalid_address): New constant.
6246 * reloc.cc (Sized_relobj::write_sections): Use constant
6247 invalid_address instead of -1U.
6248 (Sized_relobj::relocate_sections): Likewise.
6249 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
6250 values for merge sections.
6251 * target-reloc.h (relocate_for_relocatable): Use constant
6252 invalid_address instead of -1U.
6253
89fc3421
CC
62542008-09-19 Cary Coutant <ccoutant@google.com>
6255
6256 Add plugin functionality for link-time optimization (LTO).
6257 * configure.ac (plugins): Add --enable-plugins option.
6258 * configure: Regenerate.
6259 * config.in: Regenerate.
6260 * Makefile.am (LIBDL): New variable.
6261 (CCFILES): Add plugin.cc.
6262 (HFILES): Add plugin.h.
6263 (ldadd_var): Add LIBDL.
6264 * Makefile.in: Regenerate.
6265
6266 * archive.cc: Include "plugin.h".
6267 (Archive::setup): Don't preread archive symbols when using a plugin.
6268 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
6269 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
6270 files.
6271 (Archive::include_member): Add symbols from plugin objects.
6272 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
6273 * descriptors.cc (Descriptors::open): Check for file descriptors
6274 abandoned by plugins.
6275 (Descriptors::claim_for_plugin): New function.
6276 * descriptors.h (Descriptors::claim_for_plugin): New function.
6277 (Open_descriptor::is_claimed): New field.
6278 (claim_descriptor_for_plugin): New function.
6279 * fileread.cc (File_read::claim_for_plugin): New function.
6280 * fileread.h (File_read::claim_for_plugin): New function.
6281 (File_read::descriptor): New function.
6282 * gold.cc: Include "plugin.h".
6283 (queue_initial_tasks): Add task to call plugin hooks for generating
6284 new object files.
6285 * main.cc: Include "plugin.h".
6286 (main): Load plugin libraries.
6287 * object.h (Pluginobj): Declare.
6288 (Object::pluginobj): New function.
6289 (Object::do_pluginobj): New function.
6290 (Object::set_target): New function.
6291 * options.cc: Include "plugin.h".
6292 (General_options::parse_plugin): New function.
6293 (General_options::General_options): Initialize plugins_ field.
6294 (General_options::add_plugin): New function.
6295 * options.h (Plugin_manager): Declare.
6296 (General_options): Add --plugin option.
6297 (General_options::has_plugins): New function.
6298 (General_options::plugins): New function.
6299 (General_options::add_plugin): New function.
6300 (General_options::plugins_): New field.
6301 * plugin.cc: New file.
6302 * plugin.h: New file.
6303 * readsyms.cc: Include "plugin.h".
6304 (Read_symbols::do_read_symbols): Check for archive before checking
6305 for ELF file. Call plugin hooks to claim files.
6306 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
6307 from a real object file; force override when processing replacement
6308 files.
6309 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
6310 (Symbol::init_base_object): Likewise.
6311 (Symbol::init_base_output_data): Likewise.
6312 (Symbol::init_base_output_segment): Likewise.
6313 (Symbol::init_base_constant): Likewise.
6314 (Symbol::init_base_undefined): Likewise.
6315 (Symbol::output_section): Assert that object is not a plugin.
6316 (Symbol_table::add_from_pluginobj): New function.
6317 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
6318 undefined.
6319 (Symbol_table::sized_write_globals): Likewise.
6320 (Symbol_table::add_from_pluginobj): Instantiate template.
6321 * symtab.h (Sized_pluginobj): Declare.
6322 (Symbol::in_real_elf): New function.
6323 (Symbol::set_in_real_elf): New function.
6324 (Symbol::in_real_elf_): New field.
6325 (Symbol_table::add_from_pluginobj): New function.
6326
6327 * testsuite/Makefile.am (AM_CFLAGS): New variable.
6328 (LIBDL): New variable.
6329 (LDADD): Add LIBDL.
6330 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
6331 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
6332 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
6333 (MOSTLYCLEANFILES): Likewise.
6334 * testsuite/Makefile.in: Regenerate.
6335 * testsuite/plugin_test.c: New file.
6336 * testsuite/plugin_test_1.sh: New file.
6337 * testsuite/plugin_test_2.sh: New file.
6338
de31bda5
ILT
63392008-09-16 Ian Lance Taylor <iant@google.com>
6340
9c2d0ef9
ILT
6341 * target-reloc.h (relocate_section): Check whether a symbol is
6342 defined by the ABI before reporting an undefined symbol error.
6343 * target.h (Target::is_defined_by_abi): Make parameter const.
6344 (Target::do_is_defined_by_abi): Likewise.
6345 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
6346 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
6347 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
6348 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
6349 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
6350 * testsuite/Makefile.in: Rebuild.
6351
de31bda5
ILT
6352 * fileread.cc (make_view): Add casts to avoid warning.
6353
9fa33bee
AO
63542008-09-16 Alexandre Oliva <aoliva@redhat.com>
6355
6356 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
6357 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6358
183fd0e3
AO
63592008-09-16 Alexandre Oliva <aoliva@redhat.com>
6360
6361 * options.h (General_options::output_is_executable): New.
6362 (General_options::output_is_pie): New.
6363 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
6364 for shared libraries.
6365 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6366
7be8330a
CD
63672008-09-11 Chris Demetriou <cgd@google.com>
6368
6369 * options.h (origin): New -z option.
6370 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
6371 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
6372 in DT_FLAGS_1.
6373
a9caad02
CC
63742008-09-05 Cary Coutant <ccoutant@google.com>
6375
6376 * fileread.cc (File_read::make_view): Add check for attempt to map
6377 beyond end of file.
6378
ae6dce4d
CC
63792008-09-05 Cary Coutant <ccoutant@google.com>
6380
6381 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
6382 explicit instantiations.
6383
d7ab2a47
KVH
63842008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
6385
6386 PR gold/6858
6387 * options.cc (General_options::finalize): Allow undefined symbols
6388 in shlibs if linking -shared.
6389
6390 PR gold/6859
6391 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
6392 symbols as not needing a dynsym entry.
6393
1e52a9c1
CS
63942008-08-20 Craig Silverstein <csilvers@google.com>
6395
6396 * fileread.cc (File_read::open): Do not lock the file unless it
6397 was successfully opened.
6398
d85c80a3
CC
63992008-08-14 Cary Coutant <ccoutant@google.com>
6400
6401 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
6402 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
6403 * testsuite/tls_test.cc (struct int128): 128-bit struct
6404 for testing TLS relocs with non-zero addend.
6405 (v12): New TLS variable.
6406 (t12): New test.
6407 (t_last): Add check for v12.
6408 * testsuite/tls_test.h (t12): New function.
6409 * testsuite/tls_test_main.cc (thread_routine): Call new test.
6410
2d924fd9
ILT
64112008-08-13 Ian Lance Taylor <iant@google.com>
6412
6413 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
6414 set tls_segment_ or relro_segment_.
6415 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
6416 when appropriate.
6417 * output.h (Output_section::clear_is_relro): New function.
6418 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
6419 sections specially even when output_data_ is empty.
6420 (Output_segment::maximum_alignment): When first section is relro,
6421 only force alignment for PT_LOAD segments.
6422 * script.cc (script_data_segment_align): New function.
6423 (script_data_segment_relro_end): New function.
6424 * script-c.h (script_data_segment_align): Declare.
6425 (script_data_segment_relro_end): Declare.
6426 * script-sections.h (class Script_sections): Declare
6427 data_segment_align and data_segment_relro_end. Add fields
6428 segment_align_index_ and saw_relro_end_.
6429 * script-sections.cc (class Sections_element): Add set_is_relro
6430 virtual function. Add new bool* parameter to place_orphan_here.
6431 Add get_output_section virtual function.
6432 (class Output_section_definition): Add set_is_relro. Add new
6433 bool* parameter to place_orphan_here. Add get_output_section.
6434 Add is_relro_ field.
6435 (Output_section_definition::Output_section_definition): Initialize
6436 evaluated_address_, evaluated_load_address, evaluated_addralign_,
6437 and is_relro_ fields.
6438 (Output_section_definition::place_orphan_here): Add is_relro
6439 parameter.
6440 (Output_section_definition::set_section_addresses): Set relro for
6441 output section.
6442 (Output_section_definition::alternate_constraint): Likewise.
6443 (class Orphan_output_section): Add new bool* parameter to
6444 place_orphan_here. Add get_output_section.
6445 (Orphan_output_section::place_orphan_here): Add is_relro
6446 parameter.
6447 (Script_sections::Script_sections): Initialize
6448 data_segment_align_index_ and saw_relro_end_.
6449 (Script_sections::data_segment_align): New function.
6450 (Script_sections::data_segment_relro_end): New function.
6451 (Script_sections::place_orphan): Set or clear is_relro.
6452 (Script_sections::set_section_addresses): Force alignment of first
6453 TLS section.
6454 * yyscript.y (exp): Call script_data_segment_align and
6455 script_data_segment_relro_end.
6456 * testsuite/relro_script_test.t: New file.
6457 * testsuite/relro_test.cc (using_script): Declare.
6458 (t1, t2): Test using_script.
6459 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
6460 (relro_script_test_SOURCES): Define.
6461 (relro_script_test_DEPENDENCIES): Define.
6462 (relro_script_test_LDFLAGS): Define.
6463 (relro_script_test_LDADD): Define.
6464 (relro_script_test.so): New target.
6465 * testsuite/Makefile.in: Rebuild.
6466
f827c9a9
CC
64672008-08-06 Cary Coutant <ccoutant@google.com>
6468
6469 * archive.cc (Archive::total_archives, Archive::total_members)
6470 (Archive::total_members_loaded): New variables.
6471 (Archive::setup): Add parameter. Add option to preread
6472 archive symbols.
6473 (Archive::read_armap): Add counter.
6474 (Archive::get_file_and_offset): New function.
6475 (Archive::get_elf_object_for_member): New function.
6476 (Archive::read_all_symbols): New function.
6477 (Archive::read_symbols): New function.
6478 (Archive::add_symbols): Add counters.
6479 (Archive::include_all_members): Use armap to find members if it's
6480 already built.
6481 (Archive::include_member): Skip reading symbols if already read.
6482 Factored code into Archive::get_file_and_offset and
6483 Archive::get_elf_object_for_member. Changed call to
6484 Mapfile::report_include_archive_member.
6485 (Archive::print_stats): New function.
6486 * archive.h: Declare Object and Read_symbols_data classes.
6487 (Archive::Archive): Add initializers for new members.
6488 (Archive::setup): Add parameter.
6489 (Archive::print_stats): New function.
6490 (Archive::total_archives, Archive::total_members)
6491 (Archive::total_members_loaded): New variables.
6492 (Archive::get_file_and_offset): New function.
6493 (Archive::get_elf_object_for_member): New function.
6494 (Archive::read_all_symbols): New function.
6495 (Archive::read_symbols): New function.
6496 (Archive::Archive_member): New class.
6497 (Archive::members_): New member.
6498 (Archive::num_members_): New member.
6499 * main.cc: Include archive.h.
6500 (main): Call Archive::print_stats.
6501 * mapfile.cc (Mapfile::report_include_archive_member): Delete
6502 archive parameter; member_name is now the fully-decorated name.
6503 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
6504 * options.h: (General_options): Add --preread-archive-symbols option.
6505 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
6506 Archive::setup.
6507
de4c45bd
ILT
65082008-08-04 Ian Lance Taylor <iant@google.com>
6509
6510 * symtab.h (Symbol::use_plt_offset): New function.
6511 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
6512 * powerpc.cc (Relocate::relocate): Likewise.
6513 * sparc.cc (Relocate::relocate): Likewise.
6514 * x86_64.cc (Relocate::relocate): Likewise.
6515 * testsuite/weak_plt.sh: New test.
6516 * testsuite/weak_plt_main.cc: New test.
6517 * testsuite/weak_plt_shared.cc: New test.
6518 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
6519 (check_PROGRAMS): Add weak_plt.
6520 (check_DATA): Add weak_plt_shared.so.
6521 (weak_plt_main_pic.o, weak_plt): New targets.
6522 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
6523 * testsuite/Makefile.in: Rebuild.
6524
6525 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
6526 gcctestdir/ld.
6527 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
6528 * testsuite/Makefile.in: Rebuild.
6529
323ee3f4
AM
65302008-08-04 Alan Modra <amodra@bigpond.net.au>
6531
6532 * Makefile.am (POTFILES.in): Set LC_ALL=C.
6533 * Makefile.in: Regenerate.
6534 * po/POTFILES.in: Regenerate.
6535
7c07ecec
ILT
65362008-07-29 Ian Lance Taylor <iant@google.com>
6537
6538 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
6539 symbols before other symbols.
6540 * testsuite/script_test_2.cc (test_addr): Declare.
6541 (test_addr_alias): Declare.
6542 (main): Check that test_addr and test_addr_alias have the right
cd536b21 6543 values.
7c07ecec
ILT
6544 * testsuite/script_test_2.t: Define test_addr_alias and
6545 test_addr.
6546
5778530e
ILT
65472008-07-24 Ian Lance Taylor <iant@google.com>
6548
2a00e4fb
ILT
6549 PR 5990
6550 * descriptors.cc: New file.
6551 * descriptors.h: New file.
6552 * gold-threads.h (class Hold_optional_lock): New class.
6553 * fileread.cc: Include "descriptors.h".
6554 (File_read::~File_read): Release descriptor rather than closing
6555 it.
6556 (File_read::open) [file]: Call open_descriptor rather than open.
6557 Set is_descriptor_opened_.
6558 (File_read::open) [memory]: Assert that descriptor is not open.
6559 (File_read::reopen_descriptor): New function.
6560 (File_read::release): Release descriptor.
6561 (File_read::do_read): Make non-const. Reopen descriptor.
6562 (File_read::read): Make non-const.
6563 (File_read::make_view): Reopen descriptor.
6564 (File_read::do_readv): Likewise.
6565 * fileread.h (class File_read): Add is_descriptor_opened_ field.
6566 Update declarations.
6567 * layout.cc: Include "descriptors.h".
6568 (Layout::create_build_id): Use open_descriptor rather than open.
6569 * output.cc: Include "descriptors.h".
6570 (Output_file::open): Use open_descriptor rather than open.
6571 * archive.cc (Archive::const_iterator): Change Archive to be
6572 non-const.
6573 (Archive::begin, Archive::end): Make non-const.
6574 (Archive::count_members): Likewise.
6575 * archive.h (class Archive): Update declarations.
6576 * object.h (Object::read): Make non-const.
6577 * Makefile.am (CCFILES): Add descriptors.cc.
6578 (HFILES): Add descriptors.h.
6579 * Makefile.in: Rebuild.
6580
801647d1
ILT
6581 PR 6716
6582 * gold.h: Always include <clocale>. Add Solaris workarounds
6583 following code in binutils/sysdep.h.
6584
5edd166e
ILT
6585 PR 6048
6586 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
6587 this->eh_frame_hdr_ is NULL before using it.
6588
c89ad728
ILT
6589 * dynobj.cc (Versions::Versions): Update comment.
6590
aa86f06b
ILT
6591 * dynobj.cc (Versions::Versions): If there is an soname, use it as
6592 the base version name.
6593
5778530e
ILT
6594 * stringpool.cc (Stringpool_template::add_with_length): Set key to
6595 array size plus one.
6596 (Stringpool_template::set_string_offsets): Subtract one from key
6597 before using it as an array index.
6598 (Stringpool_template::get_offset_with_length): Likewise.
6599 (Stringpool_template::write_to_buffer): Likewise.
6600 * stringpool.h (Stringpool_template::get_offset_from_key):
6601 Likewise.
6602
057ead22
ILT
66032008-07-23 Ian Lance Taylor <iant@google.com>
6604
7f649c59
ILT
6605 PR 6658
6606 * object.h (Merged_symbol_value::value): Do our best to handle a
6607 negative addend.
6608
057ead22
ILT
6609 PR 6647
6610 * script.cc (Version_script_info::get_versions): Don't add empty
6611 version tag to return value.
6612 (Version_script_info::get_symbol_version_helper): Change return
6613 type to bool. Add pversion parameter. Change all callers.
6614 (script_register_vers_node): Don't require a non-NULL tag.
6615 * script.h (class Version_script_info): Update declarations.
6616 (Version_script_info::get_symbol_version): Change return type to
6617 bool. Add version parameter. Change all callers.
6618 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
6619 handling. Handle an empty version from a version script.
6620 (Symbol_table::define_special_symbol): Likewise.
6621 * testsuite/ver_test_10.script: New file.
6622 * testsuite/ver_test_10.sh: New file.
6623 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
6624 (check_DATA): Add ver_test_10.syms.
6625 (ver_test_10.syms, ver_test_10.so): New target.
6626 * testsuite/Makefile.in: Rebuild.
6627
58e54ac2
CD
66282008-07-23 Simon Baldwin <simonb@google.com>
6629
6630 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
6631 to zero for undefined symbols from dynamic libraries.
6632
95d14cd3
ILT
66332008-07-23 Ian Lance Taylor <iant@google.com>
6634
6635 * symtab.cc (Symbol_table::resolve): Remove version parameter.
6636 Change all callers.
6637 * symtab.h (class Symbol_table): Update declaration.
6638 * testsuite/ver_test_9.cc: New file.
6639 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
6640 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
6641 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
6642 (ver_test_9.so, ver_test_9.o): New targets.
6643 * testsuite/Makefile.in: Rebuild.
6644
92de84a6
ILT
66452008-07-22 Ian Lance Taylor <iant@google.com>
6646
34810851
ILT
6647 * options.h (class General_options): Define --check-sections.
6648 * layout.cc (Layout::set_segment_offsets): Handle
6649 --check-sections.
6650
af6156ef
ILT
6651 * options.h (class General_options): Define -n/--nmagic and
6652 -N/--omagic.
6653 * options.cc (General_options::finalize): For -n/--nmagic or
6654 -N/--omagic, set -static.
6655 * layout.cc (Layout::attach_allocated_section_to_segment): If
6656 -N/--omagic, don't put read-only and read-write sections in
6657 different segments.
6658 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
6659 finding a read-only segment.
6660 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
6661 don't set the minimum segment alignment to the common page size,
6662 and don't set the file offset to the address modulo the page size.
6663 * script-sections.cc (Script_sections::create_segments): If
6664 -n/--omagic, don't put read-only and read-write sections in
6665 different segments.
6666
92de84a6
ILT
6667 * cref.cc: New file.
6668 * cref.h: New file.
6669 * options.h (class General_options): Add --print-symbol-counts.
6670 * main.cc (main): Issue defined symbol report if requested.
6671 * archive.cc (Archive::interpret_header): Make into a const member
6672 function.
6673 (Archive::add_symbols): Call Input_objects::archive_start and
6674 archive_stop.
6675 (Archive::const_iterator): Define new class.
6676 (Archive::begin, Archive::end): New functions.
6677 (Archive::include_all_members): Rewrite to use iterator.
6678 (Archive::count_members): New function.
6679 * archive.h (class Archive): Update declarations.
6680 (Archive::filename): New function.
6681 * object.cc: Include "cref.h".
6682 (Sized_relobj::Sized_relobj): Initialize defined_count_.
6683 (Sized_relobj::do_get_global_symbol_counts): New function.
6684 (Input_objects::add_object): Add object to cross-referencer.
6685 (Input_objects::archive_start): New function.
6686 (Input_objects::archive_stop): New function.
6687 (Input_objects::print_symbol_counts): New function.
6688 * object.h: Declare Cref and Archive.
6689 (Object::get_global_symbol_counts): New function.
6690 (Object::do_get_global_symbol_counts): New pure virtual function.
6691 (class Sized_relobj): Add defined_count_ field. Update
6692 declarations.
6693 (class Input_objects): Add cref_ field. Update constructor.
6694 Update declarations.
6695 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
6696 defined_count_.
6697 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
6698 symbol counts.
6699 (Sized_dynobj::do_get_global_symbol_counts): New function.
6700 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
6701 defined_count_. Update declarations. Define Symbols typedef.
6702 * symtab.cc (Symbol_table::add_from_relobj): Add defined
6703 parameter. Change all callers.
6704 (Symbol_table::add_from_dynobj): Add sympointers and defined
6705 parameters. Change all callers.
6706 * symtab.h (class Symbol_table): Update declarations.
6707 * Makefile.am (CCFILES): Add cref.cc.
6708 (HFILES): Add cref.h.
6709 * Makefile.in: Rebuild.
6710
3f7c5e1d
CD
67112008-07-22 Simon Baldwin <simonb@google.com>
6712
6713 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
6714 to zero when writing undefined symbols.
6715
e0b64032
ILT
67162008-07-22 Ian Lance Taylor <iant@google.com>
6717
6718 * output.cc (Output_section::add_input_section): Don't try to
6719 merge empty merge sections.
6720
096b02cf
CS
67212008-07-21 Craig Silverstein <csilvers@google.com>
6722
6723 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6724 Include symbol version in error message.
cd536b21 6725
1d1f116d
CD
67262008-07-20 Chris Demetriou <cgd@google.com>
6727
cd536b21 6728 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
6729 (RANDOM_SEED_CFLAGS): New substituted variable.
6730 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
6731 * configure: Rebuild.
6732 * Makefile.in: Likewise.
6733 * testsuite/Makefile.in: Likewise.
6734
a18f591e
ILT
67352008-07-18 Ian Lance Taylor <iant@google.com>
6736
6737 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
6738 where we see NAME/NULL and NAME/VERSION as separate symbols.
6739 * testsuite/ver_test_main.cc (main): Call t4.
6740 (t4, t4_2a): Define.
6741 * testsuite/ver_test_2.cc (t4_2): Define.
6742 * testsuite/ver_test_2.script: Put t4_2a in VER2.
6743 * testsuite/ver_test_4.cc (t4_2a): Define.
6744 * testsuite/ver_test_4.script: Put t4_2a in VER2.
6745 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
6746
c6e3f6ed
ILT
67472008-07-17 Ian Lance Taylor <iant@google.com>
6748
6749 * dynobj.cc (Versions::add_def): If we give an error about a
6750 missing version, go ahead and create the version anyhow.
6751
ef9beddf
ILT
67522008-07-10 Ian Lance Taylor <iant@google.com>
6753
6754 Handle output sections with more than 0x7fffffff bytes.
6755 * object.h (class Relobj): Change map_to_output_ to
6756 output_sections_, and just keep a section pointer. Change all
6757 uses. Move comdat group support to Sized_relobj.
6758 (Relobj::is_section_specially_mapped): Remove.
6759 (Relobj::output_section): Remove poff parameter. Change all
6760 callers.
6761 (Relobj::output_section_offset): New function.
6762 (Relobj::set_section_offset): Rewrite.
6763 (Relobj::map_to_output): Remove.
6764 (Relobj::output_sections): New function.
6765 (Relobj::do_output_section_offset): New pure virtual function.
6766 (Relobj::do_set_section_offset): Likewise.
6767 (class Sized_relobj): Add section_offsets_ field. Add comdat
6768 group support from Relobj. Update declarations.
6769 (Sized_relobj::get_output_section_offset): New function.
6770 (Sized_relobj::do_output_section_offset): New function.
6771 (Sized_relobj::do_set_section_offset): New function.
6772 * object.cc (Relobj::output_section_address): Remove.
6773 (Sized_relobj::Sized_relobj): Initialize new fields.
6774 (Sized_relobj::include_section_group): Cast find_kept_object to
6775 Sized_relobj.
6776 (Sized_relobj::include_linkonce_section): Likewise.
6777 (Sized_relobj::do_layout): Use separate arrays for output section
6778 and output offset.
6779 (Sized_relobj::do_count_local_symbols): Change map_to_output to
6780 output_sections.
6781 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
6782 output_sections and section_offsets.
6783 (Sized_relobj::write_local_symbols): Likewise.
6784 (map_to_kept_section): Compute output address directly.
6785 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
6786 output_sections and section_offsets.
6787 (Sized_relobj::write_sections): Likewise.
6788 (Sized_relobj::relocate_sections): Likewise.
6789 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
6790 * output.h (class Output_reloc): Update declarations. Change
6791 u2_.relobj to Sized_relobj*.
6792 (class Output_data_reloc): Change add functions to use
6793 Sized_relobj*.
6794 * output.cc (Output_reloc::Output_reloc): Change relobj to
6795 Sized_relobj*.
6796 (Output_reloc::local_section_offset): Change return type to
6797 Elf_Addr. Use get_output_section_offset.
6798 (Output_reloc::get_address): Likewise.
6799 (Output_section::is_input_address_mapped): Don't call
6800 is_section_specially_mapped.
6801 (Output_section::output_offset): Likewise.
6802 (Output_section::output_address): Likewise.
6803 (Output_section::starting_output_address): Likewise.
6804 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
6805 parameter to Sized_relobj*.
6806 (Copy_relocs::need_copy_reloc): Likewise.
6807 (Copy_relocs::save): Likewise.
6808 * copy-relocs.h (class Copy_relocs): Update declarations.
6809 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
6810 Sized_relobj*. Change relobj_ field to Sized_relobj*.
6811 * target-reloc.h (relocate_for_relocatable): Change
6812 offset_in_output_section type to Elf_Addr. Change code that uses
6813 it as well.
6814 * layout.cc (Layout::layout): Always set *off.
6815 * mapfile.cc (Mapfile::print_input_section): Use
6816 output_section_offset.
6817 * i386.cc (Target_i386::copy_reloc): Change object parameter to
6818 Sized_relobj*.
6819 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
6820 * sparc.cc (Target_sparc::copy_reloc): Likewise.
6821 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
6822
5cb66f97
ILT
68232008-07-03 Ian Lance Taylor <iant@google.com>
6824
6825 * layout.cc (Layout::include_section): Do not discard unrecognized
6826 SHT_STRTAB sections.
6827
afe47622
CS
68282008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
6829
6830 * script.cc (Lex::can_continue_name): Make '?' allowable in
6831 version-script names.
6832 * testsuite/version_script.map: Change glob pattern to use '?'
6833
5adf9721
ILT
68342008-06-30 Manish Singh <yosh@gimp.org>
6835
6836 PR 6585
6837 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
6838 Correct typo.
6839
e6fde208
ILT
68402008-06-30 Ian Lance Taylor <iant@google.com>
6841
6842 PR 6660
6843 PR 6682
6844 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
6845 versions]: Don't try to read the value in the contents, since we
6846 don't use it. Use the template endianness when writing.
6847
3f2e6a2d
CC
68482008-06-25 Cary Coutant <ccoutant@google.com>
6849
6850 * fileread.cc (File_read::make_view): Assert on zero-length view.
6851 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
6852 symbol table when there are no symbols to read.
6853
c43d3a48
CS
68542008-06-23 Craig Silverstein <csilvers@google.com>
6855
6856 * version.cc (version_string): Bump to 1.7
6857
5f494ea0
CS
68582008-06-18 Craig Silverstein <csilvers@google.com>
6859
6860 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
6861 constant 0xFFFF to type Valtype.
6862 (Powerpc_relocate_functions::rel16_ha): Likewise.
6863
c42e122e
ILT
68642008-06-17 Ian Lance Taylor <iant@google.com>
6865
f34787f8
ILT
6866 * output.h (Output_section::Input_section): Initialize p2align_ to
6867 zero for Output_section_data constructors.
6868 (Output_section::Input_section::addralign): If not an input
6869 section, return the alignment of the Output_section_data.
6870 * testsuite/copy_test.cc: New file.
6871 * testsuite/copy_test_1.cc: New file.
6872 * testsuite/copy_test_2.cc: New file.
6873 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
6874 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
6875 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
6876 (copy_test_1_pic.o, copy_test_1.so): New targets.
6877 (copy_test_2_pic.o, copy_test_2.so): New targets.
6878 * testsuite/Makefile.in: Rebuild.
6879
c42e122e
ILT
6880 * script-sections.cc (Script_sections::place_orphan): Initialize
6881 local variable exact.
6882
ce3ac18a
DE
68832008-06-13 David Edelsohn <edelsohn@gnu.org>
6884
6885 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
6886
42cacb20
DE
68872008-06-12 David Edelsohn <edelsohn@gnu.org>
6888 David S. Miller <davem@davemloft.net>
6889
6890 * powerpc.cc: New file.
6891 * Makefile.am (TARGETSOURCES): Add powerpc.cc
6892 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
6893 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
6894 * Makefile.in: Rebuild.
6895
7b308235
ILT
68962008-06-09 Ian Lance Taylor <iant@google.com>
6897
6898 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
6899 <exception>.
6900 (throwing, orig_terminate): New static variables.
6901 (terminate_handler): New static function.
6902 (t2): Set terminate handler.
6903
f0b886e3
ILT
69042008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
6905
6906 PR 6584
cd536b21 6907 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
6908 alignment.
6909
3e90f135
CC
69102008-05-30 Cary Coutant <ccoutant@google.com>
6911
6912 * archive.cc (Archive::include_all_members) Correct to step
6913 over symbol table and extended name table in thin archives.
6914
e09ad04a
ILT
69152008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
6916
6917 PR 6407
6918 * target-reloc.h (relocate_for_relocatable): Fix new_offset
6919 calculation.
6920
62b01cb5
ILT
69212008-05-28 Caleb Howe <cshowe@google.com>
6922
6923 * reduced_debug_output.cc: New file.
6924 * reduced_debug_output.h: New file.
92de84a6 6925 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
6926 * options.cc (General_options::finalize): Add strip_debug_non_line
6927 to the strip heirarchy.
6928 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
6929 fields.
6930 * layout.cc: Include "reduced_debug_output.h".
6931 (Layout::Layout): Initialize new fields.
6932 (line_only_debug_sections): New static array.
6933 (is_lines_only_debug_sections): New static inline function.
6934 (Layout::include_section): Handle --strip-debug-non-line.
6935 (Layout::make_output_section): If --strip-debug-non-line, build
6936 new output sections for .debug_abbrev and .debug_info.
6937 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
6938 gold. Warn about possible overflow.
6939 (read_signed_LEB_128): Likewise.
6940 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
6941 (read_signed_LEB_128): Declare.
6942 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
6943 (HFILES): Add reduced_debug_output.h.
6944 * Makefile.in: Rebuild.
6945
7d9e3d98
ILT
69462008-05-21 Ian Lance Taylor <iant@google.com>
6947
6948 * mapfile.cc: New file.
6949 * mapfile.h: New file.
6950 * options.h (class General_options): Add -M/--print-map and -Map.
6951 * options.cc (General_options::finalize): Make -M equivalent to
6952 -Map -.
6953 * main.cc: Include <cstdio> and "mapfile.h".
6954 (main): Open mapfile if requested.
6955 * gold.cc (class Middle_runner): Add mapfile_ field. Update
6956 constructor. Change caller.
6957 (queue_initial_tasks): Add mapfile parameter. Change caller.
6958 (queue_middle_tasks): Likewise.
6959 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
6960 declarations.
6961 * archive.cc: Include "mapfile.h".
6962 (Archive::add_symbols): Add mapfile parameter. Change all
6963 callers. Pass mapfile, symbol, and reason to include_member.
6964 (Archive::include_all_members): Add mapfile parameter. Change all
6965 callers.
6966 (Archive::include_member): Add mapfile, sym, and why parameters.
6967 Change all callers. Report inclusion to map file.
6968 * archive.h: Include "fileread.h".
6969 (class Archive): Update declarations.
6970 (Archive::file): New const method.
6971 (class Add_archive_symbols): Add mapfile_ field. Update
6972 constructor. Change all callers.
6973 * readsyms.h (class Read_symbols): Likewise.
6974 (class Finish_group): Likewise.
6975 (class Read_script): Likewise.
6976 * common.cc: Include "mapfile.h".
6977 (Symbol_table::allocate_commons): Add mapfile parameter. Change
6978 all callers.
6979 (Symbol_table::do_allocate_commons): Likewise.
6980 (Symbol_table::do_allocate_commons_list): Likewise. Report common
6981 symbol allocation to mapfile.
6982 * common.h (class Allocate_commons_task): Add mapfile_ field.
6983 Update constructor. Change all callers.
6984 * symtab.h (class Symbol_table): Update declarations.
6985 * layout.cc: Include "mapfile.h".
6986 (Layout_task_runner::run): Print information to mapfile.
6987 (Layout::create_gold_note): Change Output_data_fixed_space to
6988 Output_data_zero_fill.
6989 (Layout::create_build_id): Likewise.
6990 (Layout::print_to_mapfile): New function.
6991 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
6992 constructor. Change caller.
6993 (class Layout): Declare print_to_mapfile.
6994 * output.cc (Output_section::Input_section::print_to_mapfile): New
6995 function.
6996 (Output_section::add_input_section): If producing a map, always
6997 add to input_sections_ list.
6998 (Output_section::do_print_to_mapfile): New function.
6999 (Output_segment::print_sections_to_mapfile): New function.
7000 (Output_segment::print_section_list_to_mapfile): New function.
7001 * output.h: Include "mapfile.h".
7002 (Output_data::print_to_mapfile): New function.
7003 (Output_data::do_print_to_mapfile): New virtual function.
7004 (Output_segment_headers::do_print_to_mapfile): New function.
7005 (Output_file_header::do_print_to_mapfile): New function.
7006 (Output_data_const::do_print_to_mapfile): New function.
7007 (class Output_data_const_buffer): Add map_name_ field. Update
7008 constructor. Change all callers. Add do_print_to_mapfile
7009 function.
7010 (class Output_data_fixed_space): Likewise.
7011 (class Output_data_space): Likewise.
7012 (class Output_data_zero_fill): New class.
7013 (Output_data_strtab::do_print_to_mapfile): New function.
7014 (Output_data_reloc_base::do_print_to_mapfile): New function.
7015 (Output_relocatable_relocs::do_print_to_mapfile): New function.
7016 (Output_data_group::do_print_to_mapfile): New function.
7017 (Output_data_got::do_print_to_mapfile): New function.
7018 (Output_data_dynamic::do_print_to_mapfile): New function.
7019 (Output_symtab_xindex::do_print_to_mapfile): New function.
7020 (class Output_section): Declare do_print_to_mapflie. Declare
7021 print_to_mapfile in Input_section.
7022 (class Output_segment): Declare new functions.
7023 * object.h (Sized_relobj::symbol_count): New function.
7024 * script-sections.cc
7025 (Output_section_element_dot_assignment::set_section_addresses):
7026 Change Output_data_fixed_space to Output_data_zero_fill.
7027 (Output_data_expression::do_print_to_mapfile): New function.
7028 * script.cc (read_input_script): Add mapfile parameter. Change
7029 all callers.
7030 * script.h (read_input_script): Update declaration.
7031 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
7032 (Eh_frame::do_print_to_mapfile): New function.
7033 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
7034 (Output_merge_string::do_print_to_mapfile): New function.
7035 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
7036 function.
7037 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
7038 function.
7039 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
7040 function.
7041 * Makefile.am (CCFILES): Add mapfile.cc.
7042 (HFILES): Add mapfile.h.
7043 * Makefile.in: Rebuild.
7044
9f1d377b
ILT
70452008-05-19 Ian Lance Taylor <iant@google.com>
7046
7047 * options.h (class General_options): Add -z relro.
7048 * layout.cc (Layout::Layout): Initialize relro_segment_.
7049 (Layout::add_output_section_data): Return the output section.
7050 (Layout::make_output_section): Rcognize relro sections and mark
7051 them appropriately.
7052 (Layout::attach_allocated_section_to_segment): Put relro sections
7053 in a PT_GNU_RELRO segment.
7054 (Layout::create_initial_dynamic_sections): Mark the .dynamic
7055 section as relro.
7056 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
7057 PT_TLS segments.
7058 (Layout::linkonce_mapping): Map d.rel.ro.local to
7059 .data.rel.ro.local.
7060 (Layout::output_section_name): Us .data.rel.ro.local for any
7061 section which begins with that.
7062 * layout.h (class Layout): Update add_output_section_data
7063 declaration. Add relro_segment_ field.
7064 * output.cc (Output_section::Output_section): Initialize is_relro_
7065 and is_relro_local_ fields.
7066 (Output_segment::add_output_section): Group relro sections.
7067 (Output_segment::is_first_section_relro): New function.
7068 (Output_segment::maximum_alignment): If there is a relro section,
7069 align the segment to the common page size.
7070 (Output_segment::set_section_addresses): Track whether we are
7071 looking at relro sections. If the last section is a relro
7072 section, align to the common page size.
7073 (Output_segment::set_section_list_addresses): Add in_relro
7074 parameter. Change all callers. Align to the page size when
7075 moving from relro to non-relro section.
7076 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
7077 segment.
7078 * output.h (class Output_section): Add is_relro_ and
7079 is_relro_local_ fields.
7080 (Output_section::is_relro): New function.
7081 (Output_section::set_is_relro): New function.
7082 (Output_section::is_relro_local): New function.
7083 (Output_section::set_is_relro_local): New function.
7084 (class Output_segment): Update declarations.
7085 * i386.cc (Target_i386::got_section): Mark .got section as relro.
7086 * sparc.cc (Target_sparc::got_section): Likewise.
7087 * x86_64.cc (Target_x86_64::got_section): Likewise.
7088 * testsuite/relro_test_main.cc: New file.
7089 * testsuite/relro_test.cc: New file.
7090 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
7091 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
7092 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
7093 (relro_test.so, relro_test_pic.o): New targets.
7094 * testsuite/Makefile.in: Rebuild.
7095
a984ee1d
ILT
70962008-05-16 Ian Lance Taylor <iant@google.com>
7097
01676dcd
ILT
7098 * output.cc (Output_segment::add_output_section): Remove front
7099 parameter.
7100 * output.h (class Output_segment): Remove
7101 add_initial_output_section and overloaded add_output_section.
7102 Update declaration of remaining add_output_section.
7103 * layout.cc (Layout::create_interp): Call add_output_section
7104 rather than add_initial_output_section.
7105 (Layout::finish_dynamic_section): Likewise.
7106
497897f9
ILT
7107 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
7108 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
7109 know the dynamic type.
7110 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
7111 field. Initialize it in constructor.
7112 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
7113 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
7114 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
7115 reloc.
7116
a984ee1d
ILT
7117 * output.cc (Output_reloc::get_address): Change return type to
7118 Elf_Addr.
7119 * output.h (class Output_reloc): Update get_address declaration.
7120 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
7121 for section addresses.
7122
55ba0940
ILT
71232008-05-09 Ian Lance Taylor <iant@google.com>
7124
7125 PR 6493
7126 * gold.cc (gold_nomem): Use return value of write.
7127
75517b77
ILT
71282008-05-08 Ian Lance Taylor <iant@google.com>
7129
7130 * symtab.c (Symbol::init_base_output_data): Add version
7131 parameter. Change all callers.
7132 (Symbol::init_base_output_segment): Likewise.
7133 (Symbol::init_base_constant): Likewise.
7134 (Symbol::init_base_undefined): Likewise.
7135 (Sized_symbol::init_output_data): Likewise.
7136 (Sized_symbol::init_output_segment): Likewise.
7137 (Sized_symbol::init_constant): Likewise.
7138 (Sized_symbol::init_undefined): Likewise.
7139 (Symbol_table::do_define_in_output_data): If the new symbol has a
7140 version, mark it as the default.
7141 (Symbol_table::do_define_in_output_segment): Likewise.
7142 (Symbol_table::do_define_as_constant): Likewise.
7143 * symtab.h (class Symbol): Update declarations.
7144 (class Sized_symbol): Likewise.
7145 * resolve.cc (Symbol::override_version): New function.
c42e122e 7146 (Symbol::override_base): Call override_version.
75517b77
ILT
7147 (Symbol::override_base_with_special): Likewise.
7148 * testsuite/ver_script_8.script: New file.
7149 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
7150 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
7151 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
7152 (ver_test_8_1.so, ver_test_8_2.so): New targets.
7153
f1f70eae
ILT
71542008-05-06 Ian Lance Taylor <iant@google.com>
7155
f3e9c5c5
ILT
7156 PR 6049
7157 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
7158 functions.
7159 (class General_options): Remove existing --undefined, and add
7160 --no-undefined instead. Add new --undefined as synonym for -u.
7161 * archive.cc (Archive::add_symbols): Check whether symbol was
7162 named with -u.
7163 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
7164 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
7165 all uses. Add IS_UNDEFINED. Update declarations to split
7166 different versions of init_base. Declare init_base_undefined.
7167 (Symbol::is_defined): Handle IS_UNDEFINED.
7168 (Symbol::is_undefined): Likewise.
7169 (Symbol::is_weak_undefined): Call is_undefined.
7170 (Symbol::is_absolute): Handle IS_CONSTANT.
7171 (class Sized_symbol): Update declarations to split different
7172 versions of init. Declare init_undefined.
7173 (class Symbol_table): Declare new functions.
7174 * symtab.cc (Symbol::init_base_object): Rename from init_base.
7175 Change all callers.
7176 (Symbol::init_base_output_data): Likewise.
7177 (Symbol::init_base_output_segment): Likewise.
7178 (Symbol::init_base_constant): Likewise.
7179 (Symbol::init_base_undefined): New function.
7180 (Sized_symbol::init_object): Rename from init. Change all
7181 callers.
7182 (Sized_symbol::init_output_data): Likewise.
7183 (Sized_symbol::init_output_segment): Likewise.
7184 (Sized_symbol::init_constant): Likewise.
7185 (Sized_symbol::init_undefined): New function.
7186 (Symbol_table::add_undefined_symbols_from_command_line): New
7187 function.
7188 (Symbol_table::do_add_undefined_symbols_from_command_line): New
7189 function.
7190 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
7191 (Symbol::output_section): Likewise.
7192 (Symbol::set_output_section): Likewise.
7193 (Symbol_table::sized_finalize_symbol): Likewise.
7194 (Symbol_table::sized_write_globals): Likewise.
7195 * resolve.cc (Symbol_table::should_override): Likewise.
7196 (Symbol::override_base_with_special): Likewise.
7197
8bdcdf2c
ILT
7198 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
7199 symbol, change it to have default visibility.
7200 * testsuite/protected_1.cc: New file.
7201 * testsuite/protected_2.cc: New file.
7202 * testsuite/protected_3.cc: New file.
7203 * testsuite/protected_main_1.cc: New file.
7204 * testsuite/protected_main_2.cc: New file.
7205 * testsuite/protected_main_3.cc: New file.
7206 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
7207 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
7208 (protected_1_LDFLAGS, protected_1_LDADD): Define.
7209 (protected_1.so): New target.
7210 (protected_1_pic.o, protected_2_pic.o): New targets.
7211 (protected_3_pic.o): New target.
7212 (check_PROGRAMS): Add protected_2.
7213 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
7214 (protected_2_LDFLAGS, protected_2_LDADD): Define.
7215 * testsuite/Makefile.in: Rebuild.
7216
2b706932
ILT
7217 * options.h (DEFINE_var): Add set_user_set_##varname__.
7218 (DEFINE_bool_alias): New macro.
7219 (class General_options): Define -Bstatic using DEFINE_bool_alias
7220 rather than DEFINE_special. Add --undefined as an alias for -z
7221 defs.
7222 * options.cc (General_options::parse_Bstatic): Remove.
7223
d82a5bcc
ILT
7224 * options.h (class General_options): Add --fatal-warnings.
7225 * main.cc (main): Implement --fatal-warnings.
7226 * errors.h (Errors::warning_count): New function.
7227
f1f70eae
ILT
7228 * options.h (class General_options): Add -Bsymbolic-functions.
7229 * symtab.h (Symbol::is_preemptible): Check for
7230 -Bsymbolic-functions.
7231
8825ac63
ILT
72322008-05-05 Ian Lance Taylor <iant@google.com>
7233
d98bc257
ILT
7234 * options.h (DEFINE_bool): For DASH_Z, create the negative option
7235 as noVARNAME rather than no-VARNAME.
7236 (class General_options): Add option -z combreloc.
7237 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
7238 get_address.
7239 (Output_reloc::sort_before) [SHT_REL]: New function.
7240 (Output_reloc::sort_before) [SHT_RELA]: New function.
7241 (class Output_data_reloc_base): Add sort_relocs_ field. Define
7242 Sort_relocs_comparison.
7243 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
7244 parameter. Change all callers.
7245 (Output_data_reloc::Output_data_reloc) [both versions]: Add
7246 sort_relocs parameter. Change all callers.
7247 * output.cc (Output_reloc::get_address): New function, broken out
7248 of write_rel.
7249 (Output_reloc::write_rel): Call it.
7250 (Output_reloc::compare): New function.
7251 (Output_data_reloc_base::do_write): Optionally sort relocs.
7252
60b2b4e7
ILT
7253 * configure.ac: If targ_extra_obj is set, link it in.
7254 * configure.tgt: Initialize all variables.
7255 (x86_64*): Set targ_extra_obj and targ_extra_size.
7256 * configure: Rebuild.
7257
8825ac63
ILT
7258 * object.cc (Sized_relobj::include_section_group): Adjust section
7259 indexes read from group data. Build vector to pass to
7260 layout_group.
7261 * layout.cc (Layout::layout_group): Add flags and shndxes
7262 parameters. Remove contents parameter. Change caller. Update
7263 explicit instantiations.
7264 * layout.h (class Layout): Update layout_group declaration.
7265 * output.cc (Output_data_group::Output_data_group): Add flags and
7266 input_shndxes parameters. Remove contents parameter. Change
7267 caller.
7268 (Output_data_group::do_write): Change input_sections_ to
7269 input_shndxes_.
7270 * output.h (class Output_data_group): Update constructor
7271 declaration. Rename input_sections_ to input_shndxes_.
7272 * testsuite/many_sections_test.cc: Add template.
7273
e94cf127
CC
72742008-04-30 Cary Coutant <ccoutant@google.com>
7275
4418b2d5
CC
7276 * target-reloc.h (relocate_section): Fix dead-pointer bug.
7277
e94cf127
CC
7278 * layout.cc (Layout::include_section): Refactored check for debug
7279 info section.
7280 (Layout::add_comdat): Add new parameters. Change type
7281 of signature parameter. Add object and shndx to signatures table.
7282 (Layout::find_kept_object): New function.
7283 * layout.h: Include <cstring>.
7284 (Layout::is_debug_info_section): New function.
7285 (Layout::add_comdat): Add new parameters.
7286 (Layout::find_kept_object): New function.
7287 (Layout::Kept_section): New struct.
7288 (Layout::Signatures): Change type of map range.
7289 * object.cc (Relobj::output_section_address): New function.
7290 (Sized_relobj::include_section_group): Add new parameters. Change
7291 calls to Layout::add_comdat. Change to build table of kept comdat
7292 groups and table mapping discarded sections to kept sections.
7293 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
7294 (Sized_relobj::do_layout): Change calls to include_section_group and
7295 include_linkonce_section.
7296 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
7297 value to zero when section is discarded.
7298 (Sized_relobj::map_to_kept_section): New function.
7299 * object.h (Relobj::output_section_address): New function.
7300 (Relobj::Comdat_group): New type.
7301 (Relobj::find_comdat_group): New function.
7302 (Relobj::Comdat_group_table): New type.
7303 (Relobj::Kept_comdat_section): New type.
7304 (Relobj::Kept_comdat_section_table): New type.
7305 (Relobj::add_comdat_group): New function.
7306 (Relobj::set_kept_comdat_section): New function.
7307 (Relobj::get_kept_comdat_section): New function.
7308 (Relobj::comdat_groups_): New field.
7309 (Relobj::kept_comdat_sections_): New field.
7310 (Symbol_value::input_value): Update comment.
7311 (Sized_relobj::map_to_kept_section) New function.
7312 (Sized_relobj::include_linkonce_section): Add new parameter.
7313 * target-reloc.h (Comdat_behavior): New type.
7314 (get_comdat_behavior): New function.
7315 (relocate_section): Add code to map a discarded section to the
7316 corresponding kept section when applying a relocation.
7317
e4e5049b
CS
73182008-04-30 Craig Silverstein <csilvers@google.com>
7319
7320 * dwarf_reader.cc (next_generation_count): New static var.
7321 (Addr2line_cache_entry): New struct.
7322 (addr2line_cache): New static var.
7323 (Dwarf_line_info::one_addr2line): Added caching.
7324 (Dwarf_line_info::clear_addr2line_cache): New function.
7325 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
7326 cache-size parameter.
7327 (Dwarf_line_info::one_addr2line_cache): New function.
7328 * symtab.cc (Symbol_table::detect_odr_violations): Pass
7329 new cache-size argument to one_addr2line(), and clear cache.
7330
d09e9154
CC
73312008-04-28 Cary Coutant <ccoutant@google.com>
7332
7333 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
7334 R_386_PC8 relocations.
7335
7ef73768
ILT
73362008-04-23 Ian Lance Taylor <iant@google.com>
7337
55438702
ILT
7338 * object.cc (Sized_relobj::include_section_group): Check for
7339 invalid section group.
7340
c165fb93
ILT
7341 * object.cc (make_elf_object): Correct test for 64-bit ELF file
7342 header size.
7343
7ef73768
ILT
7344 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
7345 than read for file header.
7346 * archive.cc (Archive::include_member): Likewise.
7347
6194aaab
L
73482008-04-23 Paolo Bonzini <bonzini@gnu.org>
7349
7350 * aclocal.m4: Regenerate.
7351 * configure: Regenerate.
7352
d491d34e
ILT
73532008-04-19 Ian Lance Taylor <iant@google.com>
7354
5ea2bac6
ILT
7355 * version.cc (version_string): Bump to 1.6.
7356
7bc3e21a
ILT
7357 * testsuite/Makefile.am (many_sections_r_test): New target.
7358 (many_sections_r_test_SOURCES): Remove.
7359 (many_sections_r_test_DEPENDENCIES): Remove.
7360 (many_sections_r_test_LDFLAGS): Remove.
7361 (many_sections_r_test_LDADD): Remove.
7362
7fcd3aa9
ILT
7363 * object.cc (Sized_relobj::do_add_symbols): Always pass
7364 local_symbol_count_ to add_from_relobj.
7365
4c94d6ae
ILT
7366 * testsuite/Makefile.am (many_sections_check.h): Only check one in
7367 every thousand variables.
7368 * testsuite/Makefile.in: Rebuild.
7369
d491d34e
ILT
7370 * object.cc (Xindex::initialize_symtab_xindex): New function.
7371 (Xindex::read_symtab_xindex): New function.
7372 (Xindex::sym_xindex_to_shndx): New function.
7373 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
7374 available.
7375 (Sized_relobj::do_initialize_xindex): New function.
7376 (Sized_relobj::do_read_symbols): Adjust section links.
7377 (Sized_relobj::symbol_section_and_value): Add is_ordinary
7378 parameter. Change all callers.
7379 (Sized_relobj::include_section_group): Adjust section links and
7380 symbol section indexes.
7381 (Sized_relobj::do_layout): Adjust section links.
7382 (Sized_relobj::do_count_local_symbols): Adjust section links and
7383 symbol section indexes.
7384 (Sized_relobj::do_finalize_local_symbols): Distinguish between
7385 ordinary and special symbols.
7386 (Sized_relobj::write_local_symbols): Add symtab_xindex and
7387 dynsym_xindex parameters. Change all callers. Adjust section
7388 links. Use SHN_XINDEX when needed.
7389 (Sized_relobj::get_symbol_location_info): Adjust section links.
7390 Don't get fooled by special symbols.
7391 * object.h (class Xindex): Define.
7392 (class Object): Add xindex_ parameter. Declare virtual functoin
7393 do_initialize_xindex.
7394 (Object::adjust_sym_shndx): New function.
7395 (Object::set_xindex): New protected function.
7396 (class Symbol_value): Add is_ordinary_shndx_ field.
7397 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
7398 (Symbol_value::value): Assert ordinary section.
7399 (Symbol_value::initialize_input_to_output_map): Likewise.
7400 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
7401 Change all callers.
7402 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
7403 all callers.
7404 (class Sized_relobj): Update declarations.
7405 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
7406 parameter. Change all callers.
7407 (Sized_relobj::adjust_shndx): New function.
7408 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
7409 field.
7410 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
7411 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
7412 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
7413 (Sized_dynobj::read_dynsym_section): Adjust section links.
7414 (Sized_dynobj::read_dynamic): Likewise.
7415 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
7416 section links.
7417 (Sized_dynobj::do_initialize_xindex): New function.
7418 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
7419 do_initialize_xindex.
7420 (Sized_dynobj::adjust_shndx): New function.
7421 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
7422 dynsym_xindex_ fields.
7423 (Layout::finalize): Add a call to set_section_indexes before
7424 creating the symtab sections.
7425 (Layout::set_section_indexes): Don't do anything if the section
7426 already has a section index.
7427 (Layout::create_symtab_sections): Add shnum parameter. Change
7428 caller. Create .symtab_shndx section if needed.
7429 (Layout::create_shdrs): Add shstrtab_section parameter. Change
7430 caller.
7431 (Layout::allocated_output_section_count): New function.
7432 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
7433 needed.
7434 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
7435 fields. Update declarations.
7436 (Layout::symtab_xindex): New function.
7437 (Layout::dynsym_xindex): New function.
7438 (class Write_symbols_task): Add layout_ field.
7439 (Write_symbols_task::Write_symbols_task): Add layout parameter.
7440 Change caller.
7441 * output.cc (Output_section_headers::Output_section_headers): Add
7442 shstrtab_section parameter. Change all callers.
7443 (Output_section_headers::do_sized_write): Store overflow values
7444 for section count and section string table section index in
7445 section header zero.
7446 (Output_file_header::do_sized_write): Check for overflow of
7447 section count and section string table section index.
7448 (Output_symtab_xindex::do_write): New function.
7449 (Output_symtab_xindex::endian_do_write): New function.
7450 * output.h (class Output_section_headers): Add shstrtab_section_.
7451 Update declarations.
7452 (class Output_symtab_xindex): Define.
7453 (Output_section::has_out_shndx): New function.
7454 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
7455 field.
7456 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
7457 Change all callers.
7458 (Sized_symbol::init): Likewise.
7459 (Symbol::output_section): Check for ordinary symbol.
7460 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
7461 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
7462 callers.
7463 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
7464 Change all callers. Simplify handling of symbols from sections
7465 not included in the link.
7466 (Symbol_table::add_from_dynobj): Handle ordinary symbol
7467 distinction.
7468 (Weak_alias_sorter::operator()): Assert that symbols are
7469 ordinary.
7470 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
7471 distinction.
7472 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
7473 parameters. Change all callers.
7474 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
7475 symbol distinction. Use SHN_XINDEX when needed.
7476 (Symbol_table::write_section_symbol): Add symtab_xindex
7477 parameter. Change all callers.
7478 (Symbol_table::sized_write_section_symbol): Likewise. Use
7479 SHN_XINDEX when needed.
7480 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
7481 declarations.
7482 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
7483 (Symbol::is_defined): Check is_ordinary.
7484 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
7485 (Symbol::is_absolute, Symbol::is_common): Likewise.
7486 (class Sized_symbol): Update declarations.
7487 (class Symbol_table): Update declarations.
7488 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
7489 parameters. Change all callers.
7490 (Sized_symbol::override): Likewise.
7491 (Symbol_table::override): Likewise.
7492 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
7493 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
7494 is_ordinary, and orig_st_shndx parameters. Change all callers.
7495 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
7496 to be in an ordinary section.
7497 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
7498 object and is_ordinary parameters. Change all callers.
7499 (Sized_dwarf_line_info::read_relocs): Add object parameter.
7500 Change all callers. Don't add undefined or non-ordinary symbols
7501 to reloc_map_.
7502 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
7503 Change all callers.
7504 * dwarf_reader.h (class Sized_dwarf_line_info): Update
7505 declarations.
7506 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
7507 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
7508 (Sized_relobj::relocate_sections): Likewise.
7509 * target-reloc.h (scan_relocs): Adjust section symbol index.
7510 (scan_relocatable_relocs): Likewise.
7511 * i386.cc (Scan::local): Check for ordinary symbols.
7512 * sparc.cc (Scan::local): Likewise.
7513 * x86_64.cc (Scan::local): Likewise.
7514 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
7515 to symbol_section_and_value.
7516 * testsuite/many_sections_test.cc: New file.
7517 * testsuite/Makefile.am (BUILT_SOURCES): Define.
7518 (check_PROGRAMS): Add many_sections_test.
7519 (many_sections_test_SOURCES): Define.
7520 (many_sections_test_DEPENDENCIES): Define.
7521 (many_sections_test_LDFLAGS): Define.
7522 (BUILT_SOURCES): Add many_sections_define.h.
7523 (many_sections_define.h): New target.
7524 (BUILT_SOURCES): Add many_sections_check.h.
7525 (many_sections_check.h): New target.
7526 (check_PROGRAMS): Add many_sections_r_test.
7527 (many_sections_r_test_SOURCES): Define.
7528 (many_sections_r_test_DEPENDENCIES): Define.
7529 (many_sections_r_test_LDFLAGS): Define.
7530 (many_sections_r_test_LDADD): Define.
7531 (many_sections_r_test.o): New target.
7532 * testsuite/Makefile.in: Rebuild.
7533
c5818ff1
CC
75342008-04-17 Cary Coutant <ccoutant@google.com>
7535
7536 * errors.cc (Errors::info): New function.
7537 (gold_info): New function.
7538 * errors.h (Errors::info): New function.
7539 * gold.h (gold_info): New function.
7540 * object.cc (Input_objects::add_object): Print trace output.
7541 * options.cc (options::parse_set): New function.
7542 (General_options::parse_wrap): Deleted.
7543 (General_options::General_options): Deleted initializer.
7544 * options.h (options::String_set): New typedef.
7545 (options::parse_set): New function.
7546 (DEFINE_set): New macro.
7547 (General_options::wrap): Changed to use DEFINE_set. Changed
7548 callers of any_wrap_symbols and is_wrap_symbol.
7549 (General_options::trace, General_options::trace_symbol):
7550 New options.
7551 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
7552 (General_options::wrap_symbols_): Deleted.
7553 * symtab.cc (Symbol_table::add_from_object): Print trace output.
7554
b5be4a7c
DM
75552008-04-17 David S. Miller <davem@davemloft.net>
7556
7557 * options.cc (General_options::parse_V): New function.
7558 * options.h: Add entries for -V and -Qy.
7559
155a0dd7
ILT
75602008-04-17 Ian Lance Taylor <iant@google.com>
7561
7562 * common.cc (Symbol_table::allocate_commons): Remove options
7563 parameter. Change caller.
7564 (Symbol_table::do_allocate_commons): Remove options parameter.
7565 Change caller. Just call do_allocate_commons_list twice.
7566 (Symbol_table::do_allocate_commons_list): New function, broken out
7567 of do_allocate_commons.
7568 * common.h (class Allocate_commons_task): Remove options_ field.
7569 Update constructor.
7570 * symtab.cc (Symbol_table::Symbol_table): Initialize
7571 tls_commons_.
7572 (Symbol_table::add_from_object): Put TLS common symbols on
7573 tls_commons_ list.
7574 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
7575 which are IN_OUTPUT_DATA.
7576 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
7577 allocate_commons and do_allocate_commons declarations. Declare
7578 do_allocate_commons_list.
7579 * gold.cc (queue_middle_tasks): Update creation of
7580 Allocate_commons_task to not pass options.
7581 * testsuite/Makefile.am (INCLUDES): Add -I.. .
7582 (TLS_TEST_C_FLAGS): New variable.
7583 (tls_test_c_pic.o): New target.
7584 (tls_test_shared.so): Link in tls_test_c_pic.o.
7585 (tls_test_c_pic_ie.o): New target.
7586 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
7587 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
7588 (tls_test_c.o): New target.
7589 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
7590 (tls_pic_test_LDADD): Likewise.
7591 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
7592 (tls_shared_gd_to_ie_test_LDADD): Likewise.
7593 (tls_test_c_gnu2.o): New target.
7594 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
7595 tls_test_c_gnu2.o.
7596 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
7597 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
7598 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
7599 * testsuite/tls_test.cc: Include "config.h".
7600 (t_last): Call t11_last.
7601 * testsuite/tls_test.h (t11, t11_last): Declare.
7602 * testsuite/tls_test_c.c: New file.
7603 * testsuite/tls_test_main.cc (thread_routine): Call t11.
7604 * configure.ac: Check for OpenMP support.
7605 * configure, config.in, Makefile.in: Rebuild.
7606 * testsuite/Makefile.in: Rebuild.
7607
edfbb029
CC
76082008-04-16 Cary Coutant <ccoutant@google.com>
7609
7610 * i386.cc (Target_i386::define_tls_base_symbol): New function.
7611 (Target_i386::tls_base_symbol_defined_): New field.
7612 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7613 (Target_i386::Scan::global): Likewise.
7614 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
7615 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
7616 (Target_x86_64::tls_base_symbol_defined_): New field.
7617 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7618 (Target_x86_64::Scan::global): Likewise.
7619
f3c69fca
CC
76202008-04-16 Cary Coutant <ccoutant@google.com>
7621
7622 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
7623 (Symbol::needs_plt_entry): Allow weak undefined symbols.
7624 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
7625 building shared libraries.
7626 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
7627 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
7628 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
7629 * testsuite/Makefile.in: Rebuild.
7630 * testsuite/weak_undef.h: New file.
7631 * testsuite/weak_undef_file1.cc: Add extra test cases.
7632 * testsuite/weak_undef_file2.cc: Likewise.
7633 * testsuite/weak_undef_test.cc: Likewise.
7634
7c414435
DM
76352008-04-16 David S. Miller <davem@davemloft.net>
7636
32b769e1
DM
7637 * sparc.cc (Target_sparc::Scan): Change from struct to class.
7638 Add issued_non_pic_error_ field. Declare check_non_pic.
7639 (Target_sparc::Scan::check_non_pic): New function.
7640 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
7641 (Target_sparc::Scan::global): Likewise.
7642
11936fb1
DM
7643 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
7644 * configure: Rebuild.
7645
7c414435
DM
7646 * options.h (DEFINE_enable): New macro.
7647 (new_dtags): New enable option.
7648 (initfirst, interpose, loadfltr, nodefaultlib,
7649 nodelete, nodlopen, nodump): New -z options.
7650 * layout.cc (Layout:finish_dynamic_section): If new
7651 dtags enabled, emit DT_RUNPATH. Also, emit a
7652 DT_FLAGS_1 containing any specified -z flags.
7653
85c7bf8b
ILT
76542008-04-16 Ian Lance Taylor <iant@google.com>
7655
12c0daef
ILT
7656 * copy-relocs.cc: New file.
7657 * copy-relocs.h: New file.
7658 * reloc.cc: Remove Copy_relocs code.
7659 * reloc.h: Likewise.
7660 * reloc-types.h (struct Reloc_types) [both versions]: Add
7661 get_reloc_addend_noerror.
7662 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
7663 variants of add_global which take an addend which must be zero.
7664 * i386.cc: Include "copy-relocs.h".
7665 (class Target_i386): Change type of copy_relocs_ to variable,
7666 update initializer.
7667 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
7668 Change all callers.
7669 (Target_i386::do_finalize_sections): Change handling of
7670 copy_relocs_.
7671 * sparc.cc: Include "copy-relocs.h".
7672 (class Target_sparc): Change type of copy_relocs_ to variable,
7673 update initializer.
7674 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
7675 Change all callers.
7676 (Target_sparc::do_finalize_sections): Change handling of
7677 copy_relocs_.
7678 * x86_64.cc: Include "copy-relocs.h".
7679 (class Target_x86_64): Change type of copy_relocs_ to variable,
7680 update initializer.
7681 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
7682 class. Change all callers.
7683 (Target_x86_64::do_finalize_sections): Change handling of
7684 copy_relocs_.
7685 * Makefile.am (CCFILES): Add copy-relocs.cc.
7686 (HFILES): Add copy-relocs.h.
7687
4f4995b6
ILT
7688 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
7689
85c7bf8b
ILT
7690 * testsuite/script_test_4.sh: Permit leading zeroes.
7691
4f2a9edd
ILT
76922008-04-15 Ian Lance Taylor <iant@google.com>
7693
e6188289
ILT
7694 * script-sections.cc (Script_sections::create_segments): Use
7695 header_size_adjustment even when there is enough room for the
7696 headers.
7697 * testsuite/script_test_4.sh: New file.
7698 * testsuite/script_test_4.t: New file.
7699 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
7700 (check_DATA): Add script_test_4.stdout.
7701 (MOSTLYCLEANFILES): Likewise.
7702 (script_test_4): New target.
7703 (script_test_4.stdout): New target.
7704 * testsuite/Makefile.in: Rebuild.
7705
4f2a9edd
ILT
7706 * sparc.cc: Add definitions for Output_data_plt_sparc class
7707 constants.
7708
f5314dd5
DM
77092008-04-14 David S. Miller <davem@davemloft.net>
7710
7711 * sparc.cc: New file.
7712 * Makefile.am (TARGETSOURCES): Add sparc.cc
7713 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
7714 * configure.tgt: Document targ_extra_size and
7715 targ_extra_big_endian. Add entries for sparc-* and
7716 sparc64-*.
7717 * configure.ac: Handle targ_extra_size and
7718 targ_extra_big_endian.
7719 * Makefile.in: Rebuild.
7720 * configure: Likewise.
7721 * po/POTFILES.in: Likewise.
7722 * po/gold.pot: Likewise.
7723
154e0e9a
ILT
77242008-04-14 Ian Lance Taylor <iant@google.com>
7725
7726 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
7727 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
7728 in the name/type/flags to section mapping. Don't call
7729 allocate_output_section.
7730 (Layout::choose_output_section): Change parameter from adjust_name
7731 to is_input_section. Don't permit input sections after sections
7732 are attached to segments. Don't call allocate_output_section.
7733 (Layout::layout_eh_frame): Call update_flags_for_input_section,
7734 not write_enable_output_section.
7735 (Layout::make_output_section): Don't push to
7736 unattached_section_list_ nor call attach_to_segment. Call
7737 attach_section_to_segment if sections are attached.
7738 (Layout::attach_sections_to_segments): New function.
7739 (Layout::attach_section_to_segment): New function.
7740 (Layout::attach_allocated_section_to_segment): Rename from
7741 attach_to_segment. Remove flags parameter.
7742 (Layout::allocate_output_section): Remove function.
7743 (Layout::write_enable_output_section): Remove function.
7744 * layout.h (class Layout): Update for above changes. Add new
7745 field sections_are_attached_.
7746 * output.h (Output_section::update_flags_for_input_section): New
7747 function.
7748 * output.cc (Output_section::add_input_section): Call
7749 update_flags_for_input_section.
7750 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
7751
009a67a2
CC
77522008-04-11 Cary Coutant <ccoutant@google.com>
7753
7754 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
7755 thought unnecessary.
7756 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
7757
759b1a24
ILT
77582008-04-11 Ian Lance Taylor <iant@google.com>
7759
7760 * output.h (class Output_section_data): Remove inline definition
7761 of set_addralign.
7762 * output.cc (Output_section_data::set_addralign): New function.
7763
c2b45e22
CC
77642008-04-11 Cary Coutant <ccoutant@google.com>
7765
7766 Add support for TLS descriptors for i386 and x86_64.
7767 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
7768 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
7769 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
7770 GOT_TYPE_TLS_DESC.
7771 (Target_i386::got_mod_index_entry): Remove unnecessary code.
7772 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
7773 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
7774 relocations.
7775 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
7776 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
7777 Fix problem with initial-exec relocations.
7778 (Target_i386::Relocate::relocate_tls): Likewise.
7779 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
7780 relaxation.
7781 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
7782 support for section-plus-offset dynamic table entries.
7783 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
7784 (Output_data_dynamic::Dynamic_entry): Add support for
7785 section-plus-offset dynamic table entries.
7786 (Output_data_dynamic::Classification): Likewise.
7787 (Output_data_dynamic::classification_): Renamed offset_.
7788 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
7789 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
7790 (Target_x86_64::make_plt_section): New function.
7791 (Target_x86_64::reserve_tlsdesc_entries): New function.
7792 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
7793 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
7794 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
7795 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
7796 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
7797 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
7798 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
7799 add extra PLT entry for TLS descriptors.
7800 (Output_data_plt_x86_64::got_): New field.
7801 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
7802 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
7803 fields.
7804 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
7805 descriptors.
7806 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
7807 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
7808 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
7809 R_386_TLS_DESC_CALL relocations.
7810 (Target_x86_64::Scan::global): Likewise.
7811 (Target_x86_64::do_finalize_sections): Add dynamic table entries
7812 for TLS descriptors.
7813 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
7814 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
7815 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
7816 GD-to-IE relaxation.
7817 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
7818 and TLS_DESCRIPTORS.
7819 * Makefile.in: Rebuild.
7820 * configure: Rebuild.
7821 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
7822 (tls_test_shared2.so): New target.
7823 (tls_shared_gd_to_ie_test_SOURCES): New variable.
7824 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
7825 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
7826 (tls_shared_gd_to_ie_test_LDADD): New variable.
7827 (tls_shared_gnu2_gd_to_ie_test): New target.
7828 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
7829 New targets.
7830 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
7831 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
7832 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
7833 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
7834 (tls_shared_gnu2_test): New target.
7835 (tls_test_gnu2_shared.so): New target.
7836 (tls_shared_gnu2_test_SOURCES): New variable.
7837 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
7838 (tls_shared_gnu2_test_LDFLAGS): New variable.
7839 (tls_shared_gnu2_test_LDADD): New variable.
7840 * testsuite/Makefile.in: Rebuild.
7841 * testsuite/Makefile.
7842
83bfb6b7
ILT
78432008-04-11 Ian Lance Taylor <iant@google.com>
7844
7845 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
7846 justsyms.t.
7847 * testsuite/Makefile.in: Rebuild.
7848
7849 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
7850 long.
7851 * testsuite/script_test_2.cc (main): Adjust test.
7852
706e1f5e
ILT
78532008-04-11 David S. Miller <davem@davemloft.net>
7854 Ian Lance Taylor <iant@google.com>
7855
7856 * options.h (General_options): Add entries for '-Y' and
7857 '-relax'.
7858 * options.cc (General_options:finalize): If -Y was used, add those
7859 entries to the library path instead of the default "/lib" and
7860 "/usr/lib".
7861
7c98e6bb
DM
78622008-04-11 David S. Miller <davem@davemloft.net>
7863
7864 * testsuite/justsyms.t: Start at 0x100.
7865 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
7866 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
7867 long.
7868 * testsuite/script_test_2.cc: Adjust string and section length
7869 checks.
7c98e6bb 7870
99a37bfd
ILT
78712008-04-09 Ian Lance Taylor <iant@google.com>
7872
2cefc357
ILT
7873 PR gold/5996
7874 * script-sections.cc (Sections_element::allocate_to_segment): Add
7875 orphan parameter.
7876 (Output_section_definition::allocate_to_segment): Likewise.
7877 (Orphan_output_section::allocate_to_segment): Likewise.
7878 (Script_sections::attach_sections_using_phdrs_clause): Don't
7879 propagate non-PT_LOAD segments to orphan sections.
7880 * testsuite/Makefile.am (script_test_3.stdout): Generate using
7881 readelf rather than objdump.
7882 * testsuite/script_test_3.sh: Adjust accordingly. Test that
7883 .interp section and PT_INTERP segment are the same size.
7884 * testsuite/Makefile.in: Rebuild.
7885
99a37bfd
ILT
7886 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
7887 aliases for symbols defined in the same object.
7888 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
7889 (weak_alias_test_SOURCES): New variable.
7890 (weak_alias_test_DEPENDENCIES): New variable.
7891 (weak_alias_test_LDFLAGS): New variable.
7892 (weak_alias_test_LDADD): New variable.
7893 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
7894 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
7895 (weak_alias_test_3.o): New target.
7896 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
7897 * testsuite/weak_alias_test_main.cc: New file.
7898 * testsuite/weak_alias_test_1.cc: New file.
7899 * testsuite/weak_alias_test_2.cc: New file.
7900 * testsuite/weak_alias_test_3.cc: New file.
7901
780e49c5
ILT
79022008-04-08 Ian Lance Taylor <iant@google.com>
7903
cdb0b8f5
ILT
7904 * options.h (class General_options): Add --noinhibit-exec option.
7905 * main.cc (main): Check --noinhibit-exec.
7906
0864d551
ILT
7907 * options.h (class General_options): Define --wrap as a special
7908 option. Add wrap_symbols_ field.
7909 (General_options::any_wrap_symbols): New function.
7910 (General_options::is_wrap_symbol): New function.
7911 * options.cc (General_options::parse_wrap): New function.
7912 (General_options::General_options): Initialize wrap_symbols_.
7913 * symtab.cc (Symbol_table::wrap_symbol): New function.
7914 (Symbol_table::add_from_object): Handle --wrap.
7915 * symtab.h (class Symbol_table): Declare wrap_symbol.
7916 * target.h (Target::wrap_char): New function.
7917 (Target::Target_info): Add wrap_char field.
7918 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
7919 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7920 * testsuite/testfile.cc (Target_test::test_target_info):
7921 Likewise.
7922
789aa6de
ILT
7923 * errors.cc (Errors::undefined_symbol): Mention symbol version if
7924 there is one.
7925
2c38906f
ILT
7926 * layout.h (class Layout): Add added_eh_frame_data_ field.
7927 * layout.cc (Layout::Layout): Initialize new field.
7928 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
7929 output section until we find a section we merged successfully.
7930 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
7931 that the size be non-zero.
7932
780e49c5
ILT
7933 * merge.cc (Object_merge_map::get_output_offset): Remove inline
7934 qualifier.
7935
7fcd0256
ILT
79362008-04-08 Craig Silverstein <csilvers@google.com>
7937
7938 * configure.ac: Export new conditional variable HAVE_ZLIB.
7939 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
7940 on HAVE_ZLIB.
7941 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
7942 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
7943
6835af53
ILT
79442008-04-07 Ian Lance Taylor <iant@google.com>
7945
e24f324c
ILT
7946 * version.cc (version_string): Set to "1.5".
7947
a036edd8
ILT
7948 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
7949 Add issued_non_pic_error_ field. Declare check_non_pic.
7950 (Target_x86_64::Scan::check_non_pic): New function.
7951 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
7952 (Target_x86_64::Scan::global): Likewise.
7953
624f8810
ILT
7954 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
7955 addend parameter. Change caller. Handle merge sections.
7956 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
7957 Address to Addend. Don't add in the result of
7958 local_section_offset, pass down the addend and use the returned
7959 value.
7960 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
7961 Update declarations of local_section_offset and symbol_value.
7962 * testsuite/two_file_test_1.cc (t18): New function.
7963 * testsuite/two_file_test_2.cc (f18): New function.
7964 * testsuite/two_file_test_main.cc (main): Call t18.
7965 * testsuite/two_file_test.h (t18, f18): Declare.
7966
6835af53
ILT
7967 * configure.ac: Don't test for objdump, c++filt, or readelf.
7968 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
7969 conditionals.
7970 (TEST_READELF): New variable.
7971 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
7972 (check_PROGRAMS): Add two_file_strip_test.
7973 (two_file_strip_test): New target.
7974 (check_PROGRAMS): Add two_file_same_shared_strip_test.
7975 (two_file_same_shared_strip_test_SOURCES): New variable.
7976 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
7977 (two_file_same_shared_strip_test_LDFLAGS): New variable.
7978 (two_file_same_shared_strip_test_LDADD): New variable.
7979 (two_file_shared_strip.so): New target.
7980 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
7981 (ver_test_5.syms, ver_test_7.syms): Likewise.
7982 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
7983 (strip_test_3.stdout): Use TEST_OBJDUMP.
7984 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
7985
86925eef
CC
79862008-04-04 Cary Coutant <ccoutant@google.com>
7987
7988 * symtab.h (Symbol::is_weak_undefined): New function.
7989 (Symbol::is_strong_undefined): New function.
7990 (Symbol::is_absolute): New function.
7991 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
7992 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
7993 absolute symbols.
7994 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
7995 (weak_undef_test): New target.
7996 * testsuite/Makefile.in: Rebuild.
7997 * testsuite/weak_undef_file1.cc: New file.
7998 * testsuite/weak_undef_file2.cc: New file.
7999 * testsuite/weak_undef_test.cc: New file.
8000
126f3ece
ILT
80012008-04-03 Craig Silverstein <csilvers@google.com>
8002
8003 * compressed_output.h (class Output_compressed_section): Use
8004 unsigned buffer.
8005 * compressed_output.cc (zlib_compress): Use unsigned buffers,
8006 add zlib header.
8007 (zlib_compressed_suffix): Removed.
8008 (Output_compressed_section::set_final_data_size): Use unsigned
8009 buffers.
8010 * testsuite/Makefile.am (flagstest_compress_debug_sections):
8011 Fix linker invocation.
8012 (flagstest_o_specialfile_and_compress_debug_sections):
8013 Likewise.
8014 * testsuite/Makefile.in: Regenerated.
8015
deae2a14
DM
80162008-04-02 David S. Miller <davem@davemloft.net>
8017
8018 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
8019 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
8020
70752818
ILT
80212008-04-02 Craig Silverstein <csilvers@google.com>
8022
8023 * TODO: New file.
8024
39d0cb0e
ILT
80252008-04-02 Ian Lance Taylor <iant@google.com>
8026
8027 * fileread.cc (File_read::find_view): Add byteshift and vshifted
8028 parameters. Update for new key type to views_. Change all
8029 callers.
8030 (File_read::read): Adjust for byteshift in returned view.
8031 (File_read::add_view): New function, broken out of
8032 find_and_make_view.
8033 (File_read::make_view): New function, broken out of
8034 find_and_make_view.
8035 (File_read::find_or_make_view): Add offset and aligned
8036 parameters. Rewrite accordingly. Change all callers.
8037 (File_read::get_view): Add offset and aligned parameters. Adjust
8038 for byteshift in return value.
8039 (File_read::get_lasting_view): Likewise.
8040 * fileread.h (class File_read): Update declarations.
8041 (class File_read::View): Add byteshift_ field. Add byteshift to
8042 constructor. Add byteshift method.
8043 * archive.h (Archive::clear_uncached_views): New function.
8044 (Archive::get_view): Add aligned parameter. Change all callers.
8045 * object.h (Object::get_view): Add aligned parameter. Change all
8046 callers.
8047 (Object::get_lasting_view): Likewise.
8048
8049 * fileread.cc (File_read::release): Don't call clear_views if
8050 there are multiple objects.
8051 * fileread.h (File_read::clear_uncached_views): New function.
8052 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
8053 on the archive.
8054
a1207466
CC
80552008-03-31 Cary Coutant <ccoutant@google.com>
8056
8057 Add thin archive support.
8058 * archive.cc (Archive::armagt): New const.
8059 (Archive::setup): Remove task parameter and calls to unlock.
8060 (Archive::unlock_nested_archives): New function.
8061 (Archive::read_header): Add nested_off parameter. Change
8062 all callers.
8063 (Archive::interpret_header): Likewise.
8064 (Archive::include_all_members): Change to handle thin
8065 archives.
8066 (Archive::include_member): Likewise.
8067 * archive.h (Archive::Archive): Add new parameters and
8068 initializers.
8069 (Archive::armagt): New const.
8070 (Archive::setup): Remove task parameter.
8071 (Archive::unlock_nested_archives): New function.
8072 (Archive::read_header): Add nested_off parameter.
8073 (Archive::interpret_header): Likewise.
8074 (Archive::Nested_archive_table): New typedef.
8075 (Archive::is_thin_archive_): New field.
8076 (Archive::nested_archives_): New field.
8077 (Archive::options_): New field.
8078 (Archive::dirpath_): New field.
8079 (Archive::task_): New field.
8080 * readsyms.cc (Read_symbols::do_read_symbols): Add check
8081 for thin archives. Pass additional parameters to
8082 Archive::Archive. Unlock the archive file after calling
8083 Archive::setup.
cd536b21 8084
479f6503
ILT
80852008-03-29 Ian Lance Taylor <iant@google.com>
8086
686c8caf
ILT
8087 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
8088 version symbol to be local.
8089 * testsuite/ver_test_4.sh: New file.
8090 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
8091 (check_DATA): Add ver_test_4.syms.
8092 (ver_test_4.syms): New target.
8093 * testsuite/Makefile.in: Rebuild.
8094
ab794b6b
ILT
8095 * output.cc
8096 (Output_section::Input_section_sort_entry::has_priority): New
8097 function.
8098 (Output_section::Input_section_sort_entry::match_file_name): New
8099 function.
8100 (Output_section::Input_section_sort_entry::match_section_name):
8101 Remove.
8102 (Output_section::Input_section_sort_entry::match_section_name_prefix):
8103 Remove.
8104 (Output_section::Input_section_sort_entry::match_section_file):
8105 Remove.
8106 (Output_section::Input_section_sort_compare::operator()): Rewrite
8107 using new Input_section_sort_entry functions. Sort crtbegin and
8108 crtend first. Sort sections with no priority before sections with
8109 a priority.
8110 * testsuite/initpri1.c (d3): Check j != 4.
8111 (cd5): New constructor/destructor function.
8112 (main): Check j != 2.
8113
479f6503
ILT
8114 * symtab.cc (Symbol_table::add_from_object): If we don't use the
8115 new symbol when resolving, don't call set_is_default.
8116 * testsuite/ver_test_7.cc: New file.
8117 * testsuite/ver_test_7.sh: New file.
8118 * testsuite/Makefile.am (ver_test_7.so): New target.
8119 (ver_test_7.o): New target.
8120 (check_SCRIPTS): Add ver_test_7.sh.
8121 (check_DATA): Add ver_test_7.syms.
8122 (ver_test_7.syms): New target.
8123
2fd32231
ILT
81242008-03-28 Ian Lance Taylor <iant@google.com>
8125
8126 * layout.cc (Layout::layout): If we see an input section with a
8127 name that needs sorting, set the must_sort flag for the output
8128 section.
8129 (Layout::make_output_section): If the name of the output section
8130 indicates that it might require sorting, set the may_sort flag.
8131 * output.h (Output_section::may_sort_attached_input_sections): New
8132 function.
8133 (Output_section::set_may_sort_attached_input_sections): New
8134 function.
8135 (Output_section::must_sort_attached_input_sections): New
8136 function.
8137 (Output_section::set_must_sort_attached_input_sections): New
8138 function.
8139 (class Output_section): Declare Input_section_sort_entry. Define
8140 Input_section_sort_compare. Declare
8141 sort_attached_input_sections. Add new fields:
8142 may_sort_attached_input_sections_,
8143 must_sort_attached_input_sections_,
8144 attached_input_sections_are_sorted_.
8145 * output.cc (Output_section::Output_section): Initialize new
8146 fields.
8147 (Output_section::add_input_section): Add an entry to
8148 input_sections_ if may_sort or must_sort are true.
8149 (Output_section::set_final_data_size): Call
8150 sort_attached_input_sections if necessary.
8151 (Output_section::Input_section_sort_entry): Define new class.
8152 (Output_section::Input_section_sort_compare::operator()): New
8153 function.
8154 (Output_section::sort_attached_input_sections): New function.
8155 * configure.ac: Check whether the compiler supports constructor
8156 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
8157 * testsuite/initpri1.c: New file.
8158 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
8159 CONSTRUCTOR_PRIORITY.
8160 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
8161 (initpri1_LDFLAGS): New variable.
8162 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8163
18e6b24e
ILT
81642008-03-27 Ian Lance Taylor <iant@google.com>
8165
49bdd526
ILT
8166 * common.cc (Sort_commons::operator): Correct sorting algorithm.
8167 * testsuite/common_test_1.c: New file.
8168 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
8169 (common_test_1_SOURCES): New variable.
8170 (common_test_1_DEPENDENCIES): New variable.
8171 (common_test_1_LDFLAGS): New variable.
8172
18e6b24e
ILT
8173 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
8174 and commons_ correctly when NAME/VERSION does not override
8175 NAME/NULL.
8176 * testsuite/ver_test_6.c: New file.
8177 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
8178 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
8179 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
8180
04bf7072
ILT
81812008-03-26 Ian Lance Taylor <iant@google.com>
8182
5871526f
ILT
8183 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
8184 of an undefined symbol from a version script.
8185 * testsuite/Makefile.am (ver_test_5.so): New target.
8186 (ver_test_5.o): New target.
8187 (check_SCRIPTS): Add ver_test_5.sh.
8188 (check_DATA): Add ver_test_5.syms.
8189 (ver_test_5.syms): New target.
8190 * testsuite/ver_test_5.cc: New file.
8191 * testsuite/ver_test_5.script: New file.
8192 * testsuite/ver_test_5.sh: New file.
8193 * Makefile.in, testsuite/Makefile.in: Rebuild.
8194
04bf7072
ILT
8195 PR gold/5986
8196 Fix problems building gold with gcc 4.3.0.
8197 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
8198 (gold_error_at_location, gold_warning_at_location): Use it.
8199 * configure.ac: Check whether we can compile and use a template
8200 function with a printf attribute.
8201 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
8202 when jumping over bytes.
8203 * object.cc: Instantiate Object::read_section_data.
8204 * debug.h: Include <cstring>
8205 * dwarf_reader.cc: Include <algorithm>
8206 * main.cc: Include <cstring>.
8207 * options.cc: Include <cstring>.
8208 * output.cc: Include <cstring>.
8209 * script.cc: Include <cstring>.
8210 * script.h: Include <string>.
8211 * symtab.cc: Include <cstring> and <algorithm>.
8212 * target-select.cc: Include <cstring>.
8213 * version.cc: Include <string>.
8214 * testsuite/testmain.cc: Include <cstdlib>.
8215 * configure, config.in: Rebuild.
8216
874c5b28
ILT
82172008-03-25 Ian Lance Taylor <iant@google.com>
8218
819d6c3a
ILT
8219 * options.cc: Include "../bfd/bfdver.h".
8220 (options::help): Print bug reporting address.
8221
f4b2c6f5
ILT
8222 * version.cc (print_version): Adjust output for current value of
8223 BFD_VERSION_STRING.
8224
8225 * NEWS: New file.
8226
e96caa79
ILT
8227 * options.cc (options::help): Print list of supported targets.
8228 * target-select.h: Include <vector>.
8229 (class Target_selector): Make machine_, size_, and is_big_endian_
8230 fields const. Add bfd_name_ and instantiated_target_ fields.
8231 (Target_selector::Target_selector): Add bfd_name parameter.
8232 (Target_selector::recognize): Make non-virtual, call
8233 do_recognize.
8234 (Target_selector::recognize_by_name): Make non-virtual, call
8235 do_recognize_by_name.
8236 (Target_selector::supported_names): New function.
8237 (Target_selector::bfd_name): New function.
8238 (Target_selector::do_instantiate_target): New pure virtual
8239 function.
8240 (Target_selector::do_recognize): New virtual function.
8241 (Target_selector::do_recognize_by_name): New virtual function.
8242 (Target_selector::instantiate_target): New private function.
8243 (supported_target_names): Declare.
8244 * target-select.cc (Target_selector::Target_selector): Update for
8245 new parameter and fields.
8246 (select_target_by_name): Check that the name matches before
8247 calling recognize_by_name.
8248 (supported_target_names): New function.
8249 * i386.cc (class Target_selector_i386): Update Target_selector
8250 constructor call. Remove recognize and recognize_by_name. Add
8251 do_instantiate_target.
8252 * x86_64.cc (class Target_selector_x86_64): Likewise.
8253 * testsuite/testfile.cc (class Target_selector_test): Update for
8254 changes to Target_selector.
8255
874c5b28
ILT
8256 * README: Rewrite, with some notes on unsupported features.
8257
0a65a3a7
CC
82582008-03-24 Cary Coutant <ccoutant@google.com>
8259
8260 * i386.cc (Target_i386::Got_type): New enum declaration.
8261 (Target_i386::Scan::local): Updated callers of Output_data_got
8262 member functions.
8263 (Target_i386::Scan::global): Likewise.
8264 (Target_i386::Relocate::relocate): Likewise.
8265 (Target_i386::Relocate::relocate_tls): Likewise.
8266 * object.h (Got_offset_list): New class.
8267 (Sized_relobj::local_has_got_offset): Added got_type parameter.
8268 (Sized_relobj::local_got_offset): Likewise.
8269 (Sized_relobj::set_local_got_offset): Likewise.
8270 (Sized_relobj::local_has_tls_got_offset): Removed.
8271 (Sized_relobj::local_tls_got_offset): Removed.
8272 (Sized_relobj::set_local_tls_got_offset): Removed.
8273 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
8274 * output.cc (Output_data_got::add_global): Added got_type parameter.
8275 (Output_data_got::add_global_with_rel): Likewise.
8276 (Output_data_got::add_global_with_rela): Likewise.
8277 (Output_data_got::add_global_pair_with_rel): New function.
8278 (Output_data_got::add_global_pair_with_rela): New function.
8279 (Output_data_got::add_local): Added got_type parameter.
8280 (Output_data_got::add_local_with_rel): Likewise.
8281 (Output_data_got::add_local_with_rela): Likewise.
8282 (Output_data_got::add_local_pair_with_rel): New function.
8283 (Output_data_got::add_local_pair_with_rela): New function.
8284 (Output_data_got::add_global_tls): Removed.
8285 (Output_data_got::add_global_tls_with_rel): Removed.
8286 (Output_data_got::add_global_tls_with_rela): Removed.
8287 (Output_data_got::add_local_tls): Removed.
8288 (Output_data_got::add_local_tls_with_rel): Removed.
8289 (Output_data_got::add_local_tls_with_rela): Removed.
8290 * output.h (Output_data_got::add_global): Added got_type parameter.
8291 (Output_data_got::add_global_with_rel): Likewise.
8292 (Output_data_got::add_global_with_rela): Likewise.
8293 (Output_data_got::add_global_pair_with_rel): New function.
8294 (Output_data_got::add_global_pair_with_rela): New function.
8295 (Output_data_got::add_local): Added got_type parameter.
8296 (Output_data_got::add_local_with_rel): Likewise.
8297 (Output_data_got::add_local_with_rela): Likewise.
8298 (Output_data_got::add_local_pair_with_rel): New function.
8299 (Output_data_got::add_local_pair_with_rela): New function.
8300 (Output_data_got::add_global_tls): Removed.
8301 (Output_data_got::add_global_tls_with_rel): Removed.
8302 (Output_data_got::add_global_tls_with_rela): Removed.
8303 (Output_data_got::add_local_tls): Removed.
8304 (Output_data_got::add_local_tls_with_rel): Removed.
8305 (Output_data_got::add_local_tls_with_rela): Removed.
8306 * resolve.cc (Symbol::override_base_with_special): Removed
8307 reference to has_got_offset_ field.
8308 * symtab.cc (Symbol::init_fields): Replaced initialization
8309 of got_offset_ with got_offsets_. Removed initialization
8310 of has_got_offset_
53fcba31 8311 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
8312 (Symbol::got_offset): Likewise.
8313 (Symbol::set_got_offset): Likewise.
8314 (Symbol::has_tls_got_offset): Removed.
8315 (Symbol::tls_got_offset): Removed.
8316 (Symbol::set_tls_got_offset): Removed.
8317 (Symbol::got_offset_): Removed.
8318 (Symbol::tls_mod_got_offset_): Removed.
8319 (Symbol::tls_pair_got_offset_): Removed.
8320 (Symbol::got_offsets_): New field.
8321 (Symbol::has_got_offset): Removed.
8322 (Symbol::has_tls_mod_got_offset): Removed.
8323 (Symbol::has_tls_pair_got_offset): Removed.
8324 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
8325 (Target_x86_64::Scan::local): Updated callers of Output_data_got
8326 member functions.
8327 (Target_x86_64::Scan::global): Likewise.
8328 (Target_x86_64::Relocate::relocate): Likewise.
8329 (Target_x86_64::Relocate::relocate_tls): Likewise.
8330
bd52eafb
BE
83312008-03-25 Ben Elliston <bje@au.ibm.com>
8332
8333 * yyscript.y: Fix spelling error in comment.
8334
8b105e34
ILT
83352008-03-24 Ian Lance Taylor <iant@google.com>
8336
8ed814a9
ILT
8337 * options.h (class General_options): Define build_id option.
8338 * layout.h (class Layout): Declare write_build_id, create_note,
8339 create_build_id. Add build_id_note_ member.
8340 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
8341 "libiberty.h", "md5.h", "sha1.h".
8342 (Layout::Layout): Initialize eh_frame_data_,
8343 eh_frame_hdr_section_, and build_id_note_.
8344 (Layout::finalize): Call create_build_id.
8345 (Layout::create_note): New function, broken out of
8346 Layout::create_gold_note.
8347 (Layout::create_gold_note): Call create_note.
8348 (Layout::create_build_id): New function.
8349 (Layout::write_build_id): New function.
8350 (Close_task_runner::run): Call write_build_id.
8351
8b105e34
ILT
8352 * x86_64.cc: Correct license to GPLv3.
8353
086a1841
ILT
83542008-03-23 Ian Lance Taylor <iant@google.com>
8355
8356 * options.cc: Include "demangle.h".
8357 (parse_optional_string): New function.
8358 (parse_long_option): Handle takes_optional_argument.
8359 (parse_short_option): Update dash_z initializer. Handle
8360 takes_optional_argument.
8361 (General_options::General_options): Initialize do_demangle_.
8362 (General_options::finalize): Set do_demangle_. Handle demangling
8363 style.
8364 * options.h (parse_optional_string): Declare.
8365 (struct One_option): Add optional_arg field. Update constructor.
8366 Update call constructor calls. Add takes_optional_argument
8367 function.
8368 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
8369 (DEFINE_optional_string): Define.
8370 (General_options::demangle): Change from DEFINE_bool to
8371 DEFINE_optional_string.
8372 (General_options::no_demangle): New function.
8373 (General_options::do_demangle): New function.
8374 (General_options::set_do_demangle): New function.
8375 (General_options::execstack_status_): Move definition to end of
8376 class definition.
8377 (General_options::static_): Likewise.
8378 (General_options::do_demangle_): New field.
8379 * object.cc (big_endian>::get_symbol_location_info): Call
8380 Options::do_demangle, not Options::demangle.
8381 * symtab.cc (demangle): Likewise.
8382
cbb93e63
ILT
83832008-03-22 Ian Lance Taylor <iant@google.com>
8384
8385 * gold.h: Include <cstddef> and <sys/types.h>
8386 * options.h: Include <cstring>.
8387
ec531623
ILT
83882008-03-21 Ian Lance Taylor <iant@google.com>
8389
8390 * Added source code to GNU binutils.
This page took 0.509118 seconds and 4 git commands to generate.