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