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