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