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