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