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