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