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