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