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