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