1 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4 function, is_info_ member.
5 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6 (Versions::Versions): Update caller.
7 (Versions::define_base_version): Likewise.
8 (Versions::add_def): Likewise.
10 2010-03-03 Sriraman Tallam <tmsriram@google.com>
12 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
13 (Scan::possible_function_pointer_reloc): New function.
14 (Scan::local_reloc_may_be_function_pointer): Change to call
15 possible_function_pointer_reloc.
16 (Scan::global_reloc_may_be_function_pointer): Ditto.
17 * icf.h (Icf::check_section_for_function_pointers): Change to reject
18 relocations in ".data.rel.ro._ZTV" section.
19 * testsuite/icf_safe_so_test.sh: Change to pass i386.
20 * testsuite/icf_safe_so_test.cc: Ditto.
21 * testsuite/icf_safe_test.cc: Ditto.
22 * testsuite/icf_safe_test.sh: Ditto.
24 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
25 Ian Lance Taylor <iant@google.com>
27 * target-reloc.h (relocate_section): Check the symbol table index
28 for -1U before setting the local symbol index.
29 (scan_relocatable_relocs): If copying the relocation, record that
30 the local symbol is required.
31 * object.h (Symbol_value::is_output_symtab_index_set): New
33 (Symbol_value::may_be_discarded_from_output_symtab): New
35 (Symbol_value::has_output_symtab_entry): New function.
36 (Symbol_value::needs_output_symtab_entry): Remove.
37 (Symbol_value::output_symtab_index): Make sure the symbol index is
39 (Symbol_value::set_output_symtab_index): Make sure the symbol
40 index is not set. Make sure the new index is valid.
41 (Symbol_value::set_must_have_output_symtab_entry): New function.
42 (Symbol_value::has_output_dynsym_entry): New function.
43 (Symbol_value::set_output_dynsym_index): Make sure the new index
45 (Sized_relobj::set_must_have_output_symtab_entry): New function.
46 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
47 local symbol if permitted.
48 (Sized_relobj::do_finalize_local_symbols): Call
49 is_output_symtab_index_set rather than needs_output_symtab_entry.
50 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
51 rather than needs_output_symtab_entry. Call
52 has_output_dynsym_entry rather than needs_output_dynsym_entry.
53 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
54 is_output_symtab_index_set rather than needs_output_symtab_entry.
55 * testsuite/discard_locals_relocatable_test.c: New file.
56 * testsuite/discard_locals_test.sh: Test -r.
57 * testsuite/Makefile.am (check_DATA): Add
58 discard_locals_relocatable_test1.syms,
59 discard_local_relocatable_test2.syms.
60 (MOSTLYCLEANFILES): Likewise. Also add
61 discard_locals_relocatable_test1.lout and
62 discard_locals_relocatable_test2.out.
63 (discard_locals_relocatable_test1.syms): New target.
64 (discard_locals_relocatable_test.o): New target.
65 (discard_locals_relocatable_test1.out): New target.
66 (discard_locals_relocatable_test2.syms): New target.
67 (discard_locals_relocatable_test2.out): New target.
68 (various): Add missing ../ld-new dependencies.
69 * testsuite/Makefile.in: Rebuild.
71 2010-03-03 Nick Clifton <nickc@redhat.com>
73 * po/fi.po: New Finnish translation.
75 2010-03-01 Doug Kwan <dougkwan@google.com>
77 * layout.cc (Layout::Layout): Force section types of .init_array*,
78 .preinit_array* and .fini_array* sections.
79 * output.cc (Output_section::Input_section_sort_entry::has_priority):
80 Fix check of return value of std::string::find.().
81 (Output_section::Input_section_sort_compare::operator()): Remove
82 comment about .init_array.
83 (Output_section::Input_section_sort_init_fini_compare::operator()):
85 (Output_section::sort_attached_input_sections): Handle .init_array
86 and .fini_array specially.
87 * output.h (Output_section::Inut_section_sort_compare): Update
89 (Output_section::Input_section_sort_init_fini_compare): New struct.
91 2010-02-26 Doug Kwan <dougkwan@google.com>
93 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
94 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
95 * testsuite/debug_msg.sh: Avoid matching source line number for
96 use of global variable undef_int.
98 2010-02-26 Doug Kwan <dougkwan@google.com>
100 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
101 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
102 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
103 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
104 * options.cc (General_options::General_options): Initialize member
106 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
107 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
108 and rm_no_fix_v4bx.stdout
109 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
110 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
111 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
112 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
114 * Makefile.in: Regenerate.
115 * testsuite/arm_fix_v4bx.s: New file.
116 * testsuite/arm_fix_v4bx.sh: Ditto.
118 2010-02-24 Doug Kwan <dougkwan@google.com>
120 * arm.cc (Target_arm::got_section): Make the .got section the first
121 non RELRO section in the data segment.
122 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
123 suffixes of section names.
125 2010-02-24 Doug Kwan <dougkwan@google.com>
127 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
128 flags and attributes merging if an input file is a binary file.
129 * fileread.cc (Input_file::open): Record format of original file.
130 * fileread.h (Input_file::Format): New enum type.
131 (Input_file::Input_file): Initialize data member format_.
132 (Input_file::format): New method definition.
133 (Input_file::format_):: New data member.
135 2010-02-24 Doug Kwan <dougkwan@google.com>
137 * arm.cc (Arm_output_data_got): New class.
138 (ARM_TCB_SIZE): New constant
139 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
140 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
141 If user uses a script with a SECTIONS clause, issue only a warning
142 for a misplaced EXIDX input section. Otherwise, issue an error.
143 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
145 (Target_arm::got_mode_index_entry): Handle static linking.
146 (Target_arm::Scan::local): Ditto.
147 (Target_arm::Scan::global): Ditto.
148 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
149 all incorrectly implemented relocations.
150 (Target_arm::fix_exidx_coverage): Pass layout to
151 Arm_output_section::fix_exidx_coverage.
152 * layout.cc (Layout::section_name_mapping): Remove trailing dots
153 from ".ARM.exidx." and ".ARM.extab.".
155 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
157 * arm.cc (Target_arm::do_finalize_sections): Create attribute
158 section if it does not already exist.
159 * attributes.cc (Attributes_section_data::Attributes_section_data):
160 Don't crash if size is zero.
162 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
163 Ian Lance Taylor <iant@google.com>
165 * gold.cc (queue_middle_tasks): If no input files were opened,
167 * workqueue.h (Task_function::Task_function): Assert that there is
170 2010-02-22 Doug Kwan <dougkwan@google.com>
172 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
173 * icf.cc (get_section_contents): Cast snprintf arguments to long long
174 types to avoid warnings due to different uint64_t implementations
177 2010-02-21 Doug Kwan <dougkwan@google.com>
179 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
180 handling of the maximum backward branch offset.
181 (Arm_relocate_functions::thumb_branch_common): Ditto.
182 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
183 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
184 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
185 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
186 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
187 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
188 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
189 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
190 thumb_bl_out_of_range thumb_bl_out_of_range.o,
191 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
192 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
193 thumb2_bl_out_of_range.o): New rules.
194 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
195 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
196 thumb2_bl_out_of_range
197 * testsuite/Makefile.in: Regenerate.
198 * testsuite/arm_bl_in_range.s: New file.
199 * testsuite/arm_bl_out_of_range.s: Ditto.
200 * testsuite/arm_branch_in_range.sh: Ditto.
201 * testsuite/arm_branch_range.t: Ditto.
202 * testsuite/thumb2_branch_range.t: Ditto.
203 * testsuite/thumb_bl_in_range.s: Ditto.
204 * testsuite/thumb_bl_out_of_range.s: Ditto.
205 * testsuite/thumb_branch_range.t: Ditto.
207 2010-02-20 Sriraman Tallam <tmsriram@google.com>
209 * gc.h (gc_process_relocs): Change vectors to point to the new list.
210 Add reloc offset information.
211 * icf.cc (get_section_contents): Change iterators to point to the new
212 vectors. Add reloc offset information to the contents.
213 * icf.h (Icf::Sections_reachable_info): New typedef.
214 (Icf::Sections_reachable_list): New typedef.
215 (Icf::Offset_info): New typedef.
216 (Icf::Reloc_info): New struct typedef.
217 (Icf::Reloc_info_list): New typedef.
218 (Icf::symbol_reloc_list): Delete method.
219 (Icf::addend_reloc_list): Delete method.
220 (Icf::section_reloc_list): Delete method.
221 (Icf::reloc_info_list): New method.
222 (Icf::reloc_info_list_): New member.
224 2010-02-19 Doug Kwan <dougkwan@google.com>
226 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
227 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
228 * arm.cc (Arm_relocation_functions): New forward declaration.
229 (Target_arm::Target_arm): Initialize new data members
230 got_mod_index_offset_ and tls_base_symbol_defined_.
231 (Target_arm::Relocate::relocate_tls): New method.
232 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
233 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
235 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
236 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
237 (Target_arm::got_mod_index_offset_,
238 Target_arm::tls_base_symbol_defined_): New data members.
239 (Target_arm::Scan::local, Target::Scan::global,
240 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
243 2010-02-18 Doug Kwan <dougkwan@google.com>
245 * arm.cc (Arm_relobj::find_linked_text_section): New method.
246 (Arm_relobj::make_exidx_input_section): Pass section index of linked
247 text section as a parameter becuase some broken tools may not set
248 the link in section header.
249 (Target_arm::has_got_section): New method.
250 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
251 without any mapping symbol as data only. Remove warning.
252 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
253 link in its section header, try to discover the link by inspecting the
254 REL31 relocation at the beginning of the section.
255 (Target_arm::Scan::check_non_pic): Report name of offending relocation
257 (Target_arm::Scan::global): Treat any reference to the symbol
258 _GLOBAL_OFFSET_TABLE_ as a GOT access.
260 2010-02-12 Sriraman Tallam <tmsriram@google.com>
262 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
263 (Scan::global_reloc_may_be_function_pointer): New function.
264 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
265 (Scan::global_reloc_may_be_function_pointer): New function.
266 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
267 (Scan::global_reloc_may_be_function_pointer): New function.
268 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
269 (Scan::global_reloc_may_be_function_pointer): New function.
270 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
271 (Scan::global_reloc_may_be_function_pointer): New function.
272 (Scan::possible_function_pointer_reloc): New function.
273 (Target_x86_64::can_check_for_function_pointers): New function.
274 * gc.h (gc_process_relocs): Scan relocation types to determine if
275 function pointers were taken for targets that support it.
276 * icf.cc (Icf::find_identical_sections): Include functions for
277 folding in safe ICF whose pointer is not taken.
278 * icf.h (Secn_fptr_taken_set): New typedef.
279 (fptr_section_id_): New member.
280 (section_has_function_pointers): New function.
281 (set_section_has_function_pointers): New function.
282 (check_section_for_function_pointers): New function.
283 * options.h: Fix comment for safe ICF option.
284 * target.h (can_check_for_function_pointers): New function.
285 * testsuite/Makefile.am: Add icf_safe_so_test test case.
286 Modify icf_safe_test for X86-64.
287 * testsuite/Makefile.in: Regenerate.
288 * testsuite/icf_safe_so_test.cc: New file.
289 * testsuite/icf_safe_so_test.sh: New file.
290 * testsuite/icf_safe_test.cc (kept_func_3): New function.
291 (main): Change to take pointer to function kept_func_3.
292 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
293 folding is done correctly for X86-64.
295 2010-02-12 David S. Miller <davem@davemloft.net>
297 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
298 is_symbolless parameter.
299 (Output_reloc<SHT_REL>::is_symbolless): New.
300 (Output_reloc<SHT_REL>::is_symbolless_): New.
301 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
302 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
303 (Output_reloc<SHT_RELA>::is_symbolless): New.
304 (Output_data_reloc::add_global): Handle is_symbolless.
305 (Output_data_reloc::add_global_relative): Likewise.
306 (Output_data_reloc::add_local): Likewise.
307 (Output_data_reloc::add_local_relative): Likewise.
308 (Output_data_reloc::add_symbolless_global_addend): New.
309 (Output_data_reloc::add_symbolless_local_addend): New.
310 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
312 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
313 instead of ->is_relative_
314 (Output_reloc::write): Likewise.
315 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
316 (Output_reloc::write_rel): Simplify.
318 * sparc.cc (Target_sparc::Scan::local): Use
319 ->add_symbolless_local_addend as needed.
320 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
321 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
322 based upon relocation offset.
324 2010-02-11 Doug Kwan <dougkwan@google.com>
326 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
327 (Target_arm::Scan::global): Ditto. Also remove a comment before the
328 beginning of function.
329 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
330 and MOVT_ABS relocations. Those are non issued in scanning. Fix
331 parameter is_32bit in calls to should_apply_static_reloc.
332 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
333 (check_DATA): Add arm_abs_global.stdout.
334 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
335 arm_abs_global.stdout): New rules.
336 (MOSTLLYCLEANFILES): Add arm_abs_global
337 * Makefile.in: Regenerate.
338 * testsuite/arm_abs_global.s: New file.
339 * testsuite/arm_abs_global.sh: Ditto.
340 * testsuite/arm_abs_lib.s: Ditto.
342 2010-02-11 Ian Lance Taylor <iant@google.com>
344 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
346 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
347 Allocate_commons_task first.
348 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
349 task, rather than symtab_lock_.
350 (Gc_process_relocs::~Gc_process_relocs): New function.
351 (Gc_process_relocs::is_runnable): Check this_blocker_.
352 (Gc_process_relocs::locks): Use next_blocker_ rather than
354 (Scan_relocs::~Scan_relocs): New function.
355 (Scan_relocs::is_runnable): Check this_blocker_ rather than
357 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
359 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
360 fields. Add this_blocker_ and next_blocker_ fields. Adjust
361 constructor accordingly.
362 (class Gc_process_relocs): Likewise.
363 (class Scan_relocs): Likewise.
364 * common.h (class Allocate_commons_task): Remove symtab_lock_
365 field, and corresponding constructor parameter.
366 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
368 (Allocate_commons_task::locks): Likewise.
370 2010-02-11 Ian Lance Taylor <iant@google.com>
372 * gold-threads.h (class Once): Define.
373 (class Initialize_lock): Rewrite as child of Once.
374 * gold-threads.cc (class Once_initialize): Define.
375 (once_pointer_control): New static variable.
376 (once_pointer, once_arg): New static variables.
377 (c_run_once): New static function.
378 (Once::Once, Once::run_once, Once::internal_run): New functions.
379 (class Initialize_lock_once): Remove.
380 (initialize_lock_control): Remove.
381 (initialize_lock_pointer): Remove.
382 (initialize_lock_once): Remove.
383 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
384 (Initialize_lock::initialize): Rewrite.
385 (Initialize_lock::do_run_once): New function.
386 * archive.cc (Archive::interpret_header): Only clear name if it is
388 * fileread.cc: Include "gold-threads.h"
389 (file_counts_lock): New static variable.
390 (file_counts_initialize_lock): Likewise.
391 (File_read::release): Only increment counts when using --stats.
392 Use a lock around the increment.
393 * parameters.cc (class Set_parameters_target_once): Define.
394 (set_parameters_target_once): New static variable.
395 (Parameters::Parameters): Move here from parameters.h.
396 (Parameters::set_target): Rewrite.
397 (Parameters::set_target_once): New function.
398 (Parameters::clear_target): Move here and rewrite.
399 * parameters.h (class Parameters): Update declarations. Add
400 set_parameters_target_once_ field.
401 (Parameters::Parameters): Move to parameters.cc.
402 (Parameters::clear_target): Likewise.
403 * readsyms.cc (Read_symbols::do_group): Create a Start_group
405 (Start_group::~Start_group): New function.
406 (Start_group::is_runnable): New function.
407 (Start_group::locks, Start_group::run): New functions.
408 (Finish_group::run): Change saw_undefined to size_t.
409 * readsyms.h (class Start_group): Define.
410 (class Finish_group): Change saw_undefined_ field to size_t.
411 (Finish_group::Finish_group): Remove saw_undefined and
412 this_blocker parameters. Change all callers.
413 (Finish_group::set_saw_undefined): New function.
414 (Finish_group::set_blocker): New function.
415 * symtab.h (class Symbol_table): Change saw_undefined to return
416 size_t. Change saw_undefined_ field to size_t.
417 * target-select.cc (Set_target_once::do_run_once): New function.
418 (Target_selector::Target_selector): Initialize set_target_once_
419 field. Don't initialize lock_ and initialize_lock_ fields.
420 (Target_selector::instantiate_target): Rewrite.
421 (Target_selector::set_target): New function.
422 * target-select.h (class Set_target_once): Define.
423 (class Target_selector): Update declarations. Make
424 Set_target_once a friend. Remove lock_ and initialize_lock_
425 fields. Add set_target_once_ field.
427 2010-02-10 Ian Lance Taylor <iant@google.com>
429 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
431 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
432 (queue_middle_tasks): Add all blockers before queueing any tasks.
433 (queue_final_tasks): Likewise.
434 * token.h (Task_token::add_blockers): New function.
435 * object.h (Input_objects::number_of_relobjs): New function.
437 2010-02-10 Ian Lance Taylor <iant@google.com>
439 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
440 shared, not if not position independent.
441 * x86_64.cc (Relocate::relocate_tls): Likewise.
442 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
443 (tls_pie_pic_test): New target.
444 * testsuite/Makefile.in: Rebuild.
446 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
447 (tls_test_main_pie.o, tls_test_pie.o): New targets.
448 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
449 * testsuite/Makefile.in: Rebuild.
451 2010-02-09 David S. Miller <davem@davemloft.net>
453 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
454 R_SPARC_RELATIVE using ->add_local_relative().
455 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
457 * output.h (Output_data_dynamic::add_section_size): New method
458 that takes two Output_data objects.
459 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
460 entry param. Handle it in initializers.
461 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
462 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
463 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
465 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
466 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
467 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
468 for dynrel_includes_plt.
469 * i386.cc (Target_i386::do_finalize_sections): Likewise.
470 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
471 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
473 (Target_sparc::do_finalize_sections): Update to pass true for
475 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
476 output before .rela.plt
477 (Target_powerpc::do_finalize_sections): Update to pass true for
478 dynrel_includes_plt when 32-bit.
480 2010-02-08 Doug Kwan <dougkwan@google.com>
482 * arm.cc (Arm_relobj::simple_input_section_output_address): New
484 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
485 Arm_relobj::scan_section_for_cortex_a8_stubs,
486 Arm_relobj::do_relocation_section): Instead of calling
487 Output_section::output_address, use faster
488 Arm_relobj::simple_input_section_output_address.
490 2010-02-08 David S. Miller <davem@davemloft.net>
492 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
493 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
494 relocation helper function.
496 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
497 just like R_SPARC_GOT{10,13,22}.
498 (Target_sparc::Scan::local): Likewise.
499 (Target_sparc::Relocate:relocate): Likewise.
501 2010-02-06 Ian Lance Taylor <iant@google.com>
503 * configure.ac: Rewrite targetobjs duplicate removal code to use
504 only shell constructs.
505 * configure: Rebuild.
507 2010-02-05 Doug Kwan <dougkwan@google.com>
510 * arm.cc (Arm_relobj::section_is_scannable): New method.
511 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
512 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
514 2010-02-04 Doug Kwan <dougkwan@google.com>
517 * arm-reloc-property.cc (cstdio): Include.
518 * configure.ac (targetobjs): Remove duplicates.
519 * configure: Regenerate.
520 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
521 big and little endian version for a given address size.
523 2010-02-03 Doug Kwan <dougkwan@google.com>
525 * arm-reloc-property.cc
526 (Arm_reloc_property_table::reloc_name_in_error_message): New method
528 * arm-reloc-property.h
529 (Arm_reloc_property_table::get_implemented_static_reloc_property):
530 New method definition.
531 (Arm_reloc_property_table::reloc_name_in_error_message): New method
533 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
535 (GOT_PREL): Change implemented to Y.
536 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
537 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
538 (Arm_relocate_functions::movw_abs_nc): Remove method.
539 (Arm_relocate_functions::movt_abs): Ditto.
540 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
541 (Arm_relocate_functions::thm_movt_abs): Ditto.
542 (Arm_relocate_functions::movw_rel_nc): Ditto.
543 (Arm_relocate_functions::movw_rel): Ditto.
544 (Arm_relocate_functions::movt_rel): Ditto.
545 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
546 (Arm_relocate_functions:thm_movw_rel): Ditto.
547 (Arm_relocate_functions:thm_movt_rel): Ditto.
548 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
549 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
550 New method definitions.
551 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
552 (Arm_relocation_functions::arm_grp_ldr): Ditto.
553 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
554 (Arm_relocation_functions::arm_grp_ldc): Ditto.
555 (Target_arm::Relocate::relocate): Check for non-static or
556 unimplemented relocation code and exit early. Change calls to
557 Target_arm::reloc_uses_thumb_bit and
558 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
559 instead. Refactor code to handle similar relocations to increase
560 code sharing. Remove check for unsupported relocation code in switch
562 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
563 relocation property table to find out size. Change error message to
564 print out the name of a relocation code instead of the numeric value.
565 (Target_arm::scan_reloc_for_stub): Use relocation property table
566 instead of calling Target_arm::reloc_uses_thumb_bit().
568 2010-02-02 Doug Kwan <dougkwan@google.com>
570 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
571 types of relaxed input section.
573 2010-02-02 Doug Kwan <dougkwan@google.com>
575 * Makefile.am (HFILES): Add arm-reloc-property.h.
577 (TARGETSOURCES): Add arm-reloc-property.cc
578 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
579 (libgold_a_SOURCES): $(DEFFILES)
580 * Makefile.in: Regenerate.
581 * arm-reloc-property.cc: New file.
582 * arm-reloc-property.h: New file.
583 * arm-reloc.def: New file.
584 * arm.cc: Update comments.
585 (arm-reloc-property.h): New included header.
586 (arm_reloc_property_table): New global variable.
587 (Target_arm::do_select_as_default_target): New method definition.
588 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
589 arm-reloc-property to targ_extra_obj.
590 * parameters.cc (set_parameters_target): Call
591 Target::select_as_default_target().
592 * target.h (Target::select_as_default_target): New method definition.
593 (Target::do_select_as_default_target): Same.
595 2010-02-01 Doug Kwan <dougkwan@google.com>
597 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
598 first_output_text_section_.
599 (Arm_exidx_fixup::first_output_text_section): New method definition.
600 (Arm_exidx_fixup::first_output_text_section_): New data member.
601 (Arm_exidx_fixup::process_exidx_section): Record the first text
603 (Arm_output_section::fix_exidx_coverage): Set correct linked section
604 and entsize in output section header.
606 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
608 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
609 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
610 (Arm_relocate_functions::thm_alu11): New Method.
611 (Arm_relocate_functions::thm_pc8): New Method.
612 (Arm_relocate_functions::thm_pc12): New Method.
613 (Target_arm::Scan::local): Handle the relocations.
614 (Target_arm::Scan::global): Likewise.
615 (Target_arm::Relocate::relocate): Likewise.
616 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
618 2010-01-29 Doug Kwan <dougkwan@google.com>
620 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
621 of relocation types as ld.
623 2010-01-29 Doug Kwan <dougkwan@google.com>
625 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
627 (Arm_relocate_functions::thumb_branch_common): Ditto.
628 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
629 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
630 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
631 Arm_relocate_functions::jump24): Remove.
632 (Target_arm::Relocate::relocate): Adjust code to call
633 Arm_relocation_functions::arm_branch_common and
634 Arm_relocation_functions::thumb_branch_common instead of their removed
635 wrappers. Merge switch-cases together to reduce source code size.
637 2010-01-29 Doug Kwan <dougkwan@google.com>
639 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
640 output_local_symbol_count_needs_update_.
641 (Arm_relobj::output_local_symbol_count_needs_update,
642 Arm_relobj::set_output_local_symbol_count_needs_update,
643 Arm_relobj::update_output_local_symbol_count): New methods.
644 (Arm_relobj::output_local_symbol_count_needs_update_): New data
646 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
647 of pointed function as in a R_ARM_PREL31 relocation.
648 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
649 for output local symbol count updating.
650 (Target_arm::do_relax): Update output local symbol counts in objects
652 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
654 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
656 * arm.cc: Added support for the ARM relocations:
657 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
658 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
659 (Arm_relocate_functions::movw_rel_nc): Renamed (was
661 (Arm_relocate_functions::movw_rel): New method.
662 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
663 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
665 (Arm_relocate_functions::thm_movw_rel): New method.
666 (Arm_relocate_functions::thm_movt_rel): Renamed (was
668 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
670 (Target_arm::Scan::global): Likewise.
671 (Target_arm::Relocate::relocate): Likewise.
672 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
675 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
677 * arm.cc: Added support for ARM group relocations.
678 (Target_arm::reloc_needs_sym_origin): New method.
679 (Arm_relocate_functions::calc_grp_kn): New method.
680 (Arm_relocate_functions::calc_grp_residual): New method.
681 (Arm_relocate_functions::calc_grp_gn): New method.
682 (Arm_relocate_functions::arm_grp_alu): New Method.
683 (Arm_relocate_functions::arm_grp_ldr): New Method.
684 (Arm_relocate_functions::arm_grp_ldrs): New Method.
685 (Arm_relocate_functions::arm_grp_ldc): New Method.
686 (Target_arm::Scan::local): Handle the ARM group relocations.
687 (Target_arm::Scan::global): Likewise.
688 (Target_arm::Relocate::relocate): Likewise.
689 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
692 2010-01-26 Doug Kwan <dougkwan@google.com>
694 * arm.cc (set): Include.
695 (class Arm_exidx_fixup): Change type of last_input_section_ to const
697 (Arm_output_section::Text_section_list): New type.
698 (Arm_output_section::append_text_sections_to_list): New method.
699 (Arm_output_section::fix_exidx_coverage): Ditto.
700 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
701 (Arm_relobj::convert_input_section_to_relaxed_section): Use
702 Relobj::set_section_offset() instead of
703 Sized_relobj::invalidate_section_offset().
704 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
705 parameter for section headers. Ignore relocation sections for
706 unallocated sections and EXIDX sections.
707 (Target_arm::fix_exidx_coverage): New method.
708 (Target_arm::output_section_address_less_than): New type.
709 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
710 linked text section instead of the EXIDX section.
711 (Arm_output_section::create_stub_group): Add an assertion to check
712 that this is not an EXIDX output section.
713 (Arm_output_section::append_text_sections_to_list): New method.
714 (Arm_output_section::fix_exidx_coverage): Ditto.
715 (Arm_relobj::scan_sections_for_stubs): Adjust call to
716 Arm_relobj::section_needs_reloc_stub_scanning.
717 (Target_arm::do_relax): Fix EXIDX output section coverage in the
719 (Target_arm::fix_exidx_coverage): New method.
720 * object.h (Relobj::set_output_section): New method.
721 (Sized_relobj::invalidate_section_offset): Remove method.
722 (Sized_relobj::do_invalidate_section_offset): Remove method.
723 (Sized_relobj::do_set_section_offset): Handle offset value -1.
725 2010-01-25 Doug Kwan <dougkwan@google.com>
727 * arm.cc (Arm_exidx_merged_section::do_output_offset):
728 Fix warning due to signed and unsigned comparison on a 32-bit host.
730 2010-01-22 Doug Kwan <dougkwan@google.com>
732 * arm.cc (Target_arm::do_relax): Record an output section for section
733 offset adjustment it contains any stub table that has changed.
734 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
735 offsets in an output section if necessary.
736 * output.cc (Output_section::Output_section): Initialize
737 section_offsets_need_adjustments_.
738 (Output_section::add_input_section_for_script): Renamed to
739 Output_section::add_simple_input_section.
740 (Output_section::save_states): Add a comment.
741 (Output_section::discard_states): New method defintion.
742 (Output_section::adjust_section_offsets): Same.
743 * output.h (Output_section::add_input_section_for_script): Renamed to
744 Output_section::add_simple_input_section.
745 (Output_section::discard_states): New method declaration.
746 (Output_section::adjust_section_offsets): Same.
747 (Output_section::section_offsets_need_adjustment,
748 Output_section::set_section_offsets_need_adjustment): New method
750 (Output_section::section_offsets_need_adjustment_): New data member.
752 (Output_section_element_input::set_section_address): Adjust code for
753 renaming of Output_section::add_input_section_for_script.
754 (Orphan_output_section::set_section_address): Same.
756 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
758 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
759 Fix_v4bx enum values .
760 * gold/options.h (General_options): New option definitions.
761 (General_options::fix_v4bx): New method.
762 (General_options::Fix_v4bx): New enum.
763 * gold/options.cc (General_options::parse_fix_v4bx): New method.
764 (General_options::parse_fix_v4bx_interworking): New method.
766 2010-01-22 Doug Kwan <dougkwan@google.com>
768 * arm.cc (Arm_exidx_fixup): New class.
770 2010-01-21 Doug Kwan <dougkwan@google.com>
772 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
774 (Arm_exidx_section_offset_map): New type.
776 2010-01-21 Doug Kwan <dougkwan@google.com>
778 * arm.cc (Arm_exidx_input_section): New class.
779 (Arm_relobj::exidx_input_section_by_link,
780 Arm_relobj::exidx_input_section_by_shndx,
781 Arm_relobj::make_exidx_input_section): New methods.
782 (read_arm_attributes_section): Remove.
783 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
784 information about them.
785 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
788 2010-01-20 Doug Kwan <dougkwan@google.com>
790 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
791 Input_section_specifier to Section_id.
792 (Target_arm::new_arm_input_section: Adjust code for change of key
794 (Target_arm::find_arm_input_section): Ditto.
795 * gc.h (object.h): Include for Section_id nand Section_id_hash.
796 (Section_id): Remove.
797 (Garbage_collection::Section_id_hash): Remove.
798 * icf.h (object.h): Include for Section_id nand Section_id_hash.
799 (Section_id): Remove.
800 (Icf::Section_id_hash): Remove.
801 * object.h (Section_id, Const_section_id, Section_id_hash,
802 Const_section_id_hash): New type definitions.
803 * output.cc (Output_section::add_relaxed_input_section): Change to
804 use Const_section_id instead of Input_section_specifier as key type.
805 (Output_section::add_merge_input_section): Ditto.
806 (Output_section::build_relaxation_map): Change to use Section_id
807 instead of Input_section_specifier as key type.
808 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
810 (Output_section::convert_input_sections_to_relaxed_sections): Change
811 to use Const_section_id instead of Input_section_specifier as key type.
812 (Output_section::find_merge_section): Ditto.
813 (Output_section::find_relaxed_input_section): Ditto.
814 * output.h (Input_section_specifier): Remove class.
815 (Output_section::Output_section_data_by_input_section_map): Change
816 key type to Const_section_id.
817 (Output_section::Output_relaxed_input_section_by_input_section_map):
819 (Output_section::Relaxation_map): Change key type to Section_id.
821 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
823 * gold/arm.cc: Added support for R_ARM_V4BX relocation
824 (class Arm_v4bx_stub): New class.
825 (DEF_STUBS): Updated definition to support v4_veneer_bx.
826 (Stub_factory::make_arm_v4bx_stub): New method.
827 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
828 (Stub_table::empty): Handle v4bx stubs.
829 (Stub_table::add_arm_v4bx_stub): New method.
830 (Stub_table::find_arm_v4bx_stub): New method.
831 (Arm_relocate_functions::v4bx): New method.
832 (Target_arm::fix_v4bx): New method.
833 (Target_arm::Target_arm): Handle R_ARM_V4BX.
834 (Stub_table::relocate_stubs): Likewise.
835 (Stub_table::do_write): Likewise.
836 (Stub_table::update_data_size_and_addralign): Likewise.
837 (Stub_table::finalize_stubs): Likewise.
838 (Target_arm::Scan::local): Likewise.
839 (Target_arm::Scan::global): Likewise.
840 (Target_arm::do_finalize_sections): Likewise.
841 (Target_arm::Relocate::relocate): Likewise.
842 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
844 (Target_arm::scan_reloc_for_stub): Likewise.
845 (Target_arm::scan_reloc_section_for_stubs): Likewise.
847 2010-01-19 Ian Lance Taylor <iant@google.com>
849 * output.cc (Output_section_headers::do_sized_write): Write large
850 segment count to sh_info field.
851 (Output_file_header::do_sized_write): For large segment count,
852 write PN_XNUM to e_phnum field.
854 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
856 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
857 (Arm_relocate_functions::thm_jump8): New function.
858 (Arm_relocate_functions::thm_jump11): New function.
859 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
861 (Target_arm::Scan::global): Likewise.
862 (Target_arm::Relocate::relocate): Likewise.
863 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
866 2010-01-14 Doug Kwan <dougkwan@google.com>
868 * arm.cc (map, utility): Include headers.
869 (Target_arm::apply_cortex_a8_workaround): New method.
870 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
871 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
872 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
873 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
874 the --[no-]fix-cortex-a8 command line options.
875 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
876 (Target_arm::relocate_stub): Use addend in instruction template.
877 * options.h (DEFINE_bool): Set the user-set flag.
878 (General_options): Add --[no-]-fix-cortex options.
879 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
880 : Update fast look-up map after conversion.
882 2010-01-14 Sriraman Tallam <tmsriram@google.com>
884 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
885 in the first pass of do_layout.
887 2010-01-13 Doug Kwan <dougkwan@google.com>
889 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
890 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
891 apparent compiler problem of not folding static constant integral
892 data members of elfcpp::Elf_sizes<32>.
894 2010-01-13 Doug Kwan <dougkwan@google.com>
896 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
897 Arm_relobj::section_needs_cortex_a8_stub_scanning,
898 Arm_relobj::scan_section_for_cortex_a8_erratum,
899 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
900 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
901 sections to scan for relocation stubs into a new method
902 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
903 relocation and Cortex-A8 stub scanning.
904 (Target_arm::do_relax): Force stubs to be after stubbed sections
905 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
906 the beginning of a new relaxation pass. Update a comment.
907 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
909 2010-01-12 Ian Lance Taylor <iant@google.com>
911 * target-reloc.h (visibility_error): New inline function.
912 (relocate_section): Call visibility_error.
913 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
914 (MOSTLYCLEANFILES): Likewise.
915 (protected_4_pic.o, protected_3.err): New targets.
916 * testsuite/protected_4.cc: New file.
918 2010-01-12 Doug Kwan <dougkwan@google.com>
920 * arm.cc (Cortex_a8_reloc): New class.
921 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
922 and cortex_a8_relocs_info_.
923 (Target_arm::fix_cortex_a8): New method definition.
924 (Target_arm::Cortex_a8_relocs_info): New type.
925 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
926 New data member declarations.
927 (Target_arm::scan_reloc_for_stub): Record information about
928 relocations for THUMB branches that might be exempted from the
929 Cortex-A8 workaround.
930 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
931 at the beginning of a relaxation pass.
933 2010-01-12 Doug Kwan <dougkwan@google.com>
935 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
936 (Arm_relobj::Mapping_symbol_position,
937 Arm_reloj::Mapping_symbol_position_less,
938 Arm_relobj::Mapping_symbols_info): New types.
939 (Target_arm::is_mapping_symbol_name): New method definition.
940 (Arm_relobj::do_count_local_symbols): Save information about mapping
943 2010-01-11 Doug Kwan <dougkwan@google.com>
945 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
946 Arm_relocate_functions::thumb32_branch_upper,
947 Arm_relocate_functions::thumb32_branch_lower,
948 Arm_relocate_functions::thumb32_cond_branch_offset,
949 Arm_relocate_functions::thumb32_cond_branch_upper,
950 Arm_relocate_functions::thumb32_cond_branch_lower,
951 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
952 branch offset encoding.
953 (Arm_relocate_functions::thumb_branch_common): Use new branch
954 offset encoding methods to avoid code duplication.
955 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
956 (Stub_addend_reader::operator()): Use new branch encoding method
957 to avoid code duplication.
959 2010-01-11 Doug Kwan <dougkwan@google.com>
961 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
962 (Target_arm::do_finalize_sections): Define special EXIDX section
963 symbols only if referenced.
964 * gc.h (Garbage_collection::add_reference): New method.
965 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
968 2010-01-11 Ian Lance Taylor <iant@google.com>
970 * script.cc (Version_script_info::build_expression_list_lookup):
971 Change complaing about duplicate wildcard match from error to
974 * script.cc (class Lazy_demangler): Recreate--revert part of patch
976 (Version_script_info::Version_script_info): Initialize globs_,
977 default_version_, default_is_global_, and exact_. Don't
978 initialize globals_ or locals_.
979 (Version_script_info::build_lookup_tables): Build local symbols
981 (Version_script_info::unquote): New function.
982 (Version_script_info::add_exact_match): New function.
983 (Version_script_info::build_expression_list_lookup): Remove lookup
984 parameter. Add is_global parameter. Change all callers. Handle
985 wildcard pattern specially. Unquote pattern. Call
987 (Version_script_info::get_name_to_match): New function.
988 (Version_script_info::get_symbol_version): New function.
989 (Version_script_info::get_symbol_version_helper): Remove.
990 (Version_script_info::check_unmatched_names): Call unquote.
991 * script.h (class Version_script_info): Change get_symbol_version
992 to be non-inline and add is_global parameter; change all callers.
993 Rewrite symbol_is_local. Update declarations. Define struct
994 Version_tree_match, Exact, Globs. Don't define struct Lookup.
995 Remove globals_ and locals_ members. Add exact_, globs_,
996 default_version_, is_global_.
997 (Version_script_info::Glob): Remove pattern, add expression and
998 is_global. Update constructor. Change all callers.
999 * dynobj.cc (Versions::finalize): Mark the version symbol as the
1001 (Versions::symbol_section_contents): If a symbol is undefined, or
1002 defined in a dynamic object, set the version index to
1004 * symtab.cc (Symbol_table::add_from_relobj): Don't call
1006 (Symbol_table::add_from_pluginobj): Likewise.
1007 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
1009 2010-01-11 Doug Kwan <dougkwan@google.com>
1011 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
1012 (incremental_dump_LDADD): Add linking option for libintl.
1013 * Makefile.in: Regenerate.
1015 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
1018 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
1020 * testsuite/Makefile.in: Regenerated.
1022 2010-01-10 Doug Kwan <dougkwan@google.com>
1024 * options.h (DEFINE_var): Use parentheses around argument varname__
1025 in macro body to avoid any unintended subsequent substitutions.
1027 2010-01-10 Ian Lance Taylor <iant@google.com>
1029 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
1030 candidates before doing symbol resolution.
1032 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
1033 ODR candidates if only one is weak.
1035 2010-01-08 Ian Lance Taylor <iant@google.com>
1037 * script.cc (Version_script_info::build_expression_list_lookup):
1038 Don't warn about ambiguous version, just record the ambiguity.
1039 (Version_script_info::get_symbol_version_helper): Give error if
1040 version is ambiguous.
1042 2010-01-08 Doug Kwan <dougkwan@google.com>
1044 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
1045 prev_data_size_ and prev_addralign_. Remove initializer for
1046 deleted data member has_been_changed_.
1047 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
1048 to determine if the table is empty.
1049 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
1051 (Stub_table::add_reloc_stub): Define method in class definition
1052 instead of just declaring it there.
1053 (Stub_table::add_cortex_a8_stub): New method definition.
1054 (Stub_table::update_data_size_and_addralign): Ditto.
1055 (Stub_table::finalize_stubs): Ditto.
1056 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
1057 (Stub_table::do_addralign_): Return address alignment in the
1058 (Stub_table::do_reset_address_and_file_offset): Define method in
1059 class definition instead of declaring it there. Set current data
1060 size to be the data size of the previous pass.
1061 (Stub_table::set_final_data_size): Use current data size as the
1063 (Stub_table::relocate_stub): Change parameter type of stub from
1064 Reloc_stub pointer to Stub pointer.
1065 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
1066 (Stub_table::Cortex_a8_stub_list): New typedef.
1067 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
1068 Stub_table::prev_addralign_): New data member.
1069 (Arm_relobj::Arm_relobj): Initialize data member
1070 section_has_cortex_a8_workaround_.
1071 (Arm_relobj::section_has_cortex_a8_workaround,
1072 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
1074 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
1076 (Target_arm::relocate_stub): Change parameter type of stub from
1077 Reloc_stub pointer to Stub pointer.
1078 (Insn_template::size, Insn_template::alignment): Handle
1079 THUMB16_SPECIAL_TYPE.
1080 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
1081 Stub_table::update_data_size_and_addralign,
1082 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
1084 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
1085 (Stub_table::do_write): Ditto.
1086 (Target_arm::do_relax): Adjust code for changes in Stub_table.
1088 2010-01-08 Ian Lance Taylor <iant@google.com>
1091 * symtab.h (class Symbol): Remove fields is_target_special_ and
1092 has_plt_offset_. Add field is_defined_in_discarded_section_.
1093 (Symbol::is_defined_in_discarded_section): New function.
1094 (Symbol::set_is_defined_in_discarded_section): New function.
1095 (Symbol::has_plt_offset): Rewrite.
1096 (Symbol::set_plt_offset): Verify that new offset is not -1U.
1097 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
1098 Don't initialize is_target_special_ or has_plt_offset_.
1099 Initialize is_defined_in_discarded_section_.
1100 (Symbol_table::add_from_relobj): If appropriate, set
1101 is_defined_in_discarded_section.
1102 * resolve.cc (Symbol::override_base_with_special): Don't test
1103 is_target_special_. Change has_plt_offset_ to has_plt_offset().
1104 * target-reloc.h (relocate_section): Do special handling for
1105 symbols defined in discarded sections for global symbols as well
1108 2010-01-08 Ian Lance Taylor <iant@google.com>
1110 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
1111 the SHT_SYMTAB case.
1113 2010-01-08 Ian Lance Taylor <iant@google.com>
1115 * object.cc (Sized_relobj::do_layout): Don't get confused if
1116 layout_eh_frame returns NULL.
1118 2010-01-08 Ian Lance Taylor <iant@google.com>
1121 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
1122 dynamic symbol table, use the normal symbol table.
1123 (Sized_dynobj::do_read_symbols): Remove assertion about type of
1126 2010-01-08 Ian Lance Taylor <iant@google.com>
1129 * layout.cc (Layout::include_section): Remove .gnu_debuglink
1132 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
1134 * version.cc (print_version): Change to "Copyright 2010".
1136 2010-01-08 Ian Lance Taylor <iant@google.com>
1140 * i386.cc (class Target_i386): Change return type of plt_section
1142 (class Output_data_plt_i386): Add tls_desc_rel_ field.
1143 (Output_data_plt_i386::Output_data_plt_i386): Initialize
1144 tls_desc_rel_ field.
1145 (Output_data_plt_i386::rel_tls_desc): New function.
1146 (Target_i386::rel_tls_desc_section): New function.
1147 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
1148 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
1149 R_386_TLS_DESC reloc in rel_tls_desc_section.
1150 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
1151 Define struct Tlsdesc_info.
1152 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
1153 (Target_x86_64::do_reloc_symbol_index): New function.
1154 (Target_x86_64::add_tlsdesc_info): New function.
1155 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
1156 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
1158 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
1160 (Output_data_plt_x86_64::rela_tlsdesc): New function.
1161 (Target_x86_64::rela_tlsdesc_section): New function.
1162 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
1164 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
1165 (Target_x86_64::do_reloc_addend): New function.
1166 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
1167 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
1168 declarations. Define TARGET_CODE. Add arg field to u1_ union.
1169 (Output_reloc::type): New function.
1170 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
1171 (Output_reloc::is_target_specific): New function.
1172 (Output_reloc::target_arg): New function.
1173 (class Output_reloc) [SHT_RELA]: Add four new constructors for
1174 absolute relocs and target specific relocs.
1175 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
1176 add_target_specific.
1177 (class Output_data_reloc) [SHT_RELA]: Likewise.
1178 * output.cc (Output_reloc::Output_reloc): Add four new versions
1179 for absolute relocs and target specific relocs.
1180 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
1181 (Output_reloc::get_symbol_index): Likewise.
1182 (Output_reloc::local_section_offset): Check that local_sym_index_
1183 is not TARGET_CODE or 0.
1184 (Output_reloc::symbol_value): Likewise.
1185 (Output_reloc::write) [SHT_RELA]: Call target for target specific
1187 * target.h (class Target): Add reloc_symbol_index and reloc_addend
1188 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
1190 * layout.cc (add_target_dynamic_tags): Use output section for
1191 DT_PLTRELSZ and DT_JMPREL.
1193 2010-01-07 Ian Lance Taylor <iant@google.com>
1196 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
1198 (class Output_data_reloc_generic): Define.
1199 (class Output_data_reloc_base): Change base class to
1200 Output_data_reloc_generic. Change add() method to call
1201 bump_relative_reloc_count for a relative reloc. Remove
1203 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
1205 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
1206 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
1208 * layout.h (class Layout): Update declaration.
1210 2010-01-07 Ian Lance Taylor <iant@google.com>
1212 * output.h (class Output_data): Add const version of
1213 output_section and do_output_section.
1214 (class Output_section_data): Add const version of
1216 (class Output_section): Likewise.
1217 * layout.cc (Layout::add_target_dynamic_tags): New function.
1218 * layout.h (class Layout): Update declarations.
1219 * arm.cc (Target_arm::do_finalize_sections): Use
1220 add_target_dynamic_tags.
1221 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1222 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1223 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1224 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1226 2010-01-07 Ian Lance Taylor <iant@google.com>
1229 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
1232 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
1233 Ian Lance Taylor <iant@google.com>
1236 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
1237 Xindex::read_symtab_xindex.
1239 2010-01-07 Doug Kwan <dougkwan@google.com>
1241 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
1242 (Insn_template::thumb16_bcond_insn): New method declaration.
1243 (Insn_template): Fix spelling.
1244 (Stub::thumb16_special): New method declaration.
1245 (Stub::do_write): Define virtual method which was previously pure
1247 (Stub::do_thumb16_special): New method declaration.
1248 (Stub::do_fixed_endian_write): New template member.
1249 (Reloc_stub::do_write): Remove.
1250 (Reloc_stub::do_fixed_endian_write): Remove.
1251 (Cortex_a8_stub): New class definition.
1252 (Stub_factory::make_cortex_a8_stub): New method definition.
1253 (Stub_factory::Stub_factory): Add missing static storage class
1254 qualifier for elf32_arm_stub_a8_veneer_blx.
1256 2010-01-07 Ian Lance Taylor <iant@google.com>
1259 * options.h (class General_options): Add --warn-unresolved-symbols
1260 and --error-unresolved-symbols.
1261 * errors.cc (Errors::undefined_symbol): Implement
1262 --warn-unresolved-symbols.
1264 * options.h (class General_options): Add -z text and -z textoff.
1265 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
1267 2010-01-06 Sriraman Tallam <tmsriram@google.com>
1269 * gc.h (Garbage_collection::Cident_section_map): New typedef.
1270 (Garbage_collection::cident_sections): New function.
1271 (Garbage_collection::add_cident_section): New function.
1272 (Garbage_collection::cident_sections_): New member.
1273 (gc_process_relocs): Add references to sections whose names are C
1275 * gold.h (cident_section_start_prefix): New constant.
1276 (cident_section_stop_prefix): New constant.
1277 (is_cident): New function.
1278 * layout.cc (Layout::define_section_symbols): Replace string constants
1279 with the newly defined constants.
1280 * object.cc (Sized_relobj::do_layout): Track sections whose names are
1282 * testsuite/Makefile.am: Add gc_orphan_section_test.
1283 * testsuite/Makefile.in: Regenerate.
1284 * testsuite/gc_orphan_section_test.cc: New file.
1285 * testsuite/gc_orphan_section_test.sh: New file.
1287 2010-01-06 Ian Lance Taylor <iant@google.com>
1290 * options.h (class General_options): Add --warn-shared-textrel.
1291 * layout.cc (Layout::finish_dynamic_section): Implement
1292 --warn-shared-textrel.
1295 * options.h (class General_options): Add --warn-multiple-gp.
1297 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1299 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
1300 $(THREADSLIB) and $(LIBDL).
1301 * Makefile.in: Rebuild.
1303 2010-01-06 Ian Lance Taylor <iant@google.com>
1306 * options.cc (General_options::parse_section_start): New function.
1307 (General_options::section_start): New function.
1308 (General_options::General_options): Initialize all members.
1309 * options.h: Include <map>
1310 (class General_options): Add --section-start. Add section_starts_
1312 * layout.cc (Layout::attach_allocated_section_to_segment): If
1313 --section-start was used, set the address of the segment. Remove
1314 local sort_sections.
1315 (Layout::relaxation_loop_body): If the address of the load segment
1316 has been set by --section-start, don't use it.
1317 * output.h (Output_segment::update_flags_for_output_section): New
1319 * output.cc (Output_segment::add_output_section): Call
1320 update_flags_for_output_section.
1322 2010-01-05 Ian Lance Taylor <iant@google.com>
1325 * options.h (class General_options): Add --undefined-version.
1326 * script.cc (struct Version_expression): Add was_matched_by_symbol
1328 (Version_script_info::matched_symbol): New function.
1329 (Version_script_info::get_symbol_version_helper): Call
1331 (Version_script_info::check_unmatched_names): New function.
1332 * script.h (class Version_script_info): Update declarations.
1333 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
1335 * options.h (class General_options): Use DEFINE_bool_alias for
1336 allow_multiple_definition.
1337 * resolve.cc (Symbol_table::should_override): Don't test
1338 allow_multiple_definition.
1341 * options.h (class General_options): Add --cref.
1342 * main.cc (main): Print cref table if --cref. Don't close mapfile
1343 until after printing cref table.
1344 * cref.cc: Include "symtab.h".
1345 (class Cref_inputs): Define Cref_table_compare and Cref_table.
1346 (Cref_table_compare::operator()): New function.
1347 (Cref_inputs::gather_cref): New function.
1348 (filecol): New static const.
1349 (Cref_inputs::print_cref): New function.
1350 (Cref::print_cref): New function.
1351 * cref.h: Include <cstdio>.
1352 (class Cref): Update declarations.
1353 * mapfile.h (Mapfile::file): New function.
1354 * object.h (class Object): Define Symbols. Declare virtual
1355 do_get_global_symbols.
1356 (Object::get_global_symbols): New function.
1357 * object.cc (Input_objects::add_object): Pass object to cref_ if
1359 (Input_objects::archive_start): Likewise.
1360 (Input_objects::archive_stop): Likewise.
1361 (Input_objects::print_cref): New function.
1362 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
1363 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
1365 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
1367 * plugin.h (class Sized_pluginobj): Update declarations.
1369 2010-01-05 Ian Lance Taylor <iant@google.com>
1371 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
1372 to is_default_version. Rename insdef to insdefault.
1373 (Symbol_table::add_from_relobj): Rename def to is_default_version
1374 and local to is_forced_local.
1375 (Symbol_table::add_from_pluginobj): Likewise.
1376 (Symbol_table::add_from_dynobj): Likewise.
1377 (Symbol_table::define_special_symbol): Rename insdef to
1380 2010-01-04 Ian Lance Taylor <iant@google.com>
1383 * options.h (class General_options): Add
1384 --allow-multiple-definition and -z muldefs.
1385 * resolve.cc (Symbol_table::should_override): Don't warn about a
1386 multiple symbol definition if --allow-multiple-definition or -z
1390 * options.h (class General_options): Add --add-needed and
1391 --copy-dt-needed-entries. Tweak --as-needed help entry.
1392 * object.cc (Input_objects::check_dynamic_dependencies): Give an
1393 error if --copy-dt-needed-entries aka --add-needed is used and
1394 would cause a change in behaviour.
1397 * options.h (class General_options): Add -G as a short version of
1398 --shared. Add no-op options -assert, -g, and -i.
1400 2010-01-04 Sriraman Tallam <tmsriram@google.com>
1402 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
1403 check for .text or .gnu.linkonce.t sections.
1404 * icf.cc (Icf::find_identical_sections): Ditto.
1405 Change the detection for mangled function name within the section
1407 * icf.h (is_section_foldable_candidate): New function.
1409 2009-12-30 Ian Lance Taylor <iant@google.com>
1412 * options.h (class General_options): Permit two dashes with
1413 --retain-symbols-file.
1415 2009-12-30 Ian Lance Taylor <iant@google.com>
1418 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
1419 don't put the file header and segment headers in the text
1423 * common.cc (Sort_commons::operator()): Stabilize sort when both
1425 (Symbol_table::do_allocate_commons_list): When allocating common
1426 symbols, skip a symbol which is no longer common.
1427 * symtab.h (Symbol::is_common): Test whether the symbol comes from
1428 an object before checking its type.
1429 * testsuite/common_test_2.c: New file.
1430 * testsuite/common_test_3.c: New file.
1431 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
1432 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
1433 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
1434 (common_test_2_pic.o, common_test_2.so): New targets.
1435 (common_test_3_pic.o, common_test_3.so): New targets.
1436 * testsuite/Makefile.in: Rebuild.
1439 * script.cc (read_input_script): If we see a new SECTIONS clause,
1440 and we have added an input section, give an error.
1441 * layout.h (class Layout): Add have_added_input_section function.
1442 Add have_added_input_section_ field.
1443 * layout.cc (Layout::Layout): Initialize
1444 have_added_input_section_.
1445 (Layout::layout): Set have_added_input_section_.
1446 (Layout::layout_eh_frame): Likewise.
1448 2009-12-30 Ian Lance Taylor <iant@google.com>
1451 * options.h (class General_options): Add --sort-common option.
1452 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
1453 * common.cc (Sort_common): Add sort_order parameter to
1454 constructor. Add sort_order_ field.
1455 (Sort_commons::operator): Check sort_order_.
1456 (Symbol_table::allocate_commons): Determine the sort order.
1457 (Symbol_table::do_allocate_commons): Add sort_order parameter.
1459 (Symbol_table::do_allocate_commons_list): Likewise.
1461 2009-12-30 Ian Lance Taylor <iant@google.com>
1464 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
1465 symbols from this object, don't change the visibility of an
1467 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
1469 2009-12-30 Ian Lance Taylor <iant@google.com>
1472 * script.h (class Version_script_info): Define Language enum.
1473 Update declarations. Define Glob, Exact, and Lookup types. Add
1474 new fields globals_, locals_, and is_finalized_.
1475 * script.cc: Various formatting fixes.
1476 (class Parser_closure): Change language_stack_ from a vector of
1477 std::string to one of Version_script_info::Language. Adjust all
1479 (class Lazy_demangler): Remove.
1480 (struct Version_expression): Change language from std::string to
1481 Version_script_info::Language.
1482 (Version_script_info::Version_script_info): New function.
1483 (Version_script_info::~Version_script_info): Don't call clear.
1484 (Version_script_info::finalize): New function.
1485 (Version_script_info::build_lookup_tables): New function.
1486 (Version_script_info::build_expression_list_lookup): New
1488 (Version_script_info::get_symbol_version_helper): Rewrite to use
1490 (Version_script_info::print_expression_list): Adjust to use
1491 Version_script_info::Language.
1492 (script_push_lex_into_version_mode): Check that the version script
1493 has not been finalized.
1494 (version_script_push_lang): Change language string to
1495 Version_script_info::Language.
1496 * options.cc (Command_line::version_script): New function.
1497 * options.h (class General_options): Add finalize_dynamic_list
1498 function. Change version_script from declaration to definition.
1499 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
1500 * testsuite/version_script.map: Remove duplicate def of foo.
1501 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
1503 * testsuite/Makefile.in: Rebuild.
1505 2009-12-30 Ian Lance Taylor <iant@google.com>
1508 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
1509 if the input symbol index is 0, make the output symbol index 0.
1511 2009-12-30 Ian Lance Taylor <iant@google.com>
1514 * options.h (class General_options): Add -x/--discard-all.
1515 * object.cc (Sized_relobj::do_count_local_symbols): Handle
1516 --discard-all. If the local symbol needs a dynamic entry, check
1517 that before handling --discard-locals.
1519 2009-12-30 Ian Lance Taylor <iant@google.com>
1522 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
1524 (Output_segment::add_output_section): Don't change the flags if
1528 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
1529 GNU hash table if they need a dynamic value. Otherwise, don't add
1530 them if they are defined in a dynamic object or are forced local.
1532 2009-12-29 Ian Lance Taylor <iant@google.com>
1535 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
1536 .gnu.hash table for a 32-bit target.
1539 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
1540 regular and a dynamic object only needs a dynamic symbol table
1541 entry if it is externally visible.
1544 * i386.cc (class Target_i386): Initialize global_offset_table_ in
1545 constructor. Add global_offset_table_ field.
1546 (Target_i386::got_section): Set global_offset_table_.
1547 (Target_i386::do_finalize_sections): Set global_offset_table_
1549 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
1550 in constructor. Add global_offset_table_ field.
1551 (Target_x86_64::got_section): Set global_offset_table_.
1552 (Target_x86_64::do_finalize_sections): Set global_offset_table_
1555 * layout.cc (Layout::Layout): Initialize increase_relro_.
1556 (Layout::get_output_section): Add is_relro, is_last_relro, and
1557 is_first_non_relro parameters. Change all callers.
1558 (Layout::choose_output_section): Likewise.
1559 (Layout::add_output_section_data): Likewise.
1560 (Layout::make_output_section): Likewise.
1561 (Layout::set_segment_offsets): Clear increase_relro when using a
1563 * layout.h (class Layout): Add increase_relro method. Add
1564 increase_relro_ field. Update declarations.
1565 * output.cc (Output_section::Output_section): Initialize
1566 is_last_relro_ and is_first_non_relro_.
1567 (Output_segment::add_output_section): Group relro sections is
1568 do_sort is true. Handle is_last_relro and is_first_non_relro.
1569 (Output_segment::maximum_alignment): Remove relro handling.
1570 (Output_segment::set_section_addresses): Add increase_relro
1571 parameter. Change all callers. Add initial alignment to align
1572 relro sections on separate page. Remove old relro handling.
1573 (Output_segment::set_section_list_addresses): Remove in_relro
1574 parameter. Change all callers.
1575 (Output_segment::set_offset): Add increase parameter. Change all
1576 callers. Remove old relro handling.
1577 * output.h (class Output_section): Add new methods: is_last_relro,
1578 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
1579 Add is_last_relro_ and is_first_non_relro_ fields.
1580 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
1581 Create separate .got.plt section. Call increase_relro.
1582 * x86_64.cc (Target_x86_64::got_section): Likewise.
1583 * testsuite/relro_script_test.t: Add .got.plt.
1586 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
1587 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
1588 (Layout::finalize): Call set_dynamic_symbol_size.
1589 (Layout::set_dynamic_symbol_size): New function.
1590 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
1591 set_dynamic_symbol_size.
1594 * output.h (class Output_section): Add is_entsize_zero_ field.
1595 * output.cc (Output_section::Output_section): Initialize
1597 (Output_section::set_entsize): If two different entsizes are
1598 requested, force it to zero.
1599 (Output_section::add_input_section): Set flags for .debug_str
1600 before updating section flags. Set entsize.
1601 (Output_section::update_flags_for_input_section): Set SHF_MERGE
1602 and SHF_STRING if all input sections have those flags.
1604 2009-12-29 Rafael Espindola <espindola@google.com>
1606 * main.cc (main): Fix the sys time reporting.
1607 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
1610 2009-12-29 Sriraman Tallam <tmsriram@google.com>
1612 * options.cc (General_options::parse_version): Allow -v to exit
1613 without an error if there is nothing to link.
1615 2009-12-29 Ian Lance Taylor <iant@google.com>
1617 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
1618 using a version of gcc before 4.1.
1619 * configure: Rebuild.
1621 2009-12-28 Chris Demetriou <cgd@google.com>
1623 * attributes.cc (Output_attributes_section_data::do_write): Use
1624 std::vector::front rather than std::vector::data.
1626 2009-12-28 Ian Lance Taylor <iant@google.com>
1628 * symtab.h (class Symbol_table): Add enum Defined.
1629 * resolve.cc (Symbol_table::should_override): Add defined
1630 parameter. Change all callers. Test whether object is NULL
1631 before calling a method on it.
1632 (Symbol_table::report_resolve_problem): Add defined parameter.
1634 (Symbol_table::should_override_with_special): Likewise.
1635 * symtab.cc (Symbol_table::define_in_output_data): Add defined
1636 parameter. Change all callers.
1637 (Symbol_table::do_define_in_output_data): Likewise.
1638 (Symbol_table::define_in_output_segment): Likewise.
1639 (Symbol_table::do_define_in_output_segment): Likewise.
1640 (Symbol_table::define_as_constant): Likewise.
1641 (Symbol_table::do_define_as_constant): Likewise.
1642 * script.h (class Symbol_assignment): Add is_defsym parameter to
1643 constructor; change all callers.
1644 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
1645 parameter. Change all callers. Add is_defsym_ field.
1646 (class Parser_closure): Add parsing_defsym parameter to
1647 constructor; change all callers. Add parsing_defsym accessor
1648 function. Add parsing_defsym_ field.
1650 2009-12-28 Ian Lance Taylor <iant@google.com>
1652 * gold.cc (queue_middle_tasks): Fix formatting.
1653 * object.cc (Relobj::is_section_name_included): Likewise.
1655 2009-12-23 Ian Lance Taylor <iant@google.com>
1657 * i386.cc (Target_i386::do_calls_non_split): Recognize
1658 -fsplit-stack prologue for a function with a static chain.
1659 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
1660 -fsplit-stack prologue when using %r11.
1662 2009-12-21 Sriraman Tallam <tmsriram@google.com>
1664 * options.cc (General_options::parse_version): Make -v continue and do
1665 the link like GNU ld does.
1667 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
1669 * Makefile.am (CCFILES): Add timer.cc.
1670 (HFILES): Add timer.h.
1671 * configure.ac: Check for sysconf and times.
1672 * main.cc: include timer.h.
1673 (main): Use Timer instead of get_run_time.
1676 * workqueue.cc: include timer.h.
1677 (Workqueue::find_and_run_task):
1678 Report user, sys and wall time.
1679 * Makefile.in: Regenerate.
1680 * config.in: Regenerate.
1681 * configure: Regenerate.
1683 2009-12-16 Doug Kwan <dougkwan@google.com>
1685 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
1687 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
1688 relaxed input sections.
1689 * output.cc (Output_section::find_relaxed_input_section): Change
1690 return type to Output_relaxed_input_section pointer. Adjust code
1691 for new type of relaxed_input_section_map_.
1692 * output.h (Output_section::find_relaxed_input_section): Change
1693 return type to Output_relaxed_input_section pointer.
1694 (Output_section::Output_relaxed_input_section_by_input_section_map):
1696 (Output_section::relaxed_input_section_map_): Change type to
1697 Output_section::Output_relaxed_input_section_by_input_section_map.
1698 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
1701 2009-12-15 Ian Lance Taylor <iant@google.com>
1703 * layout.cc (Layout::create_shstrtab): Only write out after input
1704 sections if we are compressing debug sections.
1706 2009-12-15 Ian Lance Taylor <iant@google.com>
1708 * archive.cc (Archive::add_symbols): Only look up a symbol without
1709 a version if there is, in fact, a version.
1711 2009-12-14 Ian Lance Taylor <iant@google.com>
1713 Revert -Wshadow changes, all changes from:
1714 2009-12-11 Doug Kwan <dougkwan@google.com>
1715 2009-12-11 Nick Clifton <nickc@redhat.com>
1716 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
1718 2009-12-11 Doug Kwan <dougkwan@google.com>
1720 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
1722 * attributes.cc (Object_attribute::size): Ditto.
1723 (Attributes_section_data::size): Ditto.
1724 (Attributes_section_data::Attributes_section_data): Ditto.
1725 (Output_attributes_section_data::do_write): Ditto.
1726 * attributes.h (Object_attribute::set_type): Ditto.
1727 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1729 2009-12-11 Nick Clifton <nickc@redhat.com>
1731 * archive.cc: Fix shadowed variable warnings.
1733 * compressed_output.cc: Likewise.
1734 * compressed_output.h: Likewise.
1735 * configure: Likewise.
1736 * dwarf_reader.cc: Likewise.
1737 * dynobj.cc: Likewise.
1738 * dynobj.h: Likewise.
1739 * ehframe.cc: Likewise.
1740 * ehframe.h: Likewise.
1741 * errors.cc: Likewise.
1742 * expression.cc: Likewise.
1743 * fileread.cc: Likewise.
1744 * fileread.h: Likewise.
1745 * freebsd.h: Likewise.
1746 * i386.cc: Likewise.
1748 * incremental.h: Likewise.
1749 * layout.cc: Likewise.
1750 * layout.h: Likewise.
1751 * mapfile.cc: Likewise.
1752 * merge.cc: Likewise.
1753 * merge.h: Likewise.
1754 * object.cc: Likewise.
1755 * object.h: Likewise.
1756 * options.h: Likewise.
1757 * output.cc: Likewise.
1758 * output.h: Likewise.
1759 * parameters.cc: Likewise.
1760 * plugin.cc: Likewise.
1761 * powerpc.cc: Likewise.
1762 * reduced_debug_output.cc: Likewise.
1763 * reduced_debug_output.h: Likewise.
1764 * reloc.cc: Likewise.
1765 * reloc.h: Likewise.
1766 * resolve.cc: Likewise.
1767 * script-sections.cc: Likewise.
1768 * script.cc: Likewise.
1769 * script.h: Likewise.
1770 * sparc.cc: Likewise.
1771 * symtab.cc: Likewise.
1772 * symtab.h: Likewise.
1773 * target-select.cc: Likewise.
1774 * target-select.h: Likewise.
1775 * token.h: Likewise.
1776 * workqueue.cc: Likewise.
1777 * workqueue.h: Likewise.
1778 * x86_64.cc: Likewise.
1780 2009-12-10 Doug Kwan <dougkwan@google.com>
1782 * arm.cc (attributes.h): New include.
1783 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1784 (Arm_relobj::~Arm_relobj): Delete object pointed by
1785 attributes_section_data_.
1786 (Arm_relobj::attributes_section_data): New method definition.
1787 (Arm_relobj::attributes_section_data_): New data member declaration.
1788 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1789 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1790 attributes_section_data_.
1791 (Arm_dynobj::attributes_section_data): New method definition.
1792 (Arm_dynobj::attributes_section_data_): New data member declaration.
1793 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
1794 initialization value of may_use_blx_ to false.
1795 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1796 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1797 object attributes to compute results instead of hard-coding.
1798 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1799 Target_arm::get_secondary_compatible_arch,
1800 Target_arm::set_secondary_compatible_arch
1801 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1802 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1803 New method declarations.
1804 (Target_arm::get_aeabi_object_attribute): New method definition.
1805 (Target_arm::attributes_section_data_): New data member declaration.
1806 (read_arm_attributes_section): New template definition.
1807 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1808 (Arm_dynobj::do_read_symbols): Ditto.
1809 (Target_arm::do_finalize_sections): Merge attributes sections from
1810 input. Check for BLX use after attributes section merging.
1811 Fix __exidx_start and __exidx_end visibility. Create an
1812 .ARM.attributes section if necessary.
1813 (Target_arm::get_secondary_compatible_arch,
1814 Target_arm::set_secondary_compatible_arch,
1815 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1816 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1817 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
1818 New method definitions.
1820 2009-12-09 Ian Lance Taylor <iant@google.com>
1822 * plugin.cc (Plugin::load): Don't cast from void* to a function
1825 2009-12-09 Ian Lance Taylor <iant@google.com>
1827 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1830 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
1832 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1833 Replace two_file_shared_1.so with two_file_shared_2.so.
1834 * testsuite/Makefile.in: Regenerated.
1836 2009-12-08 Doug Kwan <dougkwan@google.com>
1838 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1839 (HFILES): Add attributes.h and int_encoding.h.
1840 * Makefile.in: Regenerate.
1841 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1842 function definitions to int_encoding.cc
1843 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1844 prototypes to int_encoding.h
1845 * reduced_debug_output.cc (int_encoding.h): New include.
1846 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1847 function definitions to int_encoding.cc
1848 (insert_into_vector, read_from_pointer): Move template definitions to
1850 * attributes.cc: New file.
1851 * attributes.h: New file.
1852 * int_encoding.cc: New file.
1853 * int_encoding.h: New file.
1855 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
1858 * incremental-dump.cc (dump_incremental_inputs): New.
1859 (main): Use dump_incremental_inputs.
1861 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
1864 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1865 checking elfcpp::STT_FUNC.
1866 (Target_i386::Relocate::relocate): Likewise.
1867 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1869 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1870 symbols from shared libraries into normal FUNC symbols.
1872 * symtab.h (Symbol): Add is_func and use it.
1874 2009-12-05 Doug Kwan <dougkwan@google.com>
1876 * arm.cc (Target_arm::arm_info): Initialize new fields
1877 attributes_section and attributes_vendor.
1878 * i386.cc (Target_i386::i386_info): Same.
1879 * object.cc (Sized_relobj::do_layout): Skip attribute section.
1880 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1881 fields attributes_section and attributes_vendor.
1882 * sparc.cc (Target_sparc::sparc_info): Same.
1883 * target.h (Target::attributes_section, Target::attributes_vendor,
1884 Target::is_attributes_section, Target::attribute_arg_type,
1885 Target::attributes_order): New method definitions.
1886 (Target::Target_info::attributes_section,
1887 Target::Target_info::attributes_vendor): New fields.
1888 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1889 virtual method definitions.
1890 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1891 attributes_section and attributes_vendor.
1892 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1894 2009-12-05 Doug Kwan <dougkwan@google.com>
1896 * arm.cc: Update comments about interworking and stub generation.
1897 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1898 considered as non-PIC.
1899 (Arm_relocate_functions::base_abs): Fix formatting.
1900 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1901 of function to use GOT entry address instead of offset.
1902 (Target_arm::Scan::global): Issue an error if a symbol would need a
1903 PLT does not get one because it is untyped. Remove code to create
1904 dynamic symbols for relative branches.
1905 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1906 takes unsigned integer instead of boolean.
1908 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1910 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1911 (two_file_test_LDADD): Likewise.
1912 (common_test_1_LDADD): Likewise.
1913 (exception_test_LDADD) Likewise.
1914 (weak_test_LDADD): Likewise.
1915 (many_sections_test_LDADD): Likewise.
1916 (initpri1_LDADD): Likewise.
1917 (script_test_1_LDADD): Likewise.
1918 (script_test_2_LDADD): Likewise.
1919 (justsyms_LDADD): Likewise.
1920 (binary_test_LDADD): Likewise.
1921 (large_LDADD): Likewise.
1922 * testsuite/Makefile.in: Regenerated.
1924 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1926 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1927 (Symbol_table::override_with_special): Likewise.
1928 (Symbol_table::add_from_object): Likewise.
1930 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1932 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1933 Don't set the data_offset twice.
1935 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1937 * testsuite/Makefile.in: Regenerate.
1939 2009-12-03 Doug Kwan <dougkwan@google.com>
1941 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1942 (Target_arm::do_finalize_sections): Add parameter for symbol table
1943 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1944 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1945 parameter for symbol table pointer.
1946 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1947 an additional parameter for a pointer to symbol table.
1948 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1949 parameter for a symbol table pointer.
1950 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1951 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1953 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1954 parameter for a symbol table pointer.
1956 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
1958 * incremental.cc (Incremental_inputs_header)
1959 (Incremental_inputs_header_write, Incremental_inputs_entry)
1960 (Incremental_inputs_entry_write): Move ...
1961 * incremental.h (Incremental_inputs_header)
1962 (Incremental_inputs_header_write, Incremental_inputs_entry)
1963 (Incremental_inputs_entry_write): here.
1965 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1967 * incremental.cc (make_sized_incremental_binary): Set the target.
1968 Error if it is incompatible.
1969 * output.h (Output_file): Add filename method.
1971 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1973 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1974 from the get_* methods.
1976 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1978 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1979 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1980 Write 0 for the data_offset of scripts.
1982 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1984 * testsuite/Makefile.am: Add the incremental_test.sh test.
1985 * testsuite/incremental_test.sh: New.
1986 * testsuite/incremental_test_1.c: New.
1987 * testsuite/incremental_test_2.c: New.
1989 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
1991 * incremental-dump.cc (main): Fix typos.
1993 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
1996 * incremental-dump.cc (main): Use llu to print 64 bit values.
1998 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1999 H.J. Lu <hongjiu.lu@intel.com>
2001 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
2003 (incremental_dump_LDADD): Likewise.
2004 * Makefile.in: Regenerated.
2006 2009-11-25 Doug Kwan <dougkwan@google.com>
2010 2009-11-25 Doug Kwan <dougkwan@google.com>
2012 * arm.cc (Target_arm::Target_arm): Move method definition
2013 outside of class definition. Add code to handle
2014 --target1-rel, --target1-abs and --target2= options.
2015 (Target_arm::get_reloc_reloc_type): Change method to be
2016 non-static and const.
2017 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
2018 New data member declaration.
2019 (Target_arm::Scan::local, Target_arm::Scan::global,
2020 Target_arm::Relocate::relocate,
2021 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2022 Adjust call to Target_arm::get_real_reloc_type.
2023 (Target_arm::get_real_reloc_type): Use command line options
2024 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
2025 * options.h (--target1-rel, --target1-abs, --target2): New
2028 2009-11-25 Doug Kwan <dougkwan@google.com>
2030 * arm.cc (Target_arm::Target_arm): Move method definition outside of
2031 class definition. Add code to handle --target1-rel, --target1-abs
2032 and --target2= options.
2033 (Target_arm::get_reloc_reloc_type): Change method to be non-static
2035 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
2037 (Target_arm::Scan::local, Target_arm::Scan::global,
2038 Target_arm::Relocate::relocate,
2039 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
2040 call to Target_arm::get_real_reloc_type.
2041 (Target_arm::get_real_reloc_type): Use command line options to
2042 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
2043 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
2046 2009-11-25 Doug Kwan <dougkwan@google.com>
2048 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
2049 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
2050 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
2052 (Arm_relocate_functions::thm_call): Replace body with a call to
2053 Arm_relocate_functions::thumb_branch_common.
2054 (Arm_relocate_functions::thm_jump24,
2055 Arm_relocate_functions::thm_xpc22): New method definitions.
2056 (Arm_relocate_functions::thumb_branch_common): New method definition.
2057 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
2059 (Target_arm::Relocate::relocate): Adjust call to thm_call.
2060 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
2062 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2064 * Makefile.am: Build incremental-dump
2065 * Makefile.in: Regenerate.
2066 * incremental-dump.cc: New.
2067 * incremental.cc (Incremental_inputs_header_data,
2068 Incremental_inputs_entry_data): Move to incremental.h
2069 * incremental.h: (Incremental_inputs_header_data,
2070 Incremental_inputs_entry_data): Move from incremental.cc
2072 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2074 * incremental.cc (Incremental_inputs_header,
2075 Incremental_inputs_header_write, Incremental_inputs_entry,
2076 Incremental_inputs_entry_write): Add a typedef with the data type.
2078 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2080 * incremental.cc (Incremental_inputs_header,
2081 Incremental_inputs_header_write, Incremental_inputs_entry,
2082 Incremental_inputs_entry_write): Update comment about which
2083 type has the filed descriptions.
2085 2009-11-15 Doug Kwan <dougkwan@google.com>
2087 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
2088 (Arm_relocate_functions::arm_branch_common): Change method defintion
2089 in class definition to a method declaration and update list of formal
2091 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
2092 Arm_relocation_functions::jump24): Adjust call to
2093 Arm_relocate_functions::arm_branch_common. Update list of formal
2095 (Arm_relocate_functions::xpc25): New method definition.
2096 (Arm_relocate_functions::arm_branch_common): Move method defintion
2097 out from class definition. Use stubs for mode-switching and extending
2099 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
2100 specially. Change code to enable use of stubs in ARM branches.
2102 2009-11-10 Doug Kwan <dougkwan@google.com>
2104 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
2105 in method declaration.
2106 (Target_arm::relocate_stub): New method declaration.
2107 (Target_arm::default_target): Change to return a pointer instead of
2109 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
2110 Target_arm::default_target.
2111 (Arm_Relobj::do_relocate_sections): Remove options paramater in
2113 (Target_arm::relocate_section): Adjust view.
2114 (Target_arm::relocate_stub): New method definition.
2116 2009-11-10 Doug Kwan <dougkwan@google.com>
2118 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
2120 * incremental.cc (open_incremental_binary): Initialized local
2121 variables to avoid warnings.
2122 * object.cc (make_elf_object): Ditto.
2123 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
2126 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
2129 * testsuite/plugin_test.c: Include "config.h".
2131 2009-11-09 Doug Kwan <dougkwan@google.com>
2133 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
2134 (arm_symbol_value): Remove.
2135 (Arm_relocate_functions::arm_branch_common,
2136 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
2137 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
2138 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
2139 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
2140 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
2141 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
2142 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
2143 Arm_relocate_functions::thm_mobw_abs_nc,
2144 Arm_relocate_functions::thm_mov_abs,
2145 Arm_relocate_functions::movw_prel_nc,
2146 Arm_relocate_functions::thm_movt_abs,
2147 Arm_relocate_functions::movt_prel,
2148 Arm_relocate_functions::thm_movw_prel_nc,
2149 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
2150 (Target_arm::Relocate::relocate): Only decompose address into two
2151 parts if relocation type uses the thumb-bit and pass the actual
2152 bit instead of a flag indicating that the thumb-bit is used. Adjust
2153 calls to methods in Arm_relocate_functions for this change.
2155 2009-11-08 Ian Lance Taylor <iant@google.com>
2158 * reloc.cc: Instantiate
2159 Sized_relobj::initialize_input_to_output_maps and
2160 Sized_relobj:free_input_to_output_maps.
2162 2009-11-06 Ian Lance Taylor <iant@google.com>
2165 * defstd.cc (in_segment): Set only_if_ref true for "end".
2167 2009-11-06 Doug Kwan <dougkwan@google.com>
2169 * arm.cc (class Reloc_stub): Correct a comment.
2170 (Target_arm::Target_arm): Initialize arm_input_section_map_.
2171 (Target_arm::scan_section_for_stubs): New method declaration.
2172 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
2173 Change methods from private to protected.
2174 (Target_arm::do_may_relax): New method definition.
2175 (Target_arm::do_relax, Target_arm::group_sections,
2176 Target_arm::scan_reloc_for_stub,
2177 Target_arm::scan_reloc_section_for_stubs): New method declarations.
2178 (Target_arm::arm_input_section_map_): New data member declaration.
2179 (Target_arm::scan_reloc_for_stub,
2180 Target_arm::scan_reloc_section_for_stubs,
2181 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
2182 Target_arm::do_relax): New method definitions.
2184 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
2186 * configure.ac: Check for (struct stat)::st_mtim
2187 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
2188 * config.in: Regenerate.
2189 * configure: Regenerate.
2191 2009-11-05 Ian Lance Taylor <iant@google.com>
2194 * output.cc (Output_segment::add_output_section): Add missing
2197 2009-11-04 Ian Lance Taylor <iant@google.com>
2200 * object.h (class Object): Add is_needed and set_is_needed
2201 methods. Add is_needed_ field. Make bool fields into bitfields.
2202 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
2203 defined in a dynamic object and referenced by a regular object,
2204 set is_needed for the dynamic object.
2205 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
2206 if the file is marked with as_needed and it is not needed.
2208 2009-11-04 Ian Lance Taylor <iant@google.com>
2211 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
2212 tags if data is discarded by linker script.
2213 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2214 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2215 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2216 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2218 2009-11-04 Ian Lance Taylor <iant@google.com>
2220 * layout.cc (Layout::get_output_section): Add is_interp and
2221 is_dynamic_linker_section parameters. Change all callers.
2222 (Layout::choose_output_section): Likewise.
2223 (Layout::make_output_section): Likewise.
2224 (Layout::add_output_section_data): Add is_dynamic_linker_section
2225 parameter. Change all callers.
2226 * layout.h (class Layout): Update declarations.
2227 * output.h (class Output_section): Add is_interp, set_is_interp,
2228 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
2229 Add is_interp_, is_dynamic_linker_section_ fields. Change
2230 generate_code_fills_at_write_ to a bitfield.
2231 * output.cc (Output_section::Output_sections): Initialize new
2233 (Output_segment::add_output_section): Add do_sort parameter.
2236 2009-11-03 Ian Lance Taylor <iant@google.com>
2239 * options.h (class General_options): Add --warn-common.
2240 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
2241 merging two common symbols.
2242 (Symbol_table::should_override): Handle --warn-common when merging
2243 a common symbol with a defined symbol. Use report_resolve_problem
2244 for multiple definitions.
2245 (Symbol_table::report_resolve_problem): New function.
2246 * symtab.h (class Symbol_table): Declare report_resolve_problem.
2248 2009-11-03 Doug Kwan <dougkwan@google.com>
2250 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
2252 (Target_arm::stub_factory): New method definition.
2253 (Target_arm::new_arm_input_section,
2254 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
2255 Target_arm::reloc_uses_thumb_bit): New method declarations.
2256 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
2257 New type definitions.
2258 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
2259 member declarations.
2260 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
2261 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
2262 New method definitions.
2264 2009-11-03 Ian Lance Taylor <iant@google.com>
2266 * options.h (class General_options): Add --warn_constructors.
2268 2009-11-03 Ian Lance Taylor <iant@google.com>
2271 * defstd.cc (in_section): Add entries for __rel_iplt_start,
2272 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
2274 2009-11-03 Ian Lance Taylor <iant@google.com>
2277 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
2278 --msgid-bugs-address.
2279 (install-pdf): New target.
2280 (install-data_yes): Look up one directory to find mkinstalldirs.
2282 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
2284 * po/Make-in (.po.gmo): Don't generate .gmo files in source
2287 2009-10-30 Doug Kwan <dougkwan@google.com>
2289 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
2291 2009-10-30 Doug Kwan <dougkwan@google.com>
2293 * arm.cc (Stub_addend_reader): New struct template definition
2294 and partial specializations.
2295 (Stub_addend_reader::operator()): New method definition for a
2296 partially specialized template.
2298 2009-10-30 Doug Kwan <dougkwan@google.com>
2300 * arm.cc (Arm_relobj::processor_specific_flags): New method
2302 (Arm_relobj::do_read_symbols): New method declaration.
2303 (Arm_relobj::processor_specific_flags_): New data member declaration.
2304 (Arm_dynobj): New class definition.
2305 (Target_arm::do_finalize_sections): Add input_objects parameter.
2306 (Target_arm::do_adjust_elf_header): New method declaration.
2307 (Target_arm::are_eabi_versions_compatible,
2308 (Target_arm::merge_processor_specific_flags): New method declaration.
2309 (Target_arm::do_make_elf_object): New overloaded method definitions
2311 (Arm_relobj::do_read_symbols): New method definition.
2312 (Arm_dynobj::do_read_symbols): Ditto.
2313 (Target_arm::do_finalize_sections): Add input_objects parameters.
2314 Merge processor-specific flags from all input objects.
2315 (Target_arm::are_eabi_versions_compatible,
2316 Target_arm::merge_processor_specific_flags,
2317 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
2318 New method definitions.
2319 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
2320 Input_objects pointer type parameter.
2321 * layout.cc (Layout::finalize): Pass input objects to target's.
2322 finalize_sections function.
2323 * output.cc (Output_file_header::do_sized_write): Set ELF file
2324 header's processor-specific flags.
2325 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
2326 Input_objects pointer type parameter.
2327 * sparc.cc (Target_sparc::do_finalize_sections): Same.
2328 * target.h (Input_objects): New forward class declaration.
2329 (Target::processor_specific_flags,
2330 Target::are_processor_specific_flags_sect): New method definitions.
2331 (Target::finalize_sections): Add input_objects parameter.
2332 (Target::Target): Initialize processor_specific_flags_ and
2333 are_processor_specific_flags_set_.
2334 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
2336 (Target::set_processor_specific_flags): New method definition.
2337 (Target::processor_specific_flags_,
2338 Target::are_processor_specific_flags_set_): New data member
2340 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
2341 Input_objects pointer type parameter.
2343 2009-10-30 Doug Kwan <dougkwan@google.com>
2345 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2347 2009-10-28 Ian Lance Taylor <iant@google.com>
2349 * object.h (class Relobj): Drop options parameter from
2350 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
2351 do_scan_relocs, do_relocate. Change all callers.
2352 (class Sized_relobj): Drop options parameters from
2353 do_gc_process_relocs, do_scan_relocs, do_relocate,
2354 do_relocate_sections, relocate_sections, emit_relocs_scan,
2355 emit_relocs_scan_reltype. Change all callers.
2356 (struct Relocate_info): Remove options field and all references to
2358 * reloc.h (class Read_relocs): Remove options constructor
2359 parameter and options_ field. Change all callers.
2360 (class Gc_process_relocs, class Scan_relocs): Likewise.
2361 (class Relocate_task): Likewise.
2362 * target-reloc.h (scan_relocs): Remove options parameter. Change
2364 (scan_relocatable_relocs): Likewise.
2365 * target.h (class Sized_target): Remove options parameter from
2366 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
2368 * gc.h (gc_process_relocs): Remove options parameter. Change all
2370 * arm.cc: Update functions to remove options parameters.
2371 * i386.cc: Likewise.
2372 * powerpc.cc: Likewise.
2373 * sparc.cc: Likewise.
2374 * x86_64.cc: Likewise.
2375 * testsuite/testfile.cc: Likewise.
2377 2009-10-28 Doug Kwan <dougkwan@google.com>
2379 * arm.cc (Arm_relobj): New class definition.
2380 (Arm_relobj::scan_sections_for_stubs,
2381 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
2382 New method definitions.
2384 2009-10-28 Cary Coutant <ccoutant@google.com>
2386 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
2387 (Plugin::cleanup_done_): New member.
2388 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
2389 (Plugin_manager::cleanup_done_): Remove.
2390 (Plugin_manager::add_input_file): Edit error message.
2391 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
2392 (Plugin_manager::cleanup): Remove use of cleanup_done_.
2394 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
2396 * fileread.cc: (File_read::View::~View): Use the new
2397 data_ownership_ filed.
2398 (File_read::~File_read): Dispose the new whole_file_view_.
2399 (File_read::open): Mmap the whole file if needed.
2400 (File_read::open): Use whole_file_view_ instead of contents_.
2401 (File_read::find_view): Use whole_file_view_ if applicable.
2402 (File_read::do_read): Use whole_file_view_ instead of contents_.
2403 (File_read::make_view): Use whole_file_view_ instead of contents_,
2404 update File_read::View::View call.
2405 (File_read::find_or_make_view): Update File_read::View::View
2407 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
2409 (File_read::View::Data_ownership): New enum.
2410 (File_read::View::View): Replace bool mapped_ with Data_ownership
2412 (File_read::View::mapped_): Remove (replaced by data_ownership_).
2413 (File_read::View::data_ownership_): New field.
2414 (File_read::contents_): Remove (replaced by whole_file_view_).
2415 (File_read::whole_file_view_): New field.
2416 * options.h (class General_options): Add --keep-files-mapped.
2418 2009-10-27 Cary Coutant <ccoutant@google.com>
2420 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
2421 * testsuite/Makefile.am (plugin_test_5): New test case.
2422 * testsuite/Makefile.in: Regenerate.
2424 2009-10-25 Doug Kwan <dougkwan@google.com>
2426 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
2427 from private to protected to allow access by child class.
2428 (Sized_relobj::do_relocate_sections): New method declaration.
2429 (Sized_relobj::relocate_sections): Virtualize.
2430 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
2431 Sized_relobj::relocate_sections. Instantiate template explicitly
2432 for different target sizes and endianity.
2434 2009-10-24 Doug Kwan <dougkwan@google.com>
2436 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
2437 (Arm_input_section::as_arm_input_section): New method.
2438 (Arm_output_section): New class definition.
2439 (Arm_output_section::create_stub_group,
2440 Arm_output_section::group_sections): New method definitions.
2442 2009-10-22 Doug Kwan <dougkwan@google.com>
2444 * arm.cc (Arm_input_section): New class definition.
2445 (Arm_input_section::init, Arm_input_section:do_write,
2446 Arm_input_section::set_final_data_size,
2447 Arm_input_section::do_reset_address_and_file_offset): New method
2450 2009-10-21 Doug Kwan <dougkwan@google.com>
2452 * arm.cc (Stub_table, Arm_input_section): New forward class
2454 (Stub_table): New class defintion.
2455 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
2456 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
2457 New method definition.
2459 2009-10-21 Doug Kwan <dougkwan@google.com>
2461 * arm.cc: Update copyright comments.
2462 (Target_arm): New forward class template declaration.
2463 (Arm_address): New type.
2464 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
2465 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
2466 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
2468 (Insn_template): Same.
2469 (DEF_STUBS): New macro.
2470 (Stub_type): New enum type.
2471 (Stub_template): New class definition.
2474 (Stub_factory): Same.
2475 (Target_arm::Target_arm): Initialize may_use_blx_ and
2476 should_force_pic_veneer_.
2477 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
2478 Target_arm::should_force_pic_veneer,
2479 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
2480 Target_arm::using_thumb_only, Target_arm:;default_target): New
2482 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
2483 New data member declarations.
2484 (Insn_template::size, Insn_template::alignment): New method defintions.
2485 (Stub_template::Stub_template): New method definition.
2486 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
2487 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
2488 (Stub_factory::Stub_factory): New method definition.
2489 * gold.h (string_hash): New template.
2490 * output.h (Input_section_specifier::hash_value): Use
2492 (Input_section_specifier::string_hash): Remove.
2493 * stringpool.cc (Stringpool_template::string_hash): Use
2496 2009-10-20 Doug Kwan <dougkwan@google.com>
2498 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
2499 symbols of relaxed input sections.
2500 * output.h (Output_section::find_relaxed_input_section): Make
2503 2009-10-16 Doug Kwan <dougkwan@google.com>
2505 * dynobj.cc (Versions::Versions): Initialize version_script_.
2506 Only insert base version symbol definition for a shared object
2507 if version script defines any version versions.
2508 (Versions::define_base_version): New method definition.
2509 (Versions::add_def): Check that base version is not needed.
2510 (Versions::add_need): Define base version lazily.
2511 * dynobj.h (Versions::define_base_version): New method declaration.
2512 (Versions::needs_base_version_): New data member declaration.
2513 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
2514 (check_DATA): Add no_version_test.stdout.
2515 (libno_version_test.so, no_version_test.o no_version_test.stdout):
2517 * testsuite/Makefile.in: Regenerate.
2518 * testsuite/no_version_test.c: New file.
2519 * testsuite/no_version_test.sh: Ditto.
2521 2009-10-16 Doug Kwan <dougkwan@google.com>
2523 * expression.cc (class Segment_start_expression): New class definition.
2524 (Segment_start_expression::value): New method definition.
2525 (script_exp_function_segment_start): Return a new
2526 Segment_start_expression.
2527 * gold/script-c.h (script_saw_segment_start_expression): New function
2529 * script-sections.cc (Script_sections::Script_sections): Initialize
2530 SAW_SEGMENT_START_EXPRESSION_ to false.
2531 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
2532 and -Tbbs options to specify section addresses if given in
2533 command line and no SEGMENT_START expression is seen in a script.
2534 * script-sections.h (Script_sections::saw_segment_start_expression,
2535 Script_sections::set_saw_segment_start_expression): New method
2537 (Script_sections::saw_segment_start_expression_): New data member
2539 * script.cc (script_saw_segment_start_expression): New function.
2540 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
2541 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
2542 script_test_7.sh and script_test_8.sh.
2543 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
2544 script_test_8.stdout.
2545 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
2546 (script_test_6, script_test_6.stdout, script_test_7,
2547 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
2548 * Makefile.in: Regenerate.
2549 * testsuite/script_test_6.sh: New file.
2550 * testsuite/script_test_6.t: Same.
2551 * testsuite/script_test_7.sh: Same.
2552 * testsuite/script_test_7.t: Same.
2553 * testsuite/script_test_8.sh: Same.
2555 2009-10-16 Doug Kwan <dougkwan@google.com>
2557 * output.cc (Output_segment::set_section_list_address): Cast
2558 expressions to unsigned long long type to avoid format warnings.
2560 2009-10-15 Ian Lance Taylor <iant@google.com>
2562 * script.cc (Script_options::add_symbol_assignment): Always add a
2563 dot assignment to script_sections_.
2564 * script-sections.cc (Script_sections::add_dot_assignment):
2565 Initialize if necessary.
2567 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
2568 program headers with no load segment if there is a linker script.
2570 * layout.cc (Layout::set_segment_offsets): Align the file offset
2571 to the segment aligment for -N or -n with no load segment.
2572 * output.cc (Output_segment::add_output_section): Don't crash if
2573 the first section is a TLS section.
2574 (Output_segment::set_section_list_addresses): Print an error
2575 message if the address moves backward in a linker script.
2576 * script-sections.cc
2577 (Output_section_element_input::set_section_addresses): Don't
2578 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
2579 (Orphan_output_section::set_section_addresses): Likewise.
2581 2009-10-15 Doug Kwan <dougkwan@google.com>
2583 * layout.cc (Layout::finish_dynamic_section): Generate tags
2584 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
2585 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
2586 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
2588 2009-10-14 Ian Lance Taylor <iant@google.com>
2590 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
2592 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
2593 data_shdr fields of relinfo.
2594 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
2595 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
2596 R_386_TLS_LDO_32, adjust based on section flags.
2597 (Target_i386::Relocate::fix_up_ldo): Remove.
2599 2009-10-13 Ian Lance Taylor <iant@google.com>
2601 Add support for -pie.
2602 * options.h (class General_options): Add -pie and
2604 (General_options::output_is_position_independent): Test -pie.
2605 (General_options::output_is_executable): Return true if not shared
2606 and not relocatable.
2607 (General_options::output_is_pie): Remove.
2608 * options.cc (General_options::finalize): Reject incompatible uses
2610 * gold.cc (queue_middle_tasks): A -pie link is not static.
2611 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
2612 * symtab.cc (Symbol::final_value_is_known): Return false if
2613 output_is_position_independent.
2614 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
2615 output_is_position_independent.
2616 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
2617 output_is_position_independent.
2618 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
2619 output_is_position_independent.
2620 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
2622 (basic_pie_test.o, basic_pie_test): New targets.
2623 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
2624 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
2625 (two_file_pie_test): New target.
2626 * testsuite/Makefile.in: Rebuild.
2627 * README: Remove note saying that -pie is not supported.
2629 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2631 * options.h (class General_options): Add -init and -fini.
2632 * layout.cc (Layout::finish_dynamic_section): Emit
2633 given init and fini functions.
2635 2009-10-13 Sriraman Tallam <tmsriram@google.com>
2637 * gc.h (gc_process_relocs): Check if icf is enabled using new
2639 * gold.cc (queue_initial_tasks): Likewise.
2640 (queue_middle_tasks): Likewise.
2641 * object.cc (do_layout): Likewise.
2642 * symtab.cc (is_section_folded): Likewise.
2643 * main.cc (main): Likewise.
2644 * reloc.cc (Read_relocs::run): Likewise.
2645 (Sized_relobj::do_scan_relocs): Likewise.
2646 * icf.cc (is_function_ctor_or_dtor): New function.
2647 (Icf::find_identical_sections): Check if function is ctor or dtor when
2649 * options.h (General_options::icf): Change option to be an enum.
2650 (Icf_status): New enum.
2651 (icf_enabled): New method.
2652 (icf_safe_folding): New method.
2653 (set_icf_status): New method.
2654 (icf_status_): New variable.
2655 * (options.cc) (General_options::finalize): Set icf_status_.
2656 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
2657 icf_test and icf_keep_unique_test to use the --icf enum flag.
2658 * testsuite/icf_safe_test.sh: New file.
2659 * testsuite/icf_safe_test.cc: New file.
2661 2009-10-12 Sriraman Tallam <tmsriram@google.com>
2663 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
2664 includes to gc.h and icf.h.
2665 * arm.cc: Include gc.h.
2666 * gold.cc: Likewise.
2667 * i386.cc: Likewise.
2668 * powerpc.cc: Likewise.
2669 * sparc.cc: Likewise.
2670 * x86_64.cc: Likewise.
2671 * gc.h: Include icf.h.
2673 2009-10-11 Ian Lance Taylor <iant@google.com>
2675 * plugin.cc: Include "gold.h" before other header files.
2677 2009-10-10 Chris Demetriou <cgd@google.com>
2679 * options.h (Input_file_argument::Input_file_type): New enum.
2680 (Input_file_argument::is_lib_): Replace with...
2681 (Input_file_argument::type_): New member.
2682 (Input_file_argument::Input_file_argument): Take Input_file_type
2683 'type' rather than boolean 'is_lib' as second argument.
2684 (Input_file_argument::is_lib): Use type_.
2685 (Input_file_argument::is_searched_file): New function.
2686 (Input_file_argument::may_need_search): Handle is_searched_file.
2687 * options.cc (General_options::parse_library): Support -l:filename.
2688 (General_options::parse_just_symbols): Update for Input_file_argument
2690 (Command_line::process): Likewise.
2691 * archive.cc (Archive::get_file_and_offset): Likewise.
2692 * plugin.cc (Plugin_manager::release_input_file): Likewise.
2693 * script.cc (read_script_file, script_add_file): Likewise.
2694 * fileread.cc (Input_file::Input_file): Likewise.
2695 (Input_file::will_search_for): Handle is_searched_file.
2696 (Input_file::open): Likewise.
2697 * readsyms.cc (Read_symbols::get_name): Likewise.
2698 * testsuite/Makefile.am (searched_file_test): New test.
2699 * testsuite/Makefile.in: Regenerate.
2700 * testsuite/searched_file_test.cc: New file.
2701 * testsuite/searched_file_test_lib.cc: New file.
2703 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2704 Ian Lance Taylor <iant@google.com>
2706 * descriptor.cc: Include <cstdio> and "binary-io.h".
2707 (Descriptors::open): Open the files in binary mode always.
2708 * script.cc (Lex::get_token): Treat \r as whitespace.
2710 2009-10-09 Ian Lance Taylor <iant@google.com>
2712 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
2714 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2715 Ian Lance Taylor <iant@google.com>
2717 * configure.ac: Check for readv function also.
2718 * fileread.cc (readv): Define if not HAVE_READV.
2719 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
2721 * config.in: Regenerate.
2722 * configure: Regenerate.
2724 2009-10-09 Doug Kwan <dougkwan@google.com>
2726 * layout.cc (Layout::make_output_section): Call target hook to make
2727 ordinary output section.
2728 (Layout::finalize): Adjust parameter list of call the
2729 Target::may_relax().
2730 * layout.h (class Layout::section_list): New method.
2731 * merge.h (Output_merge_base::entsize): Change visibility to public.
2732 (Output_merge_base::is_string, Output_merge_base::do_is_string):
2734 (Output_merge_string::do_is_string): New method.
2735 * object.cc (Sized_relobj::do_setup): renamed from
2736 Sized_relobj::set_up.
2737 * object.h (Sized_relobj::adjust_shndx,
2738 Sized_relobj::initializ_input_to_output_maps,
2739 Sized_relobj::free_input_to_output_maps): Change visibilities to
2741 (Sized_relobj::setup): Virtualize.
2742 (Sized_relobj::do_setup): New method declaration.
2743 (Sized_relobj::invalidate_section_offset,
2744 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2745 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2746 * options.cc (parse_int): New function.
2747 * options.h (parse_int): New declaration.
2748 (DEFINE_int): New macro.
2749 (stub_group_size): New option.
2750 * output.cc (Output_section::Output_section): Initialize memebers
2751 merge_section_map_, merge_section_by_properties_map_,
2752 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2753 (Output_section::add_input_section): Handled deferred code-fill
2754 generation and remove an old comment.
2755 (Output_section::add_relaxed_input_section): New method definition.
2756 (Output_section::add_merge_input_section): Use merge section by
2757 properties map to speed to search. Update merge section maps
2759 (Output_section::build_relaxation_map): New method definition.
2760 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2762 (Output_section::relax_input_section): Renamed to
2763 Output_section::convert_input_sections_to_relaxed_sections and change
2764 interface to take a vector of pointers to relaxed sections.
2765 (Output_section::find_merge_section,
2766 Output_section::find_relaxed_input_section): New method definitions.
2767 (Output_section::is_input_address_mapped,
2768 Output_section::output_offset, Output_section::output_address):
2769 Use output section data maps to speed up searching.
2770 (Output_section::find_starting_output_address): Add comments.
2771 (Output_section::do_write,
2772 Output_section::write_to_postprocessing_buffer): Do code-fill
2773 generation as appropriate.
2774 (Output_section::get_input_sections): Invalidate relaxed input section
2776 (Output_section::restore_states): Adjust type of checkpoint .
2777 Invalidate relaxed input section map.
2778 * output.h (Output_merge_base): New class declaration.
2779 (Input_section_specifier): New class defintion.
2780 (class Output_relaxed_input_section) Change base class to
2781 Output_section_data_build.
2782 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2783 base class initializer.
2784 (Output_section::add_relaxed_input_section): New method declaration.
2785 (Output_section::Input_section): Change visibility to protected.
2786 (Output_section::Input_section::relobj,
2787 Output_section::Input_section::shndx): Handle relaxed input sections.
2788 Output_section::input_sections) Change visibility to protected. Also
2789 define overload to return a non-const pointer.
2790 (Output_section::Merge_section_properties): New class defintion.
2791 (Output_section::Merge_section_by_properties_map,
2792 Output_section::Output_section_data_by_input_section_map,
2793 Output_section::Relaxation_map): New types.
2794 (Output_section::relax_input_section): Rename method to
2795 Output_section::convert_input_sections_to_relaxed_sections and change
2796 interface to take a vector of relaxed section pointers.
2797 (Output_section::find_merge_section,
2798 Output_section::find_relaxed_input_section,
2799 Output_section::build_relaxation_map,
2800 Output_section::convert_input_sections_in_list_to_relaxed_sections):
2801 New method declarations.
2802 (Output_section::merge_section_map_
2803 Output_section::merge_section_by_properties_map_,
2804 Output_section::relaxed_input_section_map_,
2805 Output_section::is_relaxed_input_section_map_valid_,
2806 Output_section::generate_code_fills_at_write_): New data members.
2807 * script-sections.cc
2808 (Output_section_element_input::set_section_addresses): Call
2809 current_data_size and addralign methods of relaxed input sections.
2810 (Orphan_output_section::set_section_addresses): Call current_data_size
2811 and addralign methods of relaxed input sections.
2812 * symtab.cc (Symbol_table::compute_final_value): Extract template
2813 from the body of Symbol_table::sized_finalize_symbol.
2814 (Symbol_table::sized_finalized_symbol): Call
2815 Symbol_table::compute_final_value.
2816 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2817 (Symbol_table::compute_final_value): New templated method declaration.
2818 * target.cc (Target::do_make_output_section): New method defintion.
2819 * target.h (Target::make_output_section): New method declaration.
2820 (Target::relax): Add more parameters for input objects, symbol table
2821 and layout. Adjust call to do_relax.
2822 (Target::do_make_output_section): New method declaration.
2823 (Target::do_relax): Add parameters for input objects, symbol table
2826 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2828 * pread.c: Include stdio.h.
2830 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2832 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2835 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2837 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2838 Change read_shndx type to unsigned int.
2839 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2841 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2842 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2843 Change read_shndx type to unsigned int.
2844 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2846 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2847 * layout.cc (Layout::create_symtab_sections): Cast the result of
2848 local_symcount * symsize to off_t in the gold_assert.
2850 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2852 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2853 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2855 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2856 (Arm_relocate_functions::thm_abs5): New function.
2857 (Arm_relocate_functions::abs12): New function.
2858 (Arm_relocate_functions::abs16): New function.
2859 (Arm_relocate_functions::base_abs): New function.
2860 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2861 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
2862 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2864 (Scan::global): Likewise.
2865 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2866 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2867 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2868 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2871 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2873 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2874 (Arm_relocate_functions::movt_prel): New function.
2875 (Arm_relocate_functions::thm_movw_prel_nc): New function.
2876 (Arm_relocate_functions::thm_movt_prel): New function.
2877 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2878 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2879 (Scan::global, Relocate::relocate): Likewise.
2880 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2882 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2884 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2885 Incremental_checker.
2886 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2888 (class Incremental_inputs_header): New class.
2889 (Incremental_inputs_header_writer): Edit comment.
2890 (Incremental_inputs_entry): New class.
2891 (Incremental_inputs_entry_writer): Edit comment.
2892 (Sized_incremental_binary::do_find_incremental_inputs_section):
2893 Add *strtab_shndx parameter, fill it.
2894 (Sized_incremental_binary::do_check_inputs): New method.
2895 (Incremental_checker::can_incrementally_link_output_file): Use
2896 Sized_incremental_binary::check_inputs.
2897 (Incremental_inputs::report_command_line): Save command line in
2900 (Incremental_binary::find_incremental_inputs_section): New
2902 (Incremental_binary::do_find_incremental_inputs_section): Add
2903 strtab_shndx parameter.
2904 (Incremental_binary::do_check_inputs): New pure virtual method.
2905 (Sized_incremental_binary::do_check_inputs): Declare.
2906 (Incremental_checker::Incremental_checker): Add incremental_inputs
2907 parameter, use it to initialize incremental_inputs_.
2908 (Incremental_checker::incremental_inputs_): New field.
2909 (Incremental_checker::command_line): New method.
2910 (Incremental_checker::inputs): New method.
2911 (Incremental_checker::command_line_): New field.
2913 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2915 * incremental.cc: Include <cstdarg> and "target-select.h".
2916 (vexplain_no_incremental): New function.
2917 (explain_no_incremental): New function.
2918 (Incremental_binary::error): New method.
2919 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2921 (make_sized_incremental_binary): New function.
2922 (open_incremental_binary): New function.
2923 (can_incrementally_link_file): Add checks if output is ELF and has
2925 * incremental.h: Include "elfcpp_file.h" and "output.h".
2926 (Incremental_binary): New class.
2927 (Sized_incremental_binary): New class.
2928 (open_incremental_binary): Declare.
2929 * object.cc (is_elf_object): Use
2930 elfcpp::Elf_recognizer::is_elf_file.
2931 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2932 * output.h (Output_file::filesize): New method.
2934 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2936 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2938 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2939 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2941 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2943 (Arm_relocate_functions::movw_abs_nc): New function.
2944 (Arm_relocate_functions::movt_abs): New function.
2945 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2946 (Arm_relocate_functions::thm_movt_abs): New function.
2947 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2948 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2949 (Scan::global): Likewise.
2950 (Relocate::relocate): Likewise.
2951 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2953 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2955 * arm.cc (Arm_relocate_functions::got_prel) New function.
2956 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2957 (Relocate::relocate): Likewise.
2958 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2960 2009-10-06 Ian Lance Taylor <iant@google.com>
2962 * options.h (class General_options): Define
2963 split_stack_adjust_size parameter.
2964 * object.h (class Object): Add uses_split_stack_ and
2965 has_no_split_stack_ fields. Add uses_split_stack and
2966 has_no_split_stack accessor functions. Declare
2967 handle_split_stack_section.
2968 (class Reloc_symbol_changes): Define.
2969 (class Sized_relobj): Define Function_offsets. Declare
2970 split_stack_adjust, split_stack_adjust_reltype, and
2972 * object.cc (Object::handle_split_stack_section): New function.
2973 (Sized_relobj::do_layout): Call handle_split_stack_section.
2974 * dynobj.cc (Sized_dynobj::do_layout): Call
2975 handle_split_stack_section.
2976 * reloc.cc (Sized_relobj::relocate_sections): Call
2977 split_stack_adjust for executable sections in split_stack
2978 objects. Pass reloc_map to relocate_section.
2979 (Sized_relobj::split_stack_adjust): New function.
2980 (Sized_relobj::split_stack_adjust_reltype): New function.
2981 (Sized_relobj::find_functions): New function.
2982 * target-reloc.h: Include "object.h".
2983 (relocate_section): Add reloc_symbol_changes parameter. Change
2985 * target.h (class Target): Add calls_non_split method. Declare
2986 do_calls_non_split virtual method. Declare match_view and
2988 * target.cc: Include "elfcpp.h".
2989 (Target::do_calls_non_split): New function.
2990 (Target::match_view): New function.
2991 (Target::set_view_to_nop): New function.
2992 * gold.cc (queue_middle_tasks): Give an error if mixing
2993 split-stack and non-split-stack objects with -r.
2994 * i386.cc (Target_i386::relocate_section): Add
2995 reloc_symbol_changes parameter.
2996 (Target_i386::do_calls_non_split): New function.
2997 * x86_64.cc (Target_x86_64::relocate_section): Add
2998 reloc_symbol_changes parameter.
2999 (Target_x86_64::do_calls_non_split): New function.
3000 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
3002 * powerpc.cc (Target_powerpc::relocate_section): Add
3003 reloc_symbol_changes parameter.
3004 * sparc.cc (Target_sparc::relocate_section): Add
3005 reloc_symbol_changes parameter.
3006 * configure.ac: Call AM_CONDITIONAL for the default target.
3007 * configure: Rebuild.
3008 * testsuite/Makefile.am (TEST_AS): New variable.
3009 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
3010 (check_DATA): Add split_i386 and split_x86_64 files.
3011 (SPLIT_DEFSYMS): Define.
3012 (split_i386_[1234n].o): New targets.
3013 (split_i386_[124]): New targets.
3014 (split_i386_[1234r].stdout): New targets.
3015 (split_x86_64_[1234n].o): New targets.
3016 (split_x86_64_[124]): New targets.
3017 (split_x86_64_[1234r].stdout): New targets.
3018 (MOSTLYCLEANFILES): Add new executables.
3019 * testsuite/split_i386.sh: New file.
3020 * testsuite/split_x86_64.sh: New file.
3021 * testsuite/split_i386_1.s: New file.
3022 * testsuite/split_i386_2.s: New file.
3023 * testsuite/split_i386_3.s: New file.
3024 * testsuite/split_i386_4.s: New file.
3025 * testsuite/split_i386_n.s: New file.
3026 * testsuite/split_x86_64_1.s: New file.
3027 * testsuite/split_x86_64_2.s: New file.
3028 * testsuite/split_x86_64_3.s: New file.
3029 * testsuite/split_x86_64_4.s: New file.
3030 * testsuite/split_x86_64_n.s: New file.
3031 * testsuite/testfile.cc (Target_test): Update relocation_section
3033 * testsuite/Makefile.in: Rebuild.
3035 2009-10-06 Ian Lance Taylor <iant@google.com>
3037 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
3038 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
3039 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
3040 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
3041 the address on ldo_addrs_.
3042 (Target_i386::Relocate::fix_up_ldo): New function.
3044 2009-10-06 Rafael Espindola <espindola@google.com>
3046 * plugin.cc (add_input_library): New.
3047 (Plugin::load): Add add_input_library to tv.
3048 (Plugin_manager::add_input_file): Add the is_lib argument.
3049 (add_input_file): Update call to Plugin_manager::add_input_file.
3050 (add_input_library): New.
3051 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
3053 2009-09-30 Doug Kwan <dougkwan@google.com>
3055 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
3056 symbol and call Symbol::may_need_copy_reloc to determine if
3057 a copy reloc is needed.
3058 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
3059 nocopyreloc is given in command line.
3060 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
3061 given in command line.
3062 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
3063 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
3064 of the removed Target_i386::may_need_copy_reloc.
3065 * options.h (copyreloc): New option with default value false.
3066 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
3067 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
3068 instead of the removed Target_powerpc::may_need_copy_reloc.
3069 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
3070 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
3071 instead of the removed Target_sparc::may_need_copy_reloc.
3072 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
3073 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
3074 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
3075 instead of the removed Target_x86_64::may_need_copy_reloc.
3077 2009-09-30 Ian Lance Taylor <iant@google.com>
3079 * object.h (class Object): Remove target_ field, and target,
3080 sized_target, and set_target methods.
3081 (Object::sized_target): Remove.
3082 (class Sized_relobj): Update declarations. Remove sized_target.
3083 * object.cc (Sized_relobj::setup): Remove target parameter.
3085 (Input_objects::add_object): Don't do anything with the target.
3086 (make_elf_sized_object): Add punconfigured parameter. Change all
3087 callers. Set or test parameter target.
3088 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
3090 * parameters.cc (Parameters::set_target): Change parameter type to
3092 (Parameters::default_target): Remove.
3093 (set_parameters_target): Change parameter type to be non-const.
3094 (parameters_force_valid_target): New function.
3095 (parameters_clear_target): New function.
3096 * parameters.h (class Parameters): Update declarations. Remove
3097 default_target method. Add sized_target and clear_target
3098 methods. Change target_ to be non-const.
3099 (set_parameters_target): Update declaration.
3100 (parameters_force_valid_target): Declare.
3101 (parameters_clear_target): Declare.
3102 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
3103 as NULL if we aren't searching.
3104 (Add_symbols::run): Don't check for compatible target.
3105 * fileread.cc (Input_file::open_binary): Call
3106 parameters_force_valid_target.
3107 * gold.cc (queue_middle_tasks): Likewise.
3108 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
3109 set_target on object.
3110 * dynobj.h (class Sized_dynobj): Update declarations.
3111 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
3112 make_elf_object returns NULL.
3113 (Archive::include_member): Don't check whether object target is
3115 * output.cc (Output_section::add_input_section): Get target from
3117 (Output_section::relax_input_section): Likewise.
3118 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
3120 (Sized_relobj::do_scan_relocs): Likewise.
3121 (Sized_relobj::relocate_sections): Likewise.
3122 * resolve.cc (Symbol_table::resolve): Likewise.
3123 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
3124 parameter. Change all callers.
3125 (Symbol_table::add_from_object): Get target from parameters.
3126 (Symbol_table::add_from_relobj): Don't check object target.
3127 (Symbol_table::add_from_dynobj): Likewise.
3128 (Symbol_table::define_special_symbol): Get target from
3130 * symtab.h (class Symbol_table): Update declaration.
3131 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
3132 parameter. Change all callers. Clear parameter target.
3133 (Binary_test): Test target here.
3134 * testsuite/object_unittest.cc (gold_testsuite): Remove
3135 target_test_pointer parameter. Change all callers.
3136 (Object_test): Test target here.
3138 2009-09-26 Ian Lance Taylor <iant@google.com>
3140 * testsuite/initpri1.c: Don't try to use constructor priorities if
3141 compiling with gcc before 4.3.
3143 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
3145 * testsuite/retain_symbols_file_test.sh (check_present): Change
3146 output file name to retain_symbols_file_test.stdout.
3147 (check_absent): Likewise.
3149 2009-09-18 Craig Silverstein <csilvers@google.com>
3151 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
3152 * options.cc: Include <cerrno> and <fstream>.
3153 (General_options::finalize): Parse -retain-symbols-file tag.
3154 * options.h: New flag.
3155 (General_options): New method should_retain_symbol, new
3156 variable symbols_to_retain.
3157 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
3158 should_retain_symbol map.
3159 * testsuite/Makefile.am (retain_symbols_file_test): New test.
3160 * testsuite/Makefile.in: Regenerate.
3161 * testsuite/retain_symbols_file_test.sh: New file.
3163 2009-09-18 Nick Clifton <nickc@redhat.com>
3165 * po/es.po: Updated Spanish translation.
3167 2009-09-17 Doug Kwan <dougkwan@google.com>
3169 * debug.h (DEBUG_RELAXATION): New constant.
3170 (DEBUG_ALL): Add DEBUG_RELAXATION.
3171 (debug_string_to_enum): Add relaxation debug option.
3173 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
3174 Layout::Relaxation_debug_check::read_sections,
3175 Layout::Relaxation_debug_check::read_sections): New method definitions.
3176 (Layout::Layout): Initialize data members
3177 record_output_section_data_from_scrips_,
3178 script_output_section_data_list_ and relaxation_debug_check_.
3179 (Layout::save_segments, Layout::restore_segments,
3180 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3181 Layout::relaxation_loop_body): New method definitions.
3182 (Layout::finalize): Support relaxation. Move section layout code to
3183 Layout::relaxation_loop_body.
3184 (Layout::set_asection_address_from_script): Move code for orphan
3185 section placement out.
3186 (Layout::place_orphan_sections_in_script): New method definition.
3187 * layout.h (Output_segment_headers, Output_file_header):
3188 New forward class declarations.
3189 (Layout::~Layout): Define.
3190 (Layout::new_output_section_data_from_script): New method definition.
3191 (Layout::place_orphan_sections_in_script): New method declaration.
3192 (Layout::Segment_states): New type declaration.
3193 (Layout::save_segments, Layout::restore_segments,
3194 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3195 Layout::relaxation_loop_body): New method declarations.
3196 (Layout::Output_section_data_list): New type declaration.
3197 (Layout::Relaxation_debug_check): New class definition.
3198 (Layout::record_output_section_data_from_script_,
3199 Layout::script_output_section_data_list_, Layout::segment_states_,
3200 Layout::relaxation_debug_check_): New data members.
3201 * output.cc: (Output_section_headers::do_size): New method definition.
3202 (Output_section_headers::Output_section_headers): Move size
3203 computation to Output_section_headers::do_size.
3204 (Output_segment_headers::do_size): New method definition.
3205 (Output_file_header::Output_file_header): Move size computation to
3206 Output_file_header::do_size and call it.
3207 (Output_file_header::do_size): New method definition.
3208 (Output_data_group::Output_data_group): Adjust call to
3209 Output_section_data.
3210 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
3211 (Output_symtab_xindex::do_write): Add array bound check.
3212 (Output_section::Input_section::print_to_mapfile): Handle
3213 RELAXED_INPUT_SECTION_CODE.
3214 (Output_section::Output_section): Initialize data member checkpoint_.
3215 (Output_section::~Output_section): Delete checkpoint object pointed
3217 (Output_section::add_input_section): Always add an Input_section if
3219 (Output_section::add_merge_input_section): Add assert.
3220 (Output_section::relax_input_section): New method definition.
3221 (Output_section::set_final_data_size): Set load address to zero for
3222 an unallocated section.
3223 (Output_section::do_address_and_file_offset_have_reset_values):
3224 New method definition.
3225 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
3226 Handle relaxed input section.
3227 (Output_section::sort_attached_input_sections): Checkpoint input
3228 section list lazily.
3229 (Output_section::get_input_sections): Change type of input_sections to
3230 list of Simple_input_section pointers. Checkpoint input section list
3231 lazily. Also handle relaxed input sections.
3232 (Output_section::add_input_section_for_script): Take a reference to
3233 a Simple_input_section object instead of Relobj pointer and section
3234 index as parameter. Handle relaxed input sections.
3235 (Output_section::save_states, Output_section::restore_states): New
3237 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
3238 (Output_data::is_data_size_fixed): New method definition.
3239 (Output_data::reset_addresss_and_file_offset): Do not reset data size
3241 (Output_data::address_and_file_offset_have_reset_values): New method
3243 (Output_data::do_address_and_file_offset_have_reset_values): New method
3245 (Output_data::set_data_size): Check that data size is not fixed.
3246 (Output_data::fix_data_size): New method definition.
3247 (Output_data::is_data_size_fixed_): New data member.
3248 (Output_section_headers::set_final_data_size): New method definition.
3249 (Output_section_headers::do_size): New method declaration.
3250 (Output_segment_headers::set_final_data_size): New method definition.
3251 (Output_segment_headers::do_size): New method declaration.
3252 (Output_file_header::set_final_data_size)::New method definition.
3253 (Output_file_header::do_size)::New method declaration.
3254 (Output_section_data::Output_section_data): Add new parameter
3255 is_data_size_fixed and use it to fix data size.
3256 (Output_data_const::Output_data_const): Adjust call to base class
3257 constructor and fix data size.
3258 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
3259 base class constructor and fix data size.
3260 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
3261 base class constructor and fix data size.
3262 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
3263 class constructor and fix data size.
3264 (Output_data_group::set_final_data_size): New method definition.
3265 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
3266 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
3267 class constructor and fix data size.
3268 (Output_relaxed_input_section): New class definition.
3269 (Output_section::Simple_input_section): New class definition.
3270 (Output_section::get_input_sections): Adjust parameter list.
3271 (Output_section::add_input_section_for_script): Same.
3272 (Output_section::save_states, Output_section::restore_states,
3273 Output_section::do_address_and_file_offset_have_reset_values,
3274 (Output_section::Input_section::Input_section): Handle
3275 RELAXED_INPUT_SECTION_CODE. Add new overload for
3276 Output_relaxed_input_section.
3277 (Output_section::Input_section::is_input_section,
3278 Output_section::Input_section::set_output_section): Handle relaxed
3280 (Output_section::Input_section::is_relaxed_input_section,
3281 Output_section::Input_section::output_section_data,
3282 Output_section::Input_section::relaxed_input_section): New method
3284 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
3286 (Output_section::Input_section::u1_): Update comments.
3287 (Output_section::Input_section::u2_): Add new union member poris.
3288 (Output_section::Checkpoint_output_section): New classs definition.
3289 (Output_section::relax_input_section): New method declaration.
3290 (Output_section::checkpoint_): New data member.
3291 (Output_segment): Update comments.
3292 (Output_segment::Output_segment): Un-privatize copy constructor.
3293 (Output_segment::operator=): Un-privatize.
3294 * script-sections.cc (Output_section_element::Input_section_list):
3295 Change element type to Output_section::Simple_input_section.
3296 (Output_section_element_dot_assignment::set_section_addresses):
3297 Register output section data for relaxation clean up.
3298 (Output_data_exression::Output_data_expression): Adjust call to base
3299 constructor to fix data size.
3300 (Output_section_element_data::set_section_addresses): Register
3301 Output_data_expression object for relaxation clean up.
3302 (struct Input_section_info): Replace Relobj pointer and section index
3303 pair with Output_section::Simple_input_section and Convert struct to a
3305 (Input_section_sorter::operator()): Adjust access to
3306 Input_section_info data member to use accessors.
3307 (Output_section_element_input::set_section_addresses): Use layout
3308 parameter. Adjust code to use Output_section::Simple_input_section
3309 and Input_secction_info classes. Register filler for relaxation
3311 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
3312 and section index pair with Output_section::Simple_input_section
3313 class. Adjust code accordingly.
3314 (Phdrs_element::release_segment): New method definition.
3315 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
3317 (Script_sections::release_segments): New method definition.
3318 * gold/script-sections.h (Script_sections::release_segments): New
3320 * gold/target.h (Target::may_relax, Target::relax,
3321 Target::do_may_relax, Target::do_relax): New method definitions.
3323 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3325 * arm.cc (has_signed_unsigned_overflow): New function.
3326 (Arm_relocate_functions::abs8): New function.
3327 (Target_arm::Scan::local): Handle R_ARM_ABS8.
3328 (Target_arm::Scan::global): Likewise.
3329 (Target_arm::relocate::relocate): Likewise.
3330 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3333 2009-09-16 Cary Coutant <ccoutant@google.com>
3335 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
3336 * testsuite/Makefile.in: Regenerate.
3338 2009-09-11 Nick Clifton <nickc@redhat.com>
3340 * po/gold.pot: Updated by the Translation project.
3342 2009-09-08 Cary Coutant <ccoutant@google.com>
3344 * output.cc (Output_file::open): Add execute permission to empty file.
3345 * testsuite/Makefile.am (permission_test): New test.
3346 * testsuite/Makefile.in: Regenerate.
3348 2009-09-02 Ian Lance Taylor <iant@google.com>
3350 * output.cc (Output_file::resize): Call map_no_anonymous rather
3353 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
3355 * gold.cc: Include "incremental.h".
3356 (queue_initial_tasks): Call Incremental_checker methods.
3357 * incremental.cc: Include "output.h".
3358 (Incremental_checker::can_incrementally_link_output_file): New
3360 * incremental.h (Incremental_checker): New class.
3362 * output.cc (Output_file::open_for_modification): New method.
3363 (Output_file::map_anonymous): Changed return type to bool. Record
3365 (Output_file::map_no_anonymous): New method, broken out of map.
3366 (Output_file::map): Use map_no_anonymous and map_anonymous.
3367 * output.h (class Output_file): Update declarations.
3369 2009-08-24 Cary Coutant <ccoutant@google.com>
3371 * options.h (Command_line::Pre_options): New class.
3372 (Command_line::pre_options): New member.
3373 * options.cc (gold::options::ready_to_register): New variable.
3374 (One_option::register_option): Do nothing if not registering options.
3375 Assert if same short option registered twice.
3376 (General_options::General_options): Turn off option registration when
3378 (Command_line::Pre_options::Pre_options): New constructor.
3380 2009-08-24 Cary Coutant <ccoutant@google.com>
3382 * options.h (General_options::no_keep_memory): Remove incorrect
3385 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3387 * Makefile.am (am__skiplex, am__skipyacc): New.
3388 * Makefile.in: Regenerate.
3390 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3392 * Makefile.am (AM_CPPFLAGS): Renamed from ...
3393 (INCLUDES): ... this.
3394 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
3395 (AM_CPPFLAGS): Renamed from ...
3396 (INCLUDE): ... this.
3397 * Makefile.in, testsuite/Makefile.in: Regenerate.
3399 * Makefile.in: Regenerate.
3400 * aclocal.m4: Likewise.
3401 * config.in: Likewise.
3402 * configure: Likewise.
3403 * testsuite/Makefile.in: Likewise.
3405 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3406 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3407 * Makefile.in: Regenerate.
3408 * testsuite/Makefile.in: Regenerate.
3410 2009-08-19 Cary Coutant <ccoutant@google.com>
3412 * resolve.cc (Symbol_table::resolve): Don't complain about defined
3413 symbols in shared libraries overridden by hidden or internal symbols
3414 in the main program.
3416 2009-08-19 Chris Demetriou <cgd@google.com>
3418 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
3419 checking source file names in error messages.
3421 2009-08-18 Doug Kwan <dougkwan@google.com>
3423 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
3424 an elcpp::Ehdr as parameter. Adjust call to set_target.
3425 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
3426 an elfcpp::Ehdr as parameter.
3427 * object.cc (Object::set_target): Remove the version that looks up
3428 a target and sets it.
3429 (Sized_relobj::setup): Take a Target object instead of
3430 an elfcpp::Ehdr as parameter. Adjust call to set_target.
3431 (make_elf_sized_object): Find target and ask target to
3433 * object.h: (Object::set_target): Remove the version that looks up
3434 a target and sets it.
3435 (Sized_relobj::setup): Take a Target object instead of
3436 an elfcpp:Ehdr as parameter.
3437 * target.cc: Include dynobj.h.
3438 (Target::do_make_elf_object_implementation): New.
3439 (Target::do_make_elf_object): New.
3440 * target.h (Target::make_elf_object): New template declaration.
3441 (Target::do_make_elf_object): New method declarations.
3442 (Target::do_make_elf_object_implementation): New template declaration.
3444 2009-08-14 Ian Lance Taylor <iant@google.com>
3446 * gold.h (FUNCTION_NAME): Define.
3447 (gold_unreachable): Use FUNCTION_NAME.
3449 2009-08-12 Sriraman Tallam <tmsriram@google.com>
3451 * icf.cc (Icf::find_identical_sections): Issue a warning when a
3452 symbol in the --keep-unique list is not found.
3454 2009-08-12 Sriraman Tallam <tmsriram@google.com>
3456 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
3457 been maked as --keep-unique.
3458 (Icf::unfold_section): New function.
3459 * icf.h (Icf::unfold_section): New function.
3460 * options.h (General_options::keep_unique): New option.
3461 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
3462 * testsuite/Makefile.in: Regenerate.
3463 * testsuite/icf_keep_unique_test.sh: New file.
3464 * testsuite/icf_keep_unique_test.cc: New file.
3466 2009-08-12 Cary Coutant <ccoutant@google.com>
3469 * resolve.cc (Symbol_table::resolve): Check for references from
3470 dynamic objects to hidden and internal symbols.
3471 * testsuite/Makefile.am (hidden_test.sh): New test.
3472 * testsuite/Makefile.in: Regenerate.
3473 * testsuite/hidden_test.sh: New script.
3474 * testsuite/hidden_test_1.c: New test source.
3475 * testsuite/hidden_test_main.c: New test source.
3477 2009-08-11 Doug Kwan <dougkwan@google.com>
3479 * arm.cc: Update comments.
3480 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
3481 segment to locate the .ARM.exidx section if present.
3483 2009-08-09 Doug Kwan <dougkwan@google.com>
3485 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
3488 2009-08-07 Sriraman Tallam <tmsriram@google.com>
3489 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
3492 2009-08-06 Sriraman Tallam <tmsriram@google.com>
3494 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
3495 valid tls_segment only for non-debug-section relocations.
3496 * testsuite/Makefile.am: Add gc_tls_test.
3497 * testsuite/Makefile.in: Regenerate.
3498 * testsuite/gc_tls_test.cc: New file.
3499 * testsuite/gc_tls_test.sh: New file.
3501 2009-08-05 Sriraman Tallam <tmsriram@google.com>
3505 * Makefile.am (CCFILES): Add icf.cc.
3507 * Makefile.in: Regenerate.
3508 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
3509 * gc.h (gc_process_relocs): Populate lists used by icf to contain
3510 section, symbol and addend information for the relocs.
3511 * gold.cc (queue_middle_tasks): Call identical code folding.
3512 * gold.h: Add defines for multimap.
3513 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
3514 to the call of finalize_local_symbols.
3515 * main.cc (main): Create object of class Icf.
3516 * object.cc (Sized_relobj::do_layout): Allow this function to be
3517 called twice during icf.
3518 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
3519 to sections marked as identical by icf.
3520 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
3522 (Sized_relobj::do_section_entsize): New function.
3523 * object.h (Object::section_entsize): New function.
3524 (Object::do_section_entsize): New pure virtual function.
3525 (Relobj::finalize_local_symbols): Add new parameter.
3526 (Relobj::do_section_entsize): New function.
3527 * options.h (General_options::icf): New option.
3528 (General_options::icf_iterations): New option.
3529 (General_options::print_icf_sections): New option.
3530 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
3531 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
3532 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
3534 * symtab.cc (Symbol_table::is_section_folded): New function.
3535 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
3536 to sections marked as identical by icf.
3537 * symtab.h (Symbol_table::set_icf): New function.
3538 (Symbol_table::icf): New function.
3539 (Symbol_table::is_section_folded): New function.
3540 (Symbol_table::icf_): New data member.
3541 * target-reloc.h (relocate_section): Ignore sections folded by icf.
3542 * testsuite/Makefile.am: Add commands to build icf_test.
3543 * testsuite/Makefile.in: Regenerate.
3544 * testsuite/icf_test.sh: New file.
3545 * testsuite/icf_test.cc: New file.
3547 2009-07-24 Chris Demetriou <cgd@google.com>
3549 * layout.cc (is_compressible_debug_section): Fix incorrect
3550 comment about compressed section names.
3552 2009-07-20 Ian Lance Taylor <ian@airs.com>
3555 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
3557 2009-07-16 Ian Lance Taylor <iant@google.com>
3560 * layout.h: #include <map>.
3561 (class Kept_section): Change from struct to class. Add accessors
3562 and setters. Add section size to Comdat_group mapping. Change
3563 Comdat_group to std::map. Add is_comdat_ field. Add
3564 linkonce_size field in union.
3565 (class Layout): Update declaration of find_or_add_kept_section.
3566 Don't declare find_kept_object.
3567 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
3568 parameter. Add object, shndx, is_comdat, and is_group_name
3569 parameters. Change all callers. Adjust for new Kept_section.
3570 (Layout::find_kept_object): Remove.
3571 * object.cc (Sized_relobj::include_section_group): Update use of
3572 Kept_section. Rename secnum to shndx. Only record
3573 Kept_comdat_section if sections are the same size.
3574 (Sized_relobj::include_linkonce_section): Update use of
3575 Kept_section. Only record Kept_comdat_section if sections are the
3576 same size. Set size of linkonce section.
3577 (Sized_relobj::map_to_kept_section): Update call to
3578 get_kept_comdat_section.
3579 * object.h (class Sized_relobj): Rename fields in
3580 Kept_comdat_section to drop trailing underscores; change object
3581 field to Relobj*. Change Kept_comdat_section_table to store
3582 struct rather than pointer.
3583 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
3584 Add kept_object and kept_shndx parameters. Change all callers.
3585 (Sized_relobj::get_kept_comdat_section): Change return type to
3586 bool. Add kept_object and kept_shndx parameters. Change all
3588 * plugin.cc (Pluginobj::include_comdat_group): Update call to
3589 Layout::find_or_add_kept_section.
3591 2009-07-09 Ian Lance Taylor <iant@google.com>
3593 * merge.cc (Object_merge_map::initialize_input_to_output_map):
3594 Reserve space in the hash table.
3596 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
3598 * fileread.cc (File_read::get_mtime): New method.
3599 * fileread.h (Timespec): New structure.
3600 (File_read::get_mtime): New method.
3601 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
3602 Renamed from timestamp_nsec.
3603 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
3605 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
3607 (Incremental_inputs::report_archive): Save mtime; style fix.
3608 (Incremental_inputs::report_obejct): Save mtime; style fix.
3609 (Incremental_inputs::report_script): Save mtime; style fix.
3610 (Incremental_inputs::finalize_inputs): Style fix.
3611 (Incremental_inputs::finalize): Style fix.
3612 (Incremental_inputs::create_input_section_data): Store inputs
3614 * incremental.h (Incremental_inputs::report_script): Add mtime
3616 (Incremental_inputs::Input_info::Input_info): Intialize only one
3618 (Incremental_inputs::Input_info::archive): Move to nameless
3620 (Incremental_inputs::Input_info::obejct): Move to nameless union.
3621 (Incremental_inputs::Input_info::script): Move to nameless union.
3622 (Incremental_inputs::mtime): New field.
3623 * script.cc (read_input_script): Pass file mtime to
3625 * script.h (Script_info::inputs): Style fix.
3627 2009-07-01 Ian Lance Taylor <ian@airs.com>
3629 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
3632 2009-06-24 Ian Lance Taylor <iant@google.com>
3635 * layout.cc (Layout::choose_output_section): If we find an
3636 existing section, update the flags.
3637 (Layout::create_notes): New function, broken out of
3639 (Layout::finalize): Don't create note sections.
3640 (Layout::create_note): Don't crash if linker script discards
3642 (Layout::create_gold_note): Likewise.
3643 (Layout::create_build_id): Likewise. Don't set
3644 after_input_sections on the section.
3645 (Layout::create_executable_stack_info): Remove target parameter.
3647 * layout.h (class Layout): Declare create_notes. Update
3648 declaration of create_executable_stack_info.
3649 * gold.cc (queue_middle_tasks): Call create_notes.
3650 * output.cc (Output_section::update_flags_for_input_section): Move
3651 here from output.h. If SHF_ALLOC flag is newly set, mark address
3653 * output.h (Output_data::mark_address_invalid): New function.
3654 (class Output_section): Only declare, not define,
3655 update_flags_for_input_section. Remove set_flags.
3657 2009-06-24 Ian Lance Taylor <iant@google.com>
3659 * script-sections.cc (Output_section_definition::
3660 set_section_addresses): Rename shadowing local load_address to
3663 2009-06-24 Ian Lance Taylor <iant@google.com>
3666 * reloc.cc (relocate_sections): Skip empty relocation sections.
3668 2009-06-23 Ian Lance Taylor <iant@google.com>
3671 * layout.cc (Layout::create_note): Use choose_output_section
3672 rather than make_output_section.
3674 2009-06-23 Ian Lance Taylor <iant@google.com>
3677 * options.cc (General_options::parse_V): Set printed_version_.
3678 (General_options::General_options): Initialize printed_version_.
3679 * options.h (class General_options): Add printed_version_ field.
3680 * gold.cc (queue_initial_tasks): If there are no input files,
3681 don't give a fatal error if we printed the version information.
3682 (queue_middle_tasks): If using -r with a shared object, give a
3683 fatal error rather than an ordinary error.
3685 2009-06-23 Ian Lance Taylor <iant@google.com>
3688 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
3689 (Layout::make_output_section): Set have_stabstr_section_ if we see
3690 a .stab*str section.
3691 (Layout::finalize): Call link_stabs_sections.
3692 (Layout::link_stabs_sections): New file.
3693 * layout.h (class Layout): Add have_stabstr_section_ field.
3694 Declare link_stabs_sections.
3696 2009-06-23 Doug Kwan <dougkwan@google.com>
3698 * Makefile.am (libgold_a_LIBADD): New.
3699 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
3700 * Makefile.in: Regenerate.
3701 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
3702 * configure: Regenerate.
3703 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
3704 * fileread.cc: Include sys/state.h
3705 * gold.h: Declare memmem and strndup if found missing.
3706 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
3708 2009-06-23 Ian Lance Taylor <iant@google.com>
3710 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
3711 * configure: Rebuild.
3713 2009-06-23 Ian Lance Taylor <iant@google.com>
3716 * object.cc (Object::section_contents): Don't try to get a view if
3717 the section has length zero.
3718 (Object::handle_gnu_warning_section): If the section is empty, use
3719 the name of the section as the warning.
3721 2009-06-23 Ian Lance Taylor <iant@google.com>
3724 * stringpool.h (class Stringpool_template): Add optimize_ field.
3725 (Stringpool_template::set_optimize): New function.
3726 * stringpool.cc (Stringpool_template::Stringpool_template):
3727 Initialize optimize_ field.
3728 (Stringpool_template::set_string_offsets): Test local optimize
3729 fild rather than parameter.
3730 * layout.cc (Layout::Layout): Call set_optimize on the section
3733 2009-06-22 Ian Lance Taylor <iant@google.com>
3736 * yyscript.y: Parse TARGET.
3737 * script.cc (script_set_target): New function.
3738 * script-c.h (script_set_target): Declare.
3739 * options.cc (General_options::string_to_object_format): Rename
3740 from string_to_object_format in anonymous namespace. Change
3742 * options.h (class General_options): Declare
3743 string_to_object_format.
3745 2009-06-22 Ian Lance Taylor <iant@google.com>
3747 * script-sections.cc (Script_sections::create_segments): Don't put
3748 program headers in a PT_LOAD segment if -n or -N.
3750 2009-06-22 Ian Lance Taylor <iant@google.com>
3753 * options.h (class General_options): Add -z lazy and -z now. Sort
3754 -z options into alphabetical order.
3755 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3757 2009-06-21 Ian Lance Taylor <iant@google.com>
3759 * layout.cc (Layout::make_output_section): Call
3760 Target::new_output_section.
3761 (Layout::attach_allocated_section_to_segment): Put large section
3762 sections in a separate load segment with the large segment flag
3764 (Layout::segment_precedes): Sort large data segments after other
3766 (align_file_offset): New static function.
3767 (Layout::set_segment_offsets): Use align_file_offset.
3768 * output.h (class Output_section): Add is_small_section_ and
3769 is_large_section_ fields.
3770 (Output_section::is_small_section): New function.
3771 (Output_section::set_is_small_section): New function.
3772 (Output_section::is_large_section): New function.
3773 (Output_section::set_is_large_section): New function.
3774 (Output_section::is_large_data_section): New function.
3775 (class Output_segment): Add is_large_data_segment_ field.
3776 (Output_segment::is_large_data_segment): New function.
3777 (Output_segment::set_is_large_data_segment): New function.
3778 * output.cc (Output_section::Output_section): Initialize new
3780 (Output_segment::Output_segment): Likewise.
3781 (Output_segment::add_output_section): Add assertion that large
3782 data sections always go in large data segments. Force small data
3783 sections to the end of the list of data sections. Force small BSS
3784 sections to the start of the list of BSS sections. For large BSS
3785 sections to the end of the list of BSS sections.
3786 * symtab.h (class Symbol): Declare is_common_shndx.
3787 (Symbol::is_defined): Check Symbol::is_common_shndx.
3788 (Symbol::is_common): Likewise.
3789 (class Symbol_table): Define enum Commons_section_type. Update
3790 declarations. Add small_commons_ and large_commons_ fields.
3791 * symtab.cc (Symbol::is_common_shndx): New function.
3792 (Symbol_table::Symbol_table): Initialize new fields.
3793 (Symbol_table::add_from_object): Put small and large common
3794 symbols in the right list.
3795 (Symbol_table::sized_finalized_symbol): Check
3796 Symbol::is_common_shndx.
3797 (Symbol_table::sized_write_globals): Likewise.
3798 * common.cc (Symbol_table::do_allocate_commons): Allocate new
3799 common symbol lists. Don't call do_allocate_commons_list if the
3801 (Symbol_table::do_allocate_commons_list): Remove is_tls
3802 parameter. Add comons_section_type parameter. Change all
3803 callers. Handle small and large common symbols.
3804 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3805 Symbol::is_common_shndx.
3806 * resolve.cc (symbol_to_bits): Likewise.
3807 * target.h (Target::small_common_shndx): New function.
3808 (Target::small_common_section_flags): New function.
3809 (Target::large_common_shndx): New function.
3810 (Target::large_common_section_flags): New function.
3811 (Target::new_output_section): New function.
3812 (Target::Target_info): Add small_common_shndx, large_common_shndx,
3813 small_common_section_flags, and large_common_section_flags
3815 (Target::do_new_output_section): New virtual function.
3816 * arm.cc (Target_arm::arm_info): Initialize new fields.
3817 * i386.cc (Target_i386::i386_info): Likewise.
3818 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3820 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3821 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3822 (Target_x86_64::do_new_output_section): New function.
3823 * configure.ac: Define conditional MCMODEL_MEDIUM.
3824 * testsuite/Makefile.am (check_PROGRAMS): Add large.
3825 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3826 (large_LDFLAGS): Define.
3827 * testsuite/large.c: New file.
3828 * testsuite/testfile.cc (Target_test::test_target_info):
3829 Initialize new fields.
3830 * configure, testsuite/Makefile.in: Rebuild.
3832 2009-06-05 Doug Kwan <dougkwan@google.com>
3834 * Makefile.am (CCFILES): Add target.cc.
3835 * Makefile.in: Regenerate.
3836 * i386.cc (class Target_i386): Define new virtual method to
3837 override do_is_local_label_name in parent.
3838 * object.cc (Sized_relobj::do_count_local_symbols): Discard
3839 local symbols if --discard-locals or -X is given.
3840 * options.h (class General_options): Declare new options
3841 '--discard-locals' and '-X' for discarding locals.
3842 * target.h (class Target): Define new methods is_local_label_name.
3843 Declare new virtual method do_is_local_label_name.
3844 * target.cc: New file.
3845 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3846 (check_SCRIPTS): Add discard_locals_test.sh.
3847 (check_DATA): Add discard_local_tests.syms.
3848 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3849 (discard_local_tests.syms, discard_locals_test.o): New make rules.
3850 * testsuite/Makefile.in: Regenerate.
3851 * testsuite/discard_locals_test.c: New file.
3852 * testsuite/discard_locals_test.sh: Same.
3854 2009-06-05 Doug Kwan <dougkwan@google.com>
3856 * object.cc (Sized_relobj::Sized_relobj): Initialize
3857 discarded_eh_frame_shndx_ to -1U.
3858 (Sized_relobj::do_layout): Record index of a discard .eh_frame
3860 (Sized_relobj::do_count_local_symbols): Skip local symbols in
3861 a discarded .eh_frame section.
3862 (Sized_relobj::do_finalize_local_symbols): Ditto.
3863 * object.h (class Sized_relobj): Declare new member
3864 discarded_eh_frame_shndx_.
3865 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3866 (local_labels_test.o, local_labels_test): New rules.
3867 * testsuite/Makefile.in: Regenerate.
3869 2009-06-04 Doug Kwan <dougkwan@google.com>
3871 * layout.cc (Layout::section_name_mapping): Add mapping for
3872 special ARM sections.
3874 2009-06-03 Doug Kwan <dougkwan@google.com>
3876 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3877 (utils::has_overflow): Same.
3879 2009-06-03 Ian Lance Taylor <iant@google.com>
3881 * layout.cc (Layout::section_name_mapping): New array, replacing
3882 Layout::linkonce_mapping.
3883 (Layout::section_name_mapping_count): New variable, replacing
3884 Layout::linkonce_mapping_count.
3885 (Layout::linkonce_output_name): Remove.
3886 (Layout::output_section_name): Rewrite.
3887 * layout.h (class Layout): Rename Linkonce_mapping to
3888 Section_name_mapping, linkonce_mapping to section_name_mapping,
3889 linkonce_mapping_count to section_name_mapping_count. Don't
3890 declare linkonce_output_name.
3892 2009-06-03 Doug Kwan <dougkwan@google.com>
3894 * gold/arm.cc (namespace utils): New.
3895 (Target_arm::reloc_is_non_pic): Define new method.
3896 (class Arm_relocate_functions): New.
3897 (Target_arm::Relocate::relocate): Handle relocation types used by
3900 2009-06-03 Ian Lance Taylor <iant@google.com>
3902 * arm.cc (Target_arm::scan::global): Use || instead of |.
3904 2009-06-02 Doug Kwan <dougkwan@google.com>
3906 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3907 issued_non_pic_error_.
3908 (class Target_arm::Scan): Declare new method check_non_pic.
3909 Define new method symbol_needs_plt_entry.
3910 Declare new data member issued_non_pic_error_.
3911 (class Target_arm::Relocate): Declare new method
3912 should_apply_static_reloc.
3913 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3914 (Target_arm::Scan::check_non_pic): Define new method.
3915 (Target_arm::Scan::local): Handle a small subset of reloc types used
3917 (Target_arm::Scan::local): Same.
3918 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3920 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3922 * incremental.cc (Incremental_inputs::report_command_line): Filter
3923 out --incremental-* options.
3925 2009-05-29 Doug Kwan <dougkwan@google.com>
3927 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3929 (class Target_arm): Update comment.
3930 (Target_arm::Target_arm): Initialize new data members GOT_,
3931 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3932 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3933 and Target_arm::rel_dyn_section.
3934 Declare new_enum Target_arm::Got_type.
3935 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3937 Update commments for member do_dynsym_value.
3938 (Target_arm::got_size, Target_arm::plt_section,
3939 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3940 new methods inside class defintion.
3941 (Target_arm::got_section): Define new method.
3942 (Target_arm::rel_dyn_section): Same.
3943 (Output_data_plt_arm): New template class.
3944 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3945 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3946 (Output_data_plt_arm::add_entry): Same.
3947 (Output_data_plt_arm::first_plt_entry): Define new
3948 static data member for PLT instruction template.
3949 (Output_data_plt_arm::plt_entry): Same.
3950 (Output_data_plt_arm::do_write): Define new method.
3951 (Target_arm::make_plt_entry): Same.
3952 (Target_arm::do_finalize_sections): Same.
3953 (Target_arm::do_dynsym_value): Same.
3955 2009-05-28 Doug Kwan <dougkwan@google.com>
3957 * Makefile.am (TARGETSOURCES): Add arm.cc.
3958 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3959 * Makefile.in: Regenerate.
3961 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3963 2009-05-26 Doug Kwan <dougkwan@google.com>
3965 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3966 (General_options::check_excluded_libs): Strip off directories in
3967 archive name before matching like GNU ld does.
3968 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3969 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3970 (exclude_libs_test_LDFLAGS): Add linker option
3971 -Wl,--exclude-libs,libexclude_libs_test_3
3972 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3973 an explicit archive without using -l.
3974 (alt/libexclude_libs_test_3.a): New make rule.
3975 * testsuite/Makefile.in: Regenerate.
3976 * testsuite/exclude_libs_test.c : Declare lib3_default().
3978 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3979 * exclude_libs_test_3.c: New file.
3981 2009-05-26 Nick Clifton <nickc@redhat.com>
3983 * po/id.po: New Indonesian translation.
3984 * po/gold.pot: Updated template file.
3986 2009-05-22 Sriraman Tallam <tmsriram@google.com>
3988 * testsuite/Makefile.am: Add -ffunction-sections to compile
3989 gc_comdat_test files. Add -Wl,--gc-sections to build
3991 * testsuite/Makefile.in: Regenerate.
3992 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3994 2009-05-21 Sriraman Tallam <tmsriram@google.com>
3996 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3997 kept comdat section was garbage collected.
3998 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3999 * testsuite/Makefile.in: Regenerate.
4000 * testsuite/gc_comdat_test.sh: New file.
4001 * testsuite/gc_comdat_test_1.cc: New file.
4002 * testsuite/gc_comdat_test_2.cc: New file.
4004 2009-05-19 Doug Kwan <dougkwan@google.com>
4006 * archive.cc (Archive::Archive): Move constructor from archive.h
4007 to here. Initialize no_export_.
4008 (Archive::get_elf_object_for_member): Set no_export flag of object.
4009 * archive.h (Archive::Archive): Move constructor body to
4011 (Archive::no_export): New method.
4012 (Archive::no_export_): New field.
4013 * object.h (Object::Object): Initialize no_export_ to false.
4014 (Object::no_export, Object::set_no_export): New methods.
4015 (Object::no_export_): New field.
4016 * options.cc (General_options::parse_exclude_libs): New method.
4017 (General_options::check_excluded_libs) Same.
4018 * options.h (exclude_libs): New option.
4019 (General_options::check_excluded_libs): New method declaration.
4020 (General_options::excluded_libs_): New field.
4021 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
4022 default or protected visibility if an object has no-export flag set.
4023 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
4024 (check_SCRIPTS): Add exclude_libs_test.sh.
4025 (check_DATA): Add exclude_libs_test.syms.
4026 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
4027 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
4028 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
4029 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
4030 (exclude_libs_test.syms, libexclude_libs_test_1.a,
4031 libexclude_libs_test_2.a): New rules.
4032 * testsuite/Makefile.in: Regenerate.
4033 * testsuite/exclude_libs_test.c: New file.
4034 * testsuite/exclude_libs_test.sh: Ditto.
4035 * testsuite/exclude_libs_test_1.c: Ditto.
4036 * testsuite/exclude_libs_test_2.c: Ditto.
4038 2009-05-15 Ian Lance Taylor <iant@google.com>
4040 * configure.ac: Check for declarations for cases where libiberty.h
4041 checks HAVE_DECL_xxx.
4042 * configure, config.in: Rebuild.
4044 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
4046 * gold.h (Incremental_argument_list): Remove (invalid) forward
4048 * incremental.cc (Incremental_inputs::report_achive): New method.
4049 (Incremental_inputs::report_object): New method.
4050 (Incremental_inputs::report_script): New method.
4051 (Incremental_inputs::finalize_inputs): New method.
4052 (Incremental_inputs::finalize): Call finalize_inputs().
4053 (Incremental_inputs::sized_create_incremental_inputs_section_data):
4054 Create inputs entries.
4055 * incremental.h (Incremental_input_type): New enum.
4056 (Incremental_inputs::Incremental_input): Initialize new fields.
4057 (Incremental_inputs::report_inputs): New method.
4058 (Incremental_inputs::report_achive): New method.
4059 (Incremental_inputs::report_object): New method.
4060 (Incremental_inputs::report_script): New method.
4061 (Incremental_inputs::finalize_inputs): New method.
4062 (Incremental_inputs::Input_info): New struct.
4063 (Incremental_inputs::Input_info_map): New typedef.
4064 (Incremental_inputs::lock_): New field.
4065 (Incremental_inputs::Inputs_): New field.
4066 (Incremental_inputs::Inputs_map): New field.
4067 * main.cc (main): Call Incremental_input::report_inputs.
4068 * options.h (Input_argument_list): Typedef moved from
4070 (Input_file_group::Files): Remove, use ::Input_argument_list.
4071 (Input_file_group::Input_argument_list): Remove, use
4072 ::Input_argument_list.
4073 * plugin.cc (Plugin_manager::add_input_file): Add error in
4075 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
4077 * script.cc (read_input_script): Call
4078 Incremental_input::report_script.
4079 * script.h (Script_info): New class.
4081 2009-04-27 Ian Lance Taylor <iant@google.com>
4083 * x86_64.cc (do_adjust_output_section): Set entsize to
4086 2009-04-23 Elliott Hughes <enh@google.com>
4088 * output.cc (Output_file::close): After short writes, continue
4089 writing from the correct offset in the buffer being written.
4091 2009-04-23 Chris Demetriou <cgd@google.com>
4093 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
4094 * configure: Regenerate.
4095 * config.in: Regenerate.
4096 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
4097 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
4099 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
4101 * incremental.cc (Incremental_inputs_header_data): Renamed from
4102 Incremental_input_header_data.
4103 (Incremental_inputs_header_data::data_size): New field.
4104 (Incremental_inputs_header_data::put_input_file_count): Renamed
4105 from input_file_count.
4106 (Incremental_inputs_header_data::put_command_line_offset): Renamed
4107 from command_line_offset.
4108 (Incremental_inputs_header_data::put_reserved): Renamed from
4110 (Incremental_inputs_entry_data): Renamed from
4111 Incremental_input_entry_data.
4112 (Incremental_inputs_entry_data::data_size): New field.
4113 (Incremental_inputs::report_command_line): New method.
4114 (Incremental_inputs::finalize): New method.
4115 (Incremental_inputs::create_incremental_inputs_data): New method.
4116 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
4117 * incremental.h: New file.
4118 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
4119 (Layout::finalize): Create incremental inputs section in
4121 (Layout::create_incremental_info_sections): New method.
4122 * layout.h (Layout::incremental_inputs): New method.
4123 (Layout::create_incremental_info_sections): New method.
4124 (Layout::incremental_inputs_): New field.
4125 * main.cc (main): Notify Incremental_input of the command line.
4127 2009-04-01 Ian Lance Taylor <iant@google.com>
4128 Mikolaj Zalewski <mikolajz@google.com>
4130 * gold.h (reserve_unordered_map): Define, three versions, one for
4131 each version of Unordered_map.
4132 * layout.cc (Layout::Layout): Remove options parameter. Add
4133 number_of_input_files parameter. Don't initialize options_.
4134 Initialize number_of_input_files_ and resized_signatures_. Move
4135 sections_are_attached_.
4136 (Layout::layout_group): Reserve space for group_signatures_.
4137 (Layout::find_or_add_kept_section): Change name parameter to be a
4138 reference. Resize signatures_ map when it gets large enough.
4139 (Layout::layout_eh_frame): Use parameters->options() instead of
4141 (Layout::make_output_section): Likewise.
4142 (Layout::attach_allocated_section_to_segment): Likewise.
4143 (Layout::finalize, Layout::create_executable_stack): Likewise.
4144 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
4145 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
4146 * layout.h (class Layout): Update declarations. Remove options_
4147 field. Add number_of_input_files_ and resized_signatures_
4148 fields. Move sections_are_attached_ field.
4149 * main.cc (main): Pass number of input files to Layout
4150 constructor. Don't pass options.
4152 2009-03-30 Ian Lance Taylor <iant@google.com>
4154 * ffsll.c (ffsll): Correct implementation.
4156 2009-03-27 Ian Lance Taylor <iant@google.com>
4158 * ffsll.c: New file.
4159 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
4160 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
4161 * ftruncate.c (ftruncate): Declare before definition.
4162 * mremap.c (mremap): Likewise.
4163 * pread.c (pread): Likewise.
4164 * configure, Makefile.in, config.in: Rebuild.
4166 * mremap.c: New file.
4167 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
4168 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
4169 (mremap): Declare if HAVE_MREMAP is not defined.
4170 * configure, Makefile.in, config.in: Rebuild.
4172 2009-03-27 Cary Coutant <ccoutant@google.com>
4174 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
4175 position independent.
4176 * sparc.cc (Target_sparc::check_non_pic): Likewise.
4177 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
4179 2009-03-24 Cary Coutant <ccoutant@google.com>
4181 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
4183 (needs_dynamic_reloc): Likewise.
4185 2009-03-24 Ian Lance Taylor <iant@google.com>
4187 * yyscript.y (file_cmd): Recognize EXTERN.
4188 (extern_name_list, extern_name_list_body): New nonterminals.
4189 * script.cc (script_add_extern): Define.
4190 * script-c.h (script_add_extern): Declare.
4192 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
4194 * object.cc (is_elf_object): Define.
4195 * object.h (is_elf_object): Declare.
4196 * archive.cc (Archive::get_elf_object_for_member): Call
4198 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
4200 2009-03-24 Elliott Hughes <enh@google.com>
4202 * output.cc (Output_file::map_anonymous): Define.
4203 (Output_file::map): Use map_anonymous. If the regular mmap fails,
4204 try an anonymous one. Report the size if the mmap fails.
4205 * output.h (class Output_file): Declare map_anonymous.
4207 2009-03-24 Ian Lance Taylor <iant@google.com>
4209 * target-select.cc (instantiate_target): Don't acquire the lock if
4210 the instantiated_target_ field has already been set.
4212 2009-03-23 Ian Lance Taylor <iant@google.com>
4214 * gold-threads.h (class Initialize_lock): Define.
4215 * gold-threads.cc (class Initialize_lock_once): Define.
4216 (initialize_lock_control): New static variable.
4217 (initialize_lock_pointer): New static variable.
4218 (initialize_lock_once): New static function.
4219 (Initialize_lock::Initialize_lock): Define.
4220 (Initialize_lock::initialize): Define.
4221 * target-select.h: Include "gold-threads.h".
4222 (class Target_selector): Add lock_ and initialize_lock_ fields.
4223 Don't define instantiate_target, just declare it.
4224 * target-select.cc (Target_selector::Target_selector): Initialize
4226 (Target_selector::instantiate_target): Define.
4227 * descriptors.h: Include "gold-threads.h".
4228 (class Descriptors): Add initialize_lock_ field.
4229 * descriptors.cc (Descriptors::Descriptors): Initialize new
4231 (Descriptors::open): Use initialize_lock_ field
4232 * errors.h (class Errors): Add initialize_lock_ field.
4233 * errors.cc (Errors::Errors): Initialize new field.
4234 (Errors::initialize_lock): Use initialize_lock_ field.
4235 * powerpc.cc (class Target_selector_powerpc): Remove
4236 instantiated_target_ field. In do_recognize call
4237 instantiate_target rather than do_instantiate_target. In
4238 do_instantiate_target just allocate a new target.
4239 * sparc.cc (class Target_selector_sparc): Likewise.
4241 * freebsd.h: New file.
4242 * i386.cc: Include "freebsd.h".
4243 (Target_i386): Derive from Target_freebsd rather than
4245 (Target_selector_i386): Derive from Target_selector_freebsd rather
4246 than Target_selector.
4247 * x86_64.cc: Include "freebsd.h".
4248 (Target_x86_64): Derive from Target_freebsd rather than
4250 (Target_selector_x86_64): Derive from Target_selector_freebsd
4251 rather than Target_selector.
4252 * target.h (class Target): Add adjust_elf_header and
4253 do_adjust_elf_header.
4254 * output.cc (Output_file_header:: do_sized_write): Call target
4255 adjust_elf_header routine.
4256 * configure.tgt: Set targ_osabi.
4257 * configure.ac: Define GOLD_DEFAULT_OSABI.
4258 * parameters.cc (Parameters::default_target): Pass
4259 GOLD_DEFAULT_OSABI to select_target.
4260 * target-select.h (class Target_selector): Make instantiate_target
4261 protected rather than private.
4262 * Makefile.am (HFILES): Add freebsd.h.
4263 * configure, Makefile.in, config.in: Rebuild.
4265 * merge.cc (do_add_input_section): Correct pend value. Change
4266 message about last entry not being null terminated from error to
4269 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
4271 * incremental.cc: New file.
4272 * Makefile.am (CCFILES): Add incremental.cc.
4273 * Makefile.in: Rebuild.
4275 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
4277 * layout.cc (Layout::output_section_name): Preserve names
4278 of '.note.' sections.
4280 2009-03-19 Ian Lance Taylor <iant@google.com>
4282 * descriptors.cc (Descriptors::open): Check that the options are
4283 valid before using them.
4285 2009-03-18 Ian Lance Taylor <iant@google.com>
4287 * script-sections.h: Include <list>.
4288 (class Script_sections): Change Sections_elements from std::vector
4289 to std::list. Typedef public Elements_iterator. Add
4290 orphan_section_placement_, data_segment_align_start_, and
4291 saw_data_segment_align_ fields. Remove data_segment_align_index_
4293 * script-sections.cc (class Orphan_section_placement): New class.
4294 (class Sections_element): Add virtual functions is_relro and
4295 orphan_section_init. Remove virtual function place_orphan_here.
4296 (class Output_section_definition): Add is_relro and
4297 orphan_section_init. Remove place_orphan_here.
4298 (class Orphan_output_section): Likewise.
4299 (Script_sections::Script_sections): Update for field changes.
4300 (Script_sections::data_segment_align): Set saw_data_segment_align_
4301 and data_segment_align_start_, not data_segment_align_index.
4302 (Script_sections::data_segment_relro_end): Check
4303 saw_data_segment_align_. Use data_segment_align_start_ rather
4304 than data_segment_align_index_.
4305 (Script_sections::place_orphan): Rewrite to use
4306 Orphan_section_placement.
4308 2009-03-17 Ian Lance Taylor <iant@google.com>
4310 * archive.cc (Archive::add_symbols): Check for a version attached
4311 to the symbol name in the archive map.
4312 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
4313 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
4314 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
4315 (ver_test_11.a): New target.
4316 * testsuite/Makefile.in: Rebuild.
4318 * configure.ac: Check for chsize and posix_fallocate. Replace
4320 * ftruncate.c: New file, from gnulib.
4321 * output.cc (posix_fallocate): Define dummy version if not
4322 HAVE_POSIX_FALLOCATE.
4323 (Output_file::map): Call posix_fallocate rather than lseek and
4325 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
4326 * configure, Makefile.in, config.in: Rebuild.
4328 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
4330 * layout.h (Layout::create_note): Add section_name parameter.
4331 * layout.cc (Layout::create_note): Likewise.
4332 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
4334 2009-03-17 Ian Lance Taylor <iant@google.com>
4336 * descriptors.cc: Include "options.h".
4337 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
4338 (Descriptors::open): Always use O_CLOEXEC when opening a new
4339 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
4340 then set FD_CLOEXEC.
4342 * sparc.cc (class Target_sparc): Add has_got_section.
4343 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
4344 make sure we have a GOT section.
4346 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
4347 (Target_sparc::Scan::local): Likewise.
4348 (Target_sparc::Scan::global): Likewise.
4349 (Target_sparc::Relocate::relocate): Likewise.
4350 (Target_sparc::Relocate::relocate_tls): Likewise.
4352 * symtab.cc (Symbol_table::define_default_version): New function,
4353 broken out of add_from_object.
4354 (Symbol_table::add_from_object): Call define_default_version.
4355 (Symbol_table::define_special_symbol): Add resolve_oldsym
4356 parameter. Change all callers. If the version for a symbol comes
4357 from a version script, resolve it with the symbol with the same
4358 name with no version. Also add the symbol without a version if
4360 (do_define_in_output_data): If resolving with oldsym, don't delete
4362 (do_define_in_output_segment): Likewise.
4363 (do_define_as_constant): Likewise.
4364 * symtab.h (class Symbol_table): Update declarations.
4366 2009-03-13 Ian Lance Taylor <iant@google.com>
4368 * readsyms.cc (Read_symbols::incompatible_warning): New function.
4369 (Read_symbols::requeue): New function.
4370 (Read_symbols::do_read_symbols): If make_elf_object fails because
4371 the target type is not configured, and the file was searched for,
4372 issue a warning and retry with the next directory.
4373 (Add_symbols::run): If the file has an incompatible format, and
4374 it was searched for, requeue the Read_symbols task. On error,
4376 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
4377 dirindex parameter to constructor. Change all callers. Declare
4378 incompatible_warning and requeue.
4379 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
4380 input_argument_ and input_group_ fields. Add them to
4381 constructor. Change all callers.
4382 (class Read_script): Add dirindex_ field. Add it to constructor.
4384 * archive.cc (Archive::setup): Remove input_objects parameter.
4386 (Archive::get_file_and_offset): Likewise.
4387 (Archive::read_all_symbols): Likewise.
4388 (Archive::read_symbols): Likewise.
4389 (Archive::get_elf_object_for_member): Remove input_objects
4390 parameter. Add punconfigured parameter. Change all callers.
4391 (Archive::add_symbols): Change return type to bool. Check return
4392 value of include_member.
4393 (Archive::include_all_members): Likewise.
4394 (Archive::include_member): Change return type to bool. Return
4395 false if first included object has incompatible target. Set
4396 included_member_ field.
4397 (Add_archive_symbols::run): If add_symbols returns false, requeue
4399 * archive.h (class Archive): Add included_member_ field.
4400 Initialize it in constructor. Add input_file and searched_for
4401 methods. Update declarations.
4402 (class Add_archive_symbols): Add dirpath_, dirindex_, and
4403 input_argument_ fields. Add them to constructor. Change all
4405 * script.cc: Include "target-select.h".
4406 (class Parser_closure): Add skip_on_incompatible_target_ and
4407 found_incompatible_target_ fields. Add
4408 skip_on_incompatible_target parameter to constructor. Change all
4409 callers. Add methods skip_on_incompatible_target,
4410 clear_skip_on_incompatible_target, found_incompatible_target, and
4411 set_found_incompatible_target.
4412 (read_input_script): Add dirindex parameter. Change all callers.
4413 If parser finds an incompatible target, requeue Read_symbols
4415 (script_set_symbol): Clear skip_on_incompatible_target in
4417 (script_add_assertion, script_parse_option): Likewise.
4418 (script_start_sections, script_add_phdr): Likewise.
4419 (script_check_output_format): New function.
4420 * script.h (read_input_script): Update declaration.
4421 * script-c.h (script_check_output_format): Declare.
4422 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
4423 (ignore_cmd): Remove OUTPUT_FORMAT.
4424 * fileread.cc (Input_file::Input_file): Add explicit this.
4425 (Input_file::will_search_for): New function.
4426 (Input_file::open): Add pindex parameter. Change all callers.
4427 * fileread.h (class Input_file): Add input_file_argument method.
4428 Declare will_search_for. Update declarations.
4429 * object.cc (make_elf_object): Add punconfigured parameter.
4431 * object.h (class Object): Make input_file public. Add
4432 searched_for method.
4433 (make_elf_object): Update declaration.
4434 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
4436 * dirsearch.h (class Dirsearch): Update declaration.
4437 * options.h (class General_options): Add --warn-search-mismatch.
4438 * parameters.cc (Parameters::is_compatible_target): New function.
4439 * parameters.h (class Parameters): Declare is_compatible_target.
4440 * workqueue.cc (Workqueue::add_blocker): New function.
4441 * workqueue.h (class Workqueue): Declare add_blocker.
4443 * fileread.cc (Input_file::open): Remove options parameter.
4445 (Input_file::open_binary): Likewise.
4446 * script.cc (read_input_script): Likewise.
4447 * readsyms.h (class Read_symbols): Remove options_ field. Remove
4448 options parameter from constructor. Change all callers.
4449 (class Read_script): Likewise.
4450 * fileread.h (class Input_file): Update declarations.
4451 * script.h (read_input_script): Update declaration.
4453 2009-03-10 Nick Clifton <nickc@redhat.com>
4455 * po/es.po: New Spanish translation.
4457 2009-03-06 Cary Coutant <ccoutant@google.com>
4459 * options.cc (parse_short_option): Keep dash_z from registering itself.
4461 2009-03-03 Ian Lance Taylor <iant@google.com>
4464 * target-reloc.h (relocate_section): Pass output_section to
4466 * i386.cc (Target_i386::should_apply_static_reloc): Add
4467 output_section parameter. Change all callers.
4468 (Target_i386::Relocate::relocate): Add output_section parameter.
4469 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4470 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
4471 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
4472 * testsuite/two_file_shared.sh: New script.
4473 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
4474 (check_DATA): Add two_file_shared.dbg.
4475 (two_file_shared.dbg): New target.
4476 * testsuite/Makefile.in: Rebuild.
4478 2009-03-01 Ian Lance Taylor <iant@google.com>
4480 * configure.ac: Check for byteswap.h.
4481 * configure: Rebuild.
4482 * config.in: Rebuild.
4484 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
4486 * layout.cc (Layout::find_or_add_kept_section): New function.
4487 (Layout::add_comdat): Removed.
4488 * layout.h (struct Kept_section): Move out of class Layout.
4489 Remove trailing underscores from field names. Add group_sections
4490 field. Rename group_ field to is_group. Change all uses.
4491 (class Layout): Declare find_or_add_kept_section, not add_comdat.
4492 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
4493 comdat_groups_ field.
4494 (Sized_relobj::include_section_group): Use
4495 find_or_add_kept_section and Kept_section::group_sections.
4496 (Sized_relobj::include_linkonce_section): Likewise.
4497 * object.cc (class Sized_relobj): Don't define Comdat_group or
4498 Comdat_group_table. Remove find_comdat_group and
4499 add_comdat_group. Remove comdat_groups_ field.
4500 * plugin.cc (include_comdat_group): Use
4501 Layout::find_or_add_kept_section.
4503 2009-02-28 Ian Lance Taylor <iant@google.com>
4505 * README: --gc-sections and map files are now supported. Document
4506 some build requirements.
4509 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
4510 relocatable link set the value of the section symbol to zero.
4511 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
4512 relocatable link don't include the section address in the local
4515 2009-02-27 Ian Lance Taylor <iant@google.com>
4518 * options.h (class Search_directory): Add is_system_directory.
4519 (class General_options): Declare is_in_system_directory.
4520 * options.cc (get_relative_sysroot): Make static.
4521 (get_default_sysroot): Make static.
4522 (General_optoins::is_in_system_directory): New function.
4523 * fileread.cc (Input_file::is_in_system_directory): New function.
4524 * fileread.h (class Input_file): Declare is_in_system_directory.
4525 * object.h (class Object): Add is_in_system_directory.
4526 (class Input_objects): Remove system_library_directory_ field.
4527 * object.cc (Input_objects::add_object): Don't set
4528 system_library_directory_.
4529 (input_objects::found_in_system_library_directory): Remove.
4530 * symtab.cc (Symbol_table::write_globals): Remove input_objects
4531 parameter. Change all callers.
4532 (Symbol_table::sized_write_globals): Likewise.
4533 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
4534 Call Object::is_in_system_directory.
4535 * symtab.h (class Symbol_table): Update declarations.
4538 * descriptors.h (Open_descriptor): Add is_on_stack field.
4539 * descriptors.cc (Descriptors::open): If the descriptor is on the
4540 top of the stack, remove it. Initialize is_on_stack field.
4541 (Descriptors::release): Only add pod to stack if it is not on the
4543 (Descriptors::close_some_descriptor): Clear stack_next and
4547 * output.cc (Output_section::find_starting_output_address): Rename
4548 from starting_output_address; add PADDR parameter; change return
4550 * output.h (class Output_section): Declare
4551 find_starting_output_address instead of starting_output_address.
4552 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
4553 section symbol for which we can't find a merge section.
4556 * symtab.cc (Symbol_table::add_from_object): If the visibility is
4557 hidden or internal, force the symbol to be local.
4558 * resolve.cc (Symbol::override_visibility): Define.
4559 (Symbol::override_base): Use override_visibility.
4560 (Symbol_table::resolve): Likewise.
4561 (Symbol::override_base_with_special): Likewise.
4562 (Symbol_table::override_with_special): If the visibility is hidden
4563 or internal, force the symbol to be local.
4564 * symtab.h (class Symbol): Add set_visibility and
4565 override_visibility.
4566 * testsuite/ver_test_1.sh: New file.
4567 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
4568 (check_DATA): Add ver_test_1.syms.
4569 (ver_test_1.syms): New target.
4570 * testsuite/Makefile.in: Rebuild.
4572 2009-02-25 Cary Coutant <ccoutant@google.com>
4574 * layout.cc (Layout::choose_output_section): Don't rename sections
4575 when using a linker script that has a SECTIONS clause.
4576 * Makefile.in: Regenerate.
4578 * testsuite/Makefile.am (script_test_5.sh): New test case.
4579 * testsuite/Makefile.in: Regenerate.
4580 * testsuite/script_test_5.cc: New file.
4581 * testsuite/script_test_5.sh: New file.
4582 * testsuite/script_test_5.t: New file.
4584 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
4586 * archive.cc (Archive::include_member): Update calls to add_symbols.
4587 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
4588 the Layout argument.
4589 * dynobj.h (do_add_symbols): Add the Layout argument.
4590 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
4592 * object.h (Object::add_symbols): Add the Layout argument.
4593 (Object::do_add_symbols): Add the Layout argument.
4594 (Sized_relobj::do_add_symbols): Add the Layout argument.
4595 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
4596 Unify the two versions.
4597 (Add_plugin_symbols): Remove.
4598 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
4599 (Sized_pluginobj::do_add_symbols): Unify the two versions.
4600 (Add_plugin_symbols): Remove.
4601 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
4602 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
4603 (Add_symbols::run): Make it work with Pulginobj.
4605 2009-02-06 Ian Lance Taylor <iant@google.com>
4607 * object.cc (Sized_relobj::do_layout): Make info message start
4608 with lower case letter.
4610 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
4612 * binary.cc: Fix file comment.
4614 * options.h (enum Incremental_disposition): Define.
4615 (class General_options): Add new options: --incremental,
4616 --incremental_changed, --incremental_unchanged,
4617 --incremental_unknown. Add incremental_disposition_ and
4618 implicit_incremental_ fields.
4619 (General_options::incremental_disposition): New function.
4620 (class Position_dependent_options): Add incremental_disposition
4622 (Position_dependent_options::copy_from_options): Set incremental
4624 * options.cc (General_options::parse_incremental_changed): New
4626 (General_options::parse_incremental_unchanged): New function.
4627 (General_options::parse_incremental_unknown): New function.
4628 (General_options::General_options): Initialize new fields
4629 incremental_disposition_ and implicit_incremental_.
4630 (General_options::finalize): Check for uasge of --incremental-*
4631 without --incremental.
4633 2009-02-06 Chris Demetriou <cgd@google.com>
4635 * gold.h (gold_undefined_symbol): Change to take only a Symbol
4636 pointer and to report location as the file name associated with
4638 (gold_undefined_symbol_at_location): New function to replace the
4639 old gold_undefined_symbol functionality.
4640 * target-reloc.h (relocate_section): Update to use
4641 gold_undefined_symbol_at_location.
4642 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4643 Call gold_undefined_symbol function rather than gold_error.
4644 * errors.h (Errors::undefined_symbol): Take location as a
4645 string, rather than calculating it from a relocation.
4646 * errors.cc (Errors::fatal): Print "fatal error:" before the
4648 (Errors::error, Errors::error_at_location): Print "error: "
4649 before the formatted message.
4650 (Errors::undefined_symbol): Take location as a string, rather
4651 than calculating it from a relocation.
4652 (gold_undefined_symbol_at_location): New function akin to
4653 old gold_undefined_symbol, calculates location from relocation.
4654 (gold_undefined_symbol): Change to take only a Symbol pointer
4655 and to report location as the file name associated with the symbol.
4656 * testsuite/debug_msg.sh: Update for changed error messages.
4657 * testsuite/undef_symbol.sh: Likewise.
4659 2009-02-04 Duncan Sands <baldrick@free.fr>
4662 * reduced_debug_output.h
4663 (Output_reduced_debug_abbrev_section::failed): Use format for
4665 (Output_reduced_debug_info_section::faild): Likewise.
4667 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
4669 * script.cc (Lazy_demangler): New class.
4670 (Version_script_info::get_symbol_version_helper): Demangle a
4673 2009-01-29 Cary Coutant <ccoutant@google.com>
4675 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
4677 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4679 2009-01-28 Ian Lance Taylor <iant@google.com>
4681 * version.cc (version_string): Bump to 1.9.
4683 * gold.h: Include <cstring> and <stdint.h>.
4684 * version.cc: Include <cstdio>.
4685 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
4687 * reduced_debug_output.cc (insert_into_vector): Rename from
4688 Insert_into_vector; change all callers. Use Swap_unaligned to
4689 avoid aliasing issue; remove union since it is unnecessary.
4691 2009-01-27 Sriraman Tallam <tmsriram@google.com>
4693 * Makefile.am (CCFILES): Add gc.cc.
4695 * Makefile.in: Regenerate.
4696 * gold.cc (Gc_runner): New class.
4697 (queue_initial_tasks): Call garbage collection related tasks
4698 when corresponding options are invoked.
4699 (queue_middle_gc_tasks): New function.
4700 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
4701 processed early before laying out sections during garbage collection.
4702 * gold.h (queue_middle_gc_tasks): New function.
4703 (is_prefix_of): Move from "layout.cc".
4704 * i386.cc (Target_i386::gc_process_relocs): New function.
4705 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
4706 * main.cc (main): Create object of class "Garbage_collection".
4707 * object.cc (Relobj::copy_symbols_data): New function.
4708 (Relobj::is_section_name_included): New function.
4709 (Sized_relobj::do_layout): Allow this function to be called twice
4710 during garbage collection and defer layout of section during the
4712 * object.h (Relobj::get_symbols_data): New function.
4713 (Relobj::is_section_name_included): New function.
4714 (Relobj::copy_symbols_data): New function.
4715 (Relobj::set_symbols_data): New function.
4716 (Relobj::get_relocs_data): New function.
4717 (Relobj::set_relocs_data): New function.
4718 (Relobj::is_output_section_offset_invalid): New pure virtual function.
4719 (Relobj::gc_process_relocs): New function.
4720 (Relobj::do_gc_process_relocs): New pure virtual function.
4721 (Relobj::sd_): New data member.
4722 (Sized_relobj::is_output_section_offset_invalid): New function.
4723 (Sized_relobj::do_gc_process_relocs): New function.
4724 * options.h (General_options::gc_sections): Modify to not be a no-op.
4725 (General_options::print_gc_sections): New option.
4726 * plugin.cc (Plugin_finish::run): Remove function call to
4727 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
4728 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4729 * reloc.cc (Read_relocs::run): Add task to process relocs and
4730 determine unreferenced sections when doing garbage collection.
4731 (Gc_process_relocs): New class.
4732 (Sized_relobj::do_gc_process_relocs): New function.
4733 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4734 sections that are garbage collected.
4735 * reloc.h (Gc_process_relocs): New class.
4736 * sparc.cc (Target_sparc::gc_process_relocs): New function.
4737 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4738 symbols whose corresponding sections are garbage collected.
4739 (Symbol_table::Symbol_table): Add new parameter for the garbage
4741 (Symbol_table::gc_mark_undef_symbols): New function.
4742 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4743 (Symbol_table::gc_mark_dyn_syms): New function.
4744 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4746 (Symbol_table::add_from_object): Likewise.
4747 (Symbol_table::add_from_relobj): When building shared objects, do not
4748 treat externally visible symbols as garbage.
4749 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4750 table information for static and relocatable links.
4751 * symtab.h (Symbol_table::set_gc): New function.
4752 (Symbol_table::gc): New function.
4753 (Symbol_table::gc_mark_undef_symbols): New function.
4754 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4755 (Symbol_table::gc_mark_dyn_syms): New function.
4756 (Symbol_table::gc_): New data member.
4757 * target.h (Sized_target::gc_process_relocs): New pure virtual
4759 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4760 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4762 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
4764 * options.h (General_options::gc_sections): Define as a no-op for now.
4765 (General_options::no_keep_memory): Ditto.
4766 (General_options::Bshareable): Define.
4767 * options.cc (General_options::finalize): Honor -Bshareable.
4769 2009-01-20 Andreas Schwab <schwab@suse.de>
4771 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4772 read the value in the contents, since we don't use it. Use the
4773 template endianness when writing.
4774 (Relocate::relocate): Use it for R_PPC_REL16_HA.
4776 2009-01-19 Andreas Schwab <schwab@suse.de>
4778 * configure.tgt (powerpc64-*): Fix targ_obj.
4780 2009-01-15 Ian Lance Taylor <iant@google.com>
4782 * object.cc (Sized_relobj::write_local_symbols): Don't write out
4783 local symbols when stripping all symbols.
4785 2009-01-14 Cary Coutant <ccoutant@google.com>
4787 * output.cc (Output_reloc): Add explicit instantiations.
4789 2009-01-14 Cary Coutant <ccoutant@google.com>
4791 * archive.cc (Archive::get_elf_object_for_member): Remove call
4792 to File_read::claim_for_plugin.
4793 * descriptors.cc (Descriptors::open): Remove reference to
4795 (Descriptors::claim_for_plugin): Remove.
4796 * descriptors.h (Descriptors::claim_for_plugin): Remove.
4797 (Descriptors::is_claimed): Remove.
4798 (claim_descriptor_for_plugin): Remove.
4799 * fileread.cc (File_read::claim_for_plugin): Remove.
4800 * fileread.h (File_read::claim_for_plugin): Remove.
4801 (File_read::descriptor): Reopen descriptor if necessary.
4802 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
4803 (Plugin_manager::all_symbols_read): Add task parameter. Change
4805 (Plugin_manager::get_input_file): New function.
4806 (Plugin_manager::release_input_file): New function.
4807 (Pluginobj::Pluginobj): Add filesize parameter and initialize
4808 corresponding data member.
4809 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4810 and pass to base constructor. Change all callers.
4811 (get_input_file, release_input_file): New functions.
4812 (make_sized_plugin_object): Add filesize parameter. Change all callers.
4813 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4814 (Plugin_manager::all_symbols_read): Add task parameter.
4815 (Plugin_manager::get_input_file): New function.
4816 (Plugin_manager::release_input_file): New function.
4817 (Plugin_manager::task_): New data member.
4818 (Pluginobj::Pluginobj): Add filesize parameter.
4819 (Pluginobj::filename): New function.
4820 (Pluginobj::descriptor): New function.
4821 (Pluginobj::filesize): New function.
4822 (Pluginobj::filesize_): New data member.
4823 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4824 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4825 File_read::claim_for_plugin; use Object::unlock to unlock the file.
4827 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4828 with archive libraries.
4829 * testsuite/Makefile.in: Regenerate.
4830 * testsuite/plugin_test.c (struct sym_info): New type.
4831 (get_input_file, release_input_file): New static variables.
4832 (onload): Capture new transfer vector entries.
4833 (claim_file_hook): Stop reading at end of file according to filesize.
4834 Factor out parsing of readelf output into separate function.
4835 (all_symbols_read_hook): Exercise get_input_file and release_input_file
4836 APIs and get the source file name from the symbol table. Convert
4837 source file name to corresponding object file name. Print info
4838 message when adding new input files.
4839 (parse_readelf_line): New function.
4840 * testsuite/plugin_test_1.sh: Add checks for new info messages.
4841 * testsuite/plugin_test_2.sh: Likewise.
4842 * testsuite/plugin_test_3.sh: Likewise.
4843 * testsuite/plugin_test_4.sh: New test case.
4845 2009-01-07 Ian Lance Taylor <iant@google.com>
4847 * version.cc (version_string): Bump to 1.8.
4849 2008-12-23 Cary Coutant <ccoutant@google.com>
4851 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4852 * plugin.cc (Plugin_manager::finish): Rename as
4853 layout_deferred_objects. Move cleanup to separate function.
4854 (Plugin_manager::cleanup): New function.
4855 (Plugin_finish::run): Call layout_deferred_objects and cleanup
4857 * plugin.h (Plugin_manager::finish): Rename as
4858 layout_deferred_objects.
4859 (Plugin_manager::cleanup): New function.
4860 (Plugin_manager::cleanup_done): New field.
4862 2008-12-23 Cary Coutant <ccoutant@google.com>
4864 * plugin.cc (is_visible_from_outside): New function.
4865 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4866 so we don't return "IR only" status for exported symbols or -r links.
4868 * testsuite/Makefile.am (plugin_test_3): New test case.
4869 * testsuite/Makefile.in: Regenerate.
4870 * testsuite/plugin_test_3.sh: New file.
4872 2008-12-22 Cary Coutant <ccoutant@google.com>
4874 * object.cc (Sized_relobj::layout_section): New function.
4875 (Sized_relobj::do_layout): Defer layout of input sections until after
4876 plugin has provided replacement files.
4877 (Sized_relobj::do_layout_deferred_sections): New function.
4878 * object.h (Relobj::set_section_offset): Remove virtual keyword.
4879 (Relobj::layout_deferred_sections): New function.
4880 (Relobj::do_layout_deferred_sections): New function.
4881 (Sized_relobj::do_layout_deferred_sections): New function.
4882 (Sized_relobj::layout_section): New function.
4883 (Sized_relobj::Deferred_layout): New structure.
4884 (Sized_relobj::deferred_layout_): New field.
4885 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4886 Change all callers. Layout deferred sections.
4887 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4889 (Plugin_hook::run): Move code from do_plugin_hook inline.
4890 (Plugin_hook::do_plugin_hook): Remove.
4891 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4892 (Plugin_manager::finish): Renamed, was cleanup.
4893 (Plugin_manager::should_defer_layout): New function.
4894 (Plugin_manager::add_deferred_layout_object): New function.
4895 (Plugin_manager::Deferred_layout_list): New type.
4896 (Plugin_manager::deferred_layout_objects_): New field.
4897 (Plugin_hook::do_plugin_hook): Remove.
4899 2008-12-17 Ian Lance Taylor <iant@google.com>
4901 * options.h (class General_options): Add --no case for
4904 2008-12-16 Cary Coutant <ccoutant@google.com>
4906 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4908 (Plugin_manager::claim_file): Create plugin object even if
4909 plugin did not call the add_symbols callback.
4910 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4911 asking for more symbols than were added.
4912 * testsuite/Makefile.am (plugin_test_1): Add test case with
4914 (empty.syms): New target.
4915 * testsuite/Makefile.in: Regenerate.
4916 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4917 message. Don't call add_symbols if no globals.
4918 (all_symbols_read_hook): Don't provide replacement for empty
4921 2008-12-12 Ian Lance Taylor <iant@google.com>
4923 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4924 r_type == 0 for a local symbol with r_sym == 0.
4925 (scan_relocatable_relocs): Pass r_sym to
4926 local_non_section_strategy.
4927 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4930 * configure.ac: Update test for TLS descriptors: they are
4931 supported as of glibc 2.9.
4932 * configure: Rebuild.
4934 2008-12-11 Ian Lance Taylor <iant@google.com>
4937 * target-reloc.h (Default_scan_relocatable_relocs): For each
4938 function, map r_type == 0 to RELOC_DISCARD.
4940 2008-12-10 Cary Coutant <ccoutant@google.com>
4942 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4943 object to override a kept COMDAT group from a plugin object.
4945 2008-12-09 Ian Lance Taylor <iant@google.com>
4948 * yyscript.y (file_cmd): Handle INPUT.
4950 * testsuite/initpri1.c: Change all declarations to be full
4951 prototypes by adding void, to avoid compiler warnings.
4953 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
4955 * options.cc (General_options::parse_plugin_opt): New.
4956 (General_options::add_plugin): The argument now is just the filename.
4957 (General_options::add_plugin_option): New.
4958 * options.h (plugin_opt): New.
4959 (add_plugin): Change argument name.
4960 (add_plugin_option): New.
4961 * plugin.cc (Plugin::load): Don't parse the plugin option.
4962 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4963 (Plugin::add_option): New.
4964 (Plugin::args_): Change type.
4965 (Plugin::filename_): New.
4966 (Plugin_manager::add_plugin_option): New.
4967 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4968 * testsuite/Makefile.in: Regenerate.
4970 2008-12-05 Cary Coutant <ccoutant@google.com>
4972 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4973 Handle --strip-lto-sections option.
4974 * options.h (strip_lto_sections): New option.
4976 2008-12-01 Cary Coutant <ccoutant@google.com>
4978 * plugin.cc (ld_plugin_message): Change format parameter to const.
4979 Fix mismatch between new[] and delete.
4981 2008-11-14 Cary Coutant <ccoutant@google.com>
4983 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4986 2008-11-05 Craig Silverstein <csilvers@google.com>
4988 * options.cc (General_options::parse_dynamic_list): New function.
4989 * options.h (General_options): New flags dynamic_list,
4990 dynamic_list_data, dynamic_list_cpp_new, and
4991 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4992 (General_options::in_dynamic_list): New function.
4993 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4994 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4995 (Lex::can_continue_name): Likewise.
4997 (read_script_file): New parameter script_options.
4998 (read_dynamic_list): New function.
4999 (Script_options::define_dynamic_list): New function.
5000 (dynamic_list_keyword_parsecodes): New variable.
5001 (dynamic_list_keywords): New variable.
5002 * script.h (Script_options::define_dynamic_list): New function
5004 (read_dynamic_list): New function prototype.
5005 * symtab.cc (strprefix): New macro.
5006 (Symbol::should_add_dynsym_entry): Support dynamic_list,
5007 dynamic_list_data, dynamic_list_cpp_new, and
5008 dynamic_list_cpp_typeinfo.
5009 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
5010 (dynamic_list_expr): New rule.
5011 (dynamic_list_nodes): Likewise.
5012 (dynamic_list_node): Likewise.
5013 * testsuite/Makefile.am (dynamic_list): New test.
5014 * testsuite/Makefile.in: Regenerated.
5015 * testsuite/dynamic_list.t: New file.
5016 * testsuite/dynamic_list.sh: New file.
5018 2008-11-05 Craig Silverstein <csilvers@google.com>
5020 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
5021 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
5022 (t11_last): Likewise.
5023 * testsuite/ver_test_6.c (main): Likewise.
5025 2008-10-07 Cary Coutant <ccoutant@google.com>
5027 * options.c (General_options::finalize): Add check for -static and
5029 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
5032 2008-10-02 Cary Coutant <ccoutant@google.com>
5034 * plugin.cc (make_sized_plugin_object): Fix conditional
5035 compilation to work when not all targets are enabled.
5037 2008-09-29 Cary Coutant <ccoutant@google.com>
5039 * archive.cc (Archive::get_file_and_offset): Use filename instead
5040 of name to get library path.
5041 (Archive::include_member): Unlock external member of a thin archive.
5043 * testsuite/Makefile.am (TEST_AR): New variable.
5044 (thin_archive_test_1): New test.
5045 (thin_archive_test_2): New test.
5046 * testsuite/Makefile.in: Regenerate.
5047 * testsuite/thin_archive_main.cc: New file.
5048 * testsuite/thin_archive_test_1.cc: New file.
5049 * testsuite/thin_archive_test_2.cc: New file.
5050 * testsuite/thin_archive_test_3.cc: New file.
5051 * testsuite/thin_archive_test_4.cc: New file.
5053 2008-09-29 Cary Coutant <ccoutant@google.com>
5055 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
5056 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
5058 (Sized_relobj::do_finalize_local_symbols): Likewise.
5059 (Sized_relobj::map_to_kept_section): Likewise.
5060 * object.h (Sized_relobj::invalid_address): New constant.
5061 (Sized_relobj::do_output_section_offset): Check for invalid_address
5063 * output.cc (Output_reloc::local_section_offset): Use constant
5064 invalid_address instead of -1U.
5065 (Output_reloc::get_address): Likewise.
5066 (Output_section::output_address): Change -1U to -1ULL.
5067 * output.h (Output_reloc::invalid_address): New constant.
5068 * reloc.cc (Sized_relobj::write_sections): Use constant
5069 invalid_address instead of -1U.
5070 (Sized_relobj::relocate_sections): Likewise.
5071 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
5072 values for merge sections.
5073 * target-reloc.h (relocate_for_relocatable): Use constant
5074 invalid_address instead of -1U.
5076 2008-09-19 Cary Coutant <ccoutant@google.com>
5078 Add plugin functionality for link-time optimization (LTO).
5079 * configure.ac (plugins): Add --enable-plugins option.
5080 * configure: Regenerate.
5081 * config.in: Regenerate.
5082 * Makefile.am (LIBDL): New variable.
5083 (CCFILES): Add plugin.cc.
5084 (HFILES): Add plugin.h.
5085 (ldadd_var): Add LIBDL.
5086 * Makefile.in: Regenerate.
5088 * archive.cc: Include "plugin.h".
5089 (Archive::setup): Don't preread archive symbols when using a plugin.
5090 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
5091 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
5093 (Archive::include_member): Add symbols from plugin objects.
5094 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
5095 * descriptors.cc (Descriptors::open): Check for file descriptors
5096 abandoned by plugins.
5097 (Descriptors::claim_for_plugin): New function.
5098 * descriptors.h (Descriptors::claim_for_plugin): New function.
5099 (Open_descriptor::is_claimed): New field.
5100 (claim_descriptor_for_plugin): New function.
5101 * fileread.cc (File_read::claim_for_plugin): New function.
5102 * fileread.h (File_read::claim_for_plugin): New function.
5103 (File_read::descriptor): New function.
5104 * gold.cc: Include "plugin.h".
5105 (queue_initial_tasks): Add task to call plugin hooks for generating
5107 * main.cc: Include "plugin.h".
5108 (main): Load plugin libraries.
5109 * object.h (Pluginobj): Declare.
5110 (Object::pluginobj): New function.
5111 (Object::do_pluginobj): New function.
5112 (Object::set_target): New function.
5113 * options.cc: Include "plugin.h".
5114 (General_options::parse_plugin): New function.
5115 (General_options::General_options): Initialize plugins_ field.
5116 (General_options::add_plugin): New function.
5117 * options.h (Plugin_manager): Declare.
5118 (General_options): Add --plugin option.
5119 (General_options::has_plugins): New function.
5120 (General_options::plugins): New function.
5121 (General_options::add_plugin): New function.
5122 (General_options::plugins_): New field.
5123 * plugin.cc: New file.
5124 * plugin.h: New file.
5125 * readsyms.cc: Include "plugin.h".
5126 (Read_symbols::do_read_symbols): Check for archive before checking
5127 for ELF file. Call plugin hooks to claim files.
5128 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
5129 from a real object file; force override when processing replacement
5131 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
5132 (Symbol::init_base_object): Likewise.
5133 (Symbol::init_base_output_data): Likewise.
5134 (Symbol::init_base_output_segment): Likewise.
5135 (Symbol::init_base_constant): Likewise.
5136 (Symbol::init_base_undefined): Likewise.
5137 (Symbol::output_section): Assert that object is not a plugin.
5138 (Symbol_table::add_from_pluginobj): New function.
5139 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
5141 (Symbol_table::sized_write_globals): Likewise.
5142 (Symbol_table::add_from_pluginobj): Instantiate template.
5143 * symtab.h (Sized_pluginobj): Declare.
5144 (Symbol::in_real_elf): New function.
5145 (Symbol::set_in_real_elf): New function.
5146 (Symbol::in_real_elf_): New field.
5147 (Symbol_table::add_from_pluginobj): New function.
5149 * testsuite/Makefile.am (AM_CFLAGS): New variable.
5150 (LIBDL): New variable.
5152 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
5153 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
5154 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
5155 (MOSTLYCLEANFILES): Likewise.
5156 * testsuite/Makefile.in: Regenerate.
5157 * testsuite/plugin_test.c: New file.
5158 * testsuite/plugin_test_1.sh: New file.
5159 * testsuite/plugin_test_2.sh: New file.
5161 2008-09-16 Ian Lance Taylor <iant@google.com>
5163 * target-reloc.h (relocate_section): Check whether a symbol is
5164 defined by the ABI before reporting an undefined symbol error.
5165 * target.h (Target::is_defined_by_abi): Make parameter const.
5166 (Target::do_is_defined_by_abi): Likewise.
5167 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
5168 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
5169 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
5170 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
5171 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
5172 * testsuite/Makefile.in: Rebuild.
5174 * fileread.cc (make_view): Add casts to avoid warning.
5176 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
5178 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
5179 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5181 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
5183 * options.h (General_options::output_is_executable): New.
5184 (General_options::output_is_pie): New.
5185 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
5186 for shared libraries.
5187 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5189 2008-09-11 Chris Demetriou <cgd@google.com>
5191 * options.h (origin): New -z option.
5192 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
5193 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
5196 2008-09-05 Cary Coutant <ccoutant@google.com>
5198 * fileread.cc (File_read::make_view): Add check for attempt to map
5201 2008-09-05 Cary Coutant <ccoutant@google.com>
5203 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
5204 explicit instantiations.
5206 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
5209 * options.cc (General_options::finalize): Allow undefined symbols
5210 in shlibs if linking -shared.
5213 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
5214 symbols as not needing a dynsym entry.
5216 2008-08-20 Craig Silverstein <csilvers@google.com>
5218 * fileread.cc (File_read::open): Do not lock the file unless it
5219 was successfully opened.
5221 2008-08-14 Cary Coutant <ccoutant@google.com>
5223 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
5224 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
5225 * testsuite/tls_test.cc (struct int128): 128-bit struct
5226 for testing TLS relocs with non-zero addend.
5227 (v12): New TLS variable.
5229 (t_last): Add check for v12.
5230 * testsuite/tls_test.h (t12): New function.
5231 * testsuite/tls_test_main.cc (thread_routine): Call new test.
5233 2008-08-13 Ian Lance Taylor <iant@google.com>
5235 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
5236 set tls_segment_ or relro_segment_.
5237 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
5239 * output.h (Output_section::clear_is_relro): New function.
5240 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
5241 sections specially even when output_data_ is empty.
5242 (Output_segment::maximum_alignment): When first section is relro,
5243 only force alignment for PT_LOAD segments.
5244 * script.cc (script_data_segment_align): New function.
5245 (script_data_segment_relro_end): New function.
5246 * script-c.h (script_data_segment_align): Declare.
5247 (script_data_segment_relro_end): Declare.
5248 * script-sections.h (class Script_sections): Declare
5249 data_segment_align and data_segment_relro_end. Add fields
5250 segment_align_index_ and saw_relro_end_.
5251 * script-sections.cc (class Sections_element): Add set_is_relro
5252 virtual function. Add new bool* parameter to place_orphan_here.
5253 Add get_output_section virtual function.
5254 (class Output_section_definition): Add set_is_relro. Add new
5255 bool* parameter to place_orphan_here. Add get_output_section.
5256 Add is_relro_ field.
5257 (Output_section_definition::Output_section_definition): Initialize
5258 evaluated_address_, evaluated_load_address, evaluated_addralign_,
5259 and is_relro_ fields.
5260 (Output_section_definition::place_orphan_here): Add is_relro
5262 (Output_section_definition::set_section_addresses): Set relro for
5264 (Output_section_definition::alternate_constraint): Likewise.
5265 (class Orphan_output_section): Add new bool* parameter to
5266 place_orphan_here. Add get_output_section.
5267 (Orphan_output_section::place_orphan_here): Add is_relro
5269 (Script_sections::Script_sections): Initialize
5270 data_segment_align_index_ and saw_relro_end_.
5271 (Script_sections::data_segment_align): New function.
5272 (Script_sections::data_segment_relro_end): New function.
5273 (Script_sections::place_orphan): Set or clear is_relro.
5274 (Script_sections::set_section_addresses): Force alignment of first
5276 * yyscript.y (exp): Call script_data_segment_align and
5277 script_data_segment_relro_end.
5278 * testsuite/relro_script_test.t: New file.
5279 * testsuite/relro_test.cc (using_script): Declare.
5280 (t1, t2): Test using_script.
5281 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
5282 (relro_script_test_SOURCES): Define.
5283 (relro_script_test_DEPENDENCIES): Define.
5284 (relro_script_test_LDFLAGS): Define.
5285 (relro_script_test_LDADD): Define.
5286 (relro_script_test.so): New target.
5287 * testsuite/Makefile.in: Rebuild.
5289 2008-08-06 Cary Coutant <ccoutant@google.com>
5291 * archive.cc (Archive::total_archives, Archive::total_members)
5292 (Archive::total_members_loaded): New variables.
5293 (Archive::setup): Add parameter. Add option to preread
5295 (Archive::read_armap): Add counter.
5296 (Archive::get_file_and_offset): New function.
5297 (Archive::get_elf_object_for_member): New function.
5298 (Archive::read_all_symbols): New function.
5299 (Archive::read_symbols): New function.
5300 (Archive::add_symbols): Add counters.
5301 (Archive::include_all_members): Use armap to find members if it's
5303 (Archive::include_member): Skip reading symbols if already read.
5304 Factored code into Archive::get_file_and_offset and
5305 Archive::get_elf_object_for_member. Changed call to
5306 Mapfile::report_include_archive_member.
5307 (Archive::print_stats): New function.
5308 * archive.h: Declare Object and Read_symbols_data classes.
5309 (Archive::Archive): Add initializers for new members.
5310 (Archive::setup): Add parameter.
5311 (Archive::print_stats): New function.
5312 (Archive::total_archives, Archive::total_members)
5313 (Archive::total_members_loaded): New variables.
5314 (Archive::get_file_and_offset): New function.
5315 (Archive::get_elf_object_for_member): New function.
5316 (Archive::read_all_symbols): New function.
5317 (Archive::read_symbols): New function.
5318 (Archive::Archive_member): New class.
5319 (Archive::members_): New member.
5320 (Archive::num_members_): New member.
5321 * main.cc: Include archive.h.
5322 (main): Call Archive::print_stats.
5323 * mapfile.cc (Mapfile::report_include_archive_member): Delete
5324 archive parameter; member_name is now the fully-decorated name.
5325 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
5326 * options.h: (General_options): Add --preread-archive-symbols option.
5327 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
5330 2008-08-04 Ian Lance Taylor <iant@google.com>
5332 * symtab.h (Symbol::use_plt_offset): New function.
5333 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
5334 * powerpc.cc (Relocate::relocate): Likewise.
5335 * sparc.cc (Relocate::relocate): Likewise.
5336 * x86_64.cc (Relocate::relocate): Likewise.
5337 * testsuite/weak_plt.sh: New test.
5338 * testsuite/weak_plt_main.cc: New test.
5339 * testsuite/weak_plt_shared.cc: New test.
5340 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
5341 (check_PROGRAMS): Add weak_plt.
5342 (check_DATA): Add weak_plt_shared.so.
5343 (weak_plt_main_pic.o, weak_plt): New targets.
5344 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
5345 * testsuite/Makefile.in: Rebuild.
5347 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
5349 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
5350 * testsuite/Makefile.in: Rebuild.
5352 2008-08-04 Alan Modra <amodra@bigpond.net.au>
5354 * Makefile.am (POTFILES.in): Set LC_ALL=C.
5355 * Makefile.in: Regenerate.
5356 * po/POTFILES.in: Regenerate.
5358 2008-07-29 Ian Lance Taylor <iant@google.com>
5360 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
5361 symbols before other symbols.
5362 * testsuite/script_test_2.cc (test_addr): Declare.
5363 (test_addr_alias): Declare.
5364 (main): Check that test_addr and test_addr_alias have the right
5366 * testsuite/script_test_2.t: Define test_addr_alias and
5369 2008-07-24 Ian Lance Taylor <iant@google.com>
5372 * descriptors.cc: New file.
5373 * descriptors.h: New file.
5374 * gold-threads.h (class Hold_optional_lock): New class.
5375 * fileread.cc: Include "descriptors.h".
5376 (File_read::~File_read): Release descriptor rather than closing
5378 (File_read::open) [file]: Call open_descriptor rather than open.
5379 Set is_descriptor_opened_.
5380 (File_read::open) [memory]: Assert that descriptor is not open.
5381 (File_read::reopen_descriptor): New function.
5382 (File_read::release): Release descriptor.
5383 (File_read::do_read): Make non-const. Reopen descriptor.
5384 (File_read::read): Make non-const.
5385 (File_read::make_view): Reopen descriptor.
5386 (File_read::do_readv): Likewise.
5387 * fileread.h (class File_read): Add is_descriptor_opened_ field.
5388 Update declarations.
5389 * layout.cc: Include "descriptors.h".
5390 (Layout::create_build_id): Use open_descriptor rather than open.
5391 * output.cc: Include "descriptors.h".
5392 (Output_file::open): Use open_descriptor rather than open.
5393 * archive.cc (Archive::const_iterator): Change Archive to be
5395 (Archive::begin, Archive::end): Make non-const.
5396 (Archive::count_members): Likewise.
5397 * archive.h (class Archive): Update declarations.
5398 * object.h (Object::read): Make non-const.
5399 * Makefile.am (CCFILES): Add descriptors.cc.
5400 (HFILES): Add descriptors.h.
5401 * Makefile.in: Rebuild.
5404 * gold.h: Always include <clocale>. Add Solaris workarounds
5405 following code in binutils/sysdep.h.
5408 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
5409 this->eh_frame_hdr_ is NULL before using it.
5411 * dynobj.cc (Versions::Versions): Update comment.
5413 * dynobj.cc (Versions::Versions): If there is an soname, use it as
5414 the base version name.
5416 * stringpool.cc (Stringpool_template::add_with_length): Set key to
5417 array size plus one.
5418 (Stringpool_template::set_string_offsets): Subtract one from key
5419 before using it as an array index.
5420 (Stringpool_template::get_offset_with_length): Likewise.
5421 (Stringpool_template::write_to_buffer): Likewise.
5422 * stringpool.h (Stringpool_template::get_offset_from_key):
5425 2008-07-23 Ian Lance Taylor <iant@google.com>
5428 * object.h (Merged_symbol_value::value): Do our best to handle a
5432 * script.cc (Version_script_info::get_versions): Don't add empty
5433 version tag to return value.
5434 (Version_script_info::get_symbol_version_helper): Change return
5435 type to bool. Add pversion parameter. Change all callers.
5436 (script_register_vers_node): Don't require a non-NULL tag.
5437 * script.h (class Version_script_info): Update declarations.
5438 (Version_script_info::get_symbol_version): Change return type to
5439 bool. Add version parameter. Change all callers.
5440 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
5441 handling. Handle an empty version from a version script.
5442 (Symbol_table::define_special_symbol): Likewise.
5443 * testsuite/ver_test_10.script: New file.
5444 * testsuite/ver_test_10.sh: New file.
5445 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
5446 (check_DATA): Add ver_test_10.syms.
5447 (ver_test_10.syms, ver_test_10.so): New target.
5448 * testsuite/Makefile.in: Rebuild.
5450 2008-07-23 Simon Baldwin <simonb@google.com>
5452 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
5453 to zero for undefined symbols from dynamic libraries.
5455 2008-07-23 Ian Lance Taylor <iant@google.com>
5457 * symtab.cc (Symbol_table::resolve): Remove version parameter.
5459 * symtab.h (class Symbol_table): Update declaration.
5460 * testsuite/ver_test_9.cc: New file.
5461 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
5462 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
5463 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
5464 (ver_test_9.so, ver_test_9.o): New targets.
5465 * testsuite/Makefile.in: Rebuild.
5467 2008-07-22 Ian Lance Taylor <iant@google.com>
5469 * options.h (class General_options): Define --check-sections.
5470 * layout.cc (Layout::set_segment_offsets): Handle
5473 * options.h (class General_options): Define -n/--nmagic and
5475 * options.cc (General_options::finalize): For -n/--nmagic or
5476 -N/--omagic, set -static.
5477 * layout.cc (Layout::attach_allocated_section_to_segment): If
5478 -N/--omagic, don't put read-only and read-write sections in
5480 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
5481 finding a read-only segment.
5482 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
5483 don't set the minimum segment alignment to the common page size,
5484 and don't set the file offset to the address modulo the page size.
5485 * script-sections.cc (Script_sections::create_segments): If
5486 -n/--omagic, don't put read-only and read-write sections in
5489 * cref.cc: New file.
5491 * options.h (class General_options): Add --print-symbol-counts.
5492 * main.cc (main): Issue defined symbol report if requested.
5493 * archive.cc (Archive::interpret_header): Make into a const member
5495 (Archive::add_symbols): Call Input_objects::archive_start and
5497 (Archive::const_iterator): Define new class.
5498 (Archive::begin, Archive::end): New functions.
5499 (Archive::include_all_members): Rewrite to use iterator.
5500 (Archive::count_members): New function.
5501 * archive.h (class Archive): Update declarations.
5502 (Archive::filename): New function.
5503 * object.cc: Include "cref.h".
5504 (Sized_relobj::Sized_relobj): Initialize defined_count_.
5505 (Sized_relobj::do_get_global_symbol_counts): New function.
5506 (Input_objects::add_object): Add object to cross-referencer.
5507 (Input_objects::archive_start): New function.
5508 (Input_objects::archive_stop): New function.
5509 (Input_objects::print_symbol_counts): New function.
5510 * object.h: Declare Cref and Archive.
5511 (Object::get_global_symbol_counts): New function.
5512 (Object::do_get_global_symbol_counts): New pure virtual function.
5513 (class Sized_relobj): Add defined_count_ field. Update
5515 (class Input_objects): Add cref_ field. Update constructor.
5516 Update declarations.
5517 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
5519 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
5521 (Sized_dynobj::do_get_global_symbol_counts): New function.
5522 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
5523 defined_count_. Update declarations. Define Symbols typedef.
5524 * symtab.cc (Symbol_table::add_from_relobj): Add defined
5525 parameter. Change all callers.
5526 (Symbol_table::add_from_dynobj): Add sympointers and defined
5527 parameters. Change all callers.
5528 * symtab.h (class Symbol_table): Update declarations.
5529 * Makefile.am (CCFILES): Add cref.cc.
5530 (HFILES): Add cref.h.
5531 * Makefile.in: Rebuild.
5533 2008-07-22 Simon Baldwin <simonb@google.com>
5535 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
5536 to zero when writing undefined symbols.
5538 2008-07-22 Ian Lance Taylor <iant@google.com>
5540 * output.cc (Output_section::add_input_section): Don't try to
5541 merge empty merge sections.
5543 2008-07-21 Craig Silverstein <csilvers@google.com>
5545 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5546 Include symbol version in error message.
5548 2008-07-20 Chris Demetriou <cgd@google.com>
5550 * configure.ac (gold_cv_c_random_seed): New configured variable.
5551 (RANDOM_SEED_CFLAGS): New substituted variable.
5552 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
5553 * configure: Rebuild.
5554 * Makefile.in: Likewise.
5555 * testsuite/Makefile.in: Likewise.
5557 2008-07-18 Ian Lance Taylor <iant@google.com>
5559 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
5560 where we see NAME/NULL and NAME/VERSION as separate symbols.
5561 * testsuite/ver_test_main.cc (main): Call t4.
5562 (t4, t4_2a): Define.
5563 * testsuite/ver_test_2.cc (t4_2): Define.
5564 * testsuite/ver_test_2.script: Put t4_2a in VER2.
5565 * testsuite/ver_test_4.cc (t4_2a): Define.
5566 * testsuite/ver_test_4.script: Put t4_2a in VER2.
5567 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
5569 2008-07-17 Ian Lance Taylor <iant@google.com>
5571 * dynobj.cc (Versions::add_def): If we give an error about a
5572 missing version, go ahead and create the version anyhow.
5574 2008-07-10 Ian Lance Taylor <iant@google.com>
5576 Handle output sections with more than 0x7fffffff bytes.
5577 * object.h (class Relobj): Change map_to_output_ to
5578 output_sections_, and just keep a section pointer. Change all
5579 uses. Move comdat group support to Sized_relobj.
5580 (Relobj::is_section_specially_mapped): Remove.
5581 (Relobj::output_section): Remove poff parameter. Change all
5583 (Relobj::output_section_offset): New function.
5584 (Relobj::set_section_offset): Rewrite.
5585 (Relobj::map_to_output): Remove.
5586 (Relobj::output_sections): New function.
5587 (Relobj::do_output_section_offset): New pure virtual function.
5588 (Relobj::do_set_section_offset): Likewise.
5589 (class Sized_relobj): Add section_offsets_ field. Add comdat
5590 group support from Relobj. Update declarations.
5591 (Sized_relobj::get_output_section_offset): New function.
5592 (Sized_relobj::do_output_section_offset): New function.
5593 (Sized_relobj::do_set_section_offset): New function.
5594 * object.cc (Relobj::output_section_address): Remove.
5595 (Sized_relobj::Sized_relobj): Initialize new fields.
5596 (Sized_relobj::include_section_group): Cast find_kept_object to
5598 (Sized_relobj::include_linkonce_section): Likewise.
5599 (Sized_relobj::do_layout): Use separate arrays for output section
5601 (Sized_relobj::do_count_local_symbols): Change map_to_output to
5603 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
5604 output_sections and section_offsets.
5605 (Sized_relobj::write_local_symbols): Likewise.
5606 (map_to_kept_section): Compute output address directly.
5607 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
5608 output_sections and section_offsets.
5609 (Sized_relobj::write_sections): Likewise.
5610 (Sized_relobj::relocate_sections): Likewise.
5611 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
5612 * output.h (class Output_reloc): Update declarations. Change
5613 u2_.relobj to Sized_relobj*.
5614 (class Output_data_reloc): Change add functions to use
5616 * output.cc (Output_reloc::Output_reloc): Change relobj to
5618 (Output_reloc::local_section_offset): Change return type to
5619 Elf_Addr. Use get_output_section_offset.
5620 (Output_reloc::get_address): Likewise.
5621 (Output_section::is_input_address_mapped): Don't call
5622 is_section_specially_mapped.
5623 (Output_section::output_offset): Likewise.
5624 (Output_section::output_address): Likewise.
5625 (Output_section::starting_output_address): Likewise.
5626 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
5627 parameter to Sized_relobj*.
5628 (Copy_relocs::need_copy_reloc): Likewise.
5629 (Copy_relocs::save): Likewise.
5630 * copy-relocs.h (class Copy_relocs): Update declarations.
5631 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
5632 Sized_relobj*. Change relobj_ field to Sized_relobj*.
5633 * target-reloc.h (relocate_for_relocatable): Change
5634 offset_in_output_section type to Elf_Addr. Change code that uses
5636 * layout.cc (Layout::layout): Always set *off.
5637 * mapfile.cc (Mapfile::print_input_section): Use
5638 output_section_offset.
5639 * i386.cc (Target_i386::copy_reloc): Change object parameter to
5641 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
5642 * sparc.cc (Target_sparc::copy_reloc): Likewise.
5643 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
5645 2008-07-03 Ian Lance Taylor <iant@google.com>
5647 * layout.cc (Layout::include_section): Do not discard unrecognized
5648 SHT_STRTAB sections.
5650 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
5652 * script.cc (Lex::can_continue_name): Make '?' allowable in
5653 version-script names.
5654 * testsuite/version_script.map: Change glob pattern to use '?'
5656 2008-06-30 Manish Singh <yosh@gimp.org>
5659 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
5662 2008-06-30 Ian Lance Taylor <iant@google.com>
5666 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
5667 versions]: Don't try to read the value in the contents, since we
5668 don't use it. Use the template endianness when writing.
5670 2008-06-25 Cary Coutant <ccoutant@google.com>
5672 * fileread.cc (File_read::make_view): Assert on zero-length view.
5673 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
5674 symbol table when there are no symbols to read.
5676 2008-06-23 Craig Silverstein <csilvers@google.com>
5678 * version.cc (version_string): Bump to 1.7
5680 2008-06-18 Craig Silverstein <csilvers@google.com>
5682 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
5683 constant 0xFFFF to type Valtype.
5684 (Powerpc_relocate_functions::rel16_ha): Likewise.
5686 2008-06-17 Ian Lance Taylor <iant@google.com>
5688 * output.h (Output_section::Input_section): Initialize p2align_ to
5689 zero for Output_section_data constructors.
5690 (Output_section::Input_section::addralign): If not an input
5691 section, return the alignment of the Output_section_data.
5692 * testsuite/copy_test.cc: New file.
5693 * testsuite/copy_test_1.cc: New file.
5694 * testsuite/copy_test_2.cc: New file.
5695 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
5696 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
5697 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
5698 (copy_test_1_pic.o, copy_test_1.so): New targets.
5699 (copy_test_2_pic.o, copy_test_2.so): New targets.
5700 * testsuite/Makefile.in: Rebuild.
5702 * script-sections.cc (Script_sections::place_orphan): Initialize
5703 local variable exact.
5705 2008-06-13 David Edelsohn <edelsohn@gnu.org>
5707 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5709 2008-06-12 David Edelsohn <edelsohn@gnu.org>
5710 David S. Miller <davem@davemloft.net>
5712 * powerpc.cc: New file.
5713 * Makefile.am (TARGETSOURCES): Add powerpc.cc
5714 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
5715 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
5716 * Makefile.in: Rebuild.
5718 2008-06-09 Ian Lance Taylor <iant@google.com>
5720 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
5722 (throwing, orig_terminate): New static variables.
5723 (terminate_handler): New static function.
5724 (t2): Set terminate handler.
5726 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
5729 * binary.cc (Binary_to_elf::sized_convert): Fix .data
5732 2008-05-30 Cary Coutant <ccoutant@google.com>
5734 * archive.cc (Archive::include_all_members) Correct to step
5735 over symbol table and extended name table in thin archives.
5737 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
5740 * target-reloc.h (relocate_for_relocatable): Fix new_offset
5743 2008-05-28 Caleb Howe <cshowe@google.com>
5745 * reduced_debug_output.cc: New file.
5746 * reduced_debug_output.h: New file.
5747 * options.h (class General_options): Add --strip-debug-non-line.
5748 * options.cc (General_options::finalize): Add strip_debug_non_line
5749 to the strip heirarchy.
5750 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5752 * layout.cc: Include "reduced_debug_output.h".
5753 (Layout::Layout): Initialize new fields.
5754 (line_only_debug_sections): New static array.
5755 (is_lines_only_debug_sections): New static inline function.
5756 (Layout::include_section): Handle --strip-debug-non-line.
5757 (Layout::make_output_section): If --strip-debug-non-line, build
5758 new output sections for .debug_abbrev and .debug_info.
5759 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5760 gold. Warn about possible overflow.
5761 (read_signed_LEB_128): Likewise.
5762 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5763 (read_signed_LEB_128): Declare.
5764 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5765 (HFILES): Add reduced_debug_output.h.
5766 * Makefile.in: Rebuild.
5768 2008-05-21 Ian Lance Taylor <iant@google.com>
5770 * mapfile.cc: New file.
5771 * mapfile.h: New file.
5772 * options.h (class General_options): Add -M/--print-map and -Map.
5773 * options.cc (General_options::finalize): Make -M equivalent to
5775 * main.cc: Include <cstdio> and "mapfile.h".
5776 (main): Open mapfile if requested.
5777 * gold.cc (class Middle_runner): Add mapfile_ field. Update
5778 constructor. Change caller.
5779 (queue_initial_tasks): Add mapfile parameter. Change caller.
5780 (queue_middle_tasks): Likewise.
5781 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5783 * archive.cc: Include "mapfile.h".
5784 (Archive::add_symbols): Add mapfile parameter. Change all
5785 callers. Pass mapfile, symbol, and reason to include_member.
5786 (Archive::include_all_members): Add mapfile parameter. Change all
5788 (Archive::include_member): Add mapfile, sym, and why parameters.
5789 Change all callers. Report inclusion to map file.
5790 * archive.h: Include "fileread.h".
5791 (class Archive): Update declarations.
5792 (Archive::file): New const method.
5793 (class Add_archive_symbols): Add mapfile_ field. Update
5794 constructor. Change all callers.
5795 * readsyms.h (class Read_symbols): Likewise.
5796 (class Finish_group): Likewise.
5797 (class Read_script): Likewise.
5798 * common.cc: Include "mapfile.h".
5799 (Symbol_table::allocate_commons): Add mapfile parameter. Change
5801 (Symbol_table::do_allocate_commons): Likewise.
5802 (Symbol_table::do_allocate_commons_list): Likewise. Report common
5803 symbol allocation to mapfile.
5804 * common.h (class Allocate_commons_task): Add mapfile_ field.
5805 Update constructor. Change all callers.
5806 * symtab.h (class Symbol_table): Update declarations.
5807 * layout.cc: Include "mapfile.h".
5808 (Layout_task_runner::run): Print information to mapfile.
5809 (Layout::create_gold_note): Change Output_data_fixed_space to
5810 Output_data_zero_fill.
5811 (Layout::create_build_id): Likewise.
5812 (Layout::print_to_mapfile): New function.
5813 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
5814 constructor. Change caller.
5815 (class Layout): Declare print_to_mapfile.
5816 * output.cc (Output_section::Input_section::print_to_mapfile): New
5818 (Output_section::add_input_section): If producing a map, always
5819 add to input_sections_ list.
5820 (Output_section::do_print_to_mapfile): New function.
5821 (Output_segment::print_sections_to_mapfile): New function.
5822 (Output_segment::print_section_list_to_mapfile): New function.
5823 * output.h: Include "mapfile.h".
5824 (Output_data::print_to_mapfile): New function.
5825 (Output_data::do_print_to_mapfile): New virtual function.
5826 (Output_segment_headers::do_print_to_mapfile): New function.
5827 (Output_file_header::do_print_to_mapfile): New function.
5828 (Output_data_const::do_print_to_mapfile): New function.
5829 (class Output_data_const_buffer): Add map_name_ field. Update
5830 constructor. Change all callers. Add do_print_to_mapfile
5832 (class Output_data_fixed_space): Likewise.
5833 (class Output_data_space): Likewise.
5834 (class Output_data_zero_fill): New class.
5835 (Output_data_strtab::do_print_to_mapfile): New function.
5836 (Output_data_reloc_base::do_print_to_mapfile): New function.
5837 (Output_relocatable_relocs::do_print_to_mapfile): New function.
5838 (Output_data_group::do_print_to_mapfile): New function.
5839 (Output_data_got::do_print_to_mapfile): New function.
5840 (Output_data_dynamic::do_print_to_mapfile): New function.
5841 (Output_symtab_xindex::do_print_to_mapfile): New function.
5842 (class Output_section): Declare do_print_to_mapflie. Declare
5843 print_to_mapfile in Input_section.
5844 (class Output_segment): Declare new functions.
5845 * object.h (Sized_relobj::symbol_count): New function.
5846 * script-sections.cc
5847 (Output_section_element_dot_assignment::set_section_addresses):
5848 Change Output_data_fixed_space to Output_data_zero_fill.
5849 (Output_data_expression::do_print_to_mapfile): New function.
5850 * script.cc (read_input_script): Add mapfile parameter. Change
5852 * script.h (read_input_script): Update declaration.
5853 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5854 (Eh_frame::do_print_to_mapfile): New function.
5855 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5856 (Output_merge_string::do_print_to_mapfile): New function.
5857 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5859 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5861 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5863 * Makefile.am (CCFILES): Add mapfile.cc.
5864 (HFILES): Add mapfile.h.
5865 * Makefile.in: Rebuild.
5867 2008-05-19 Ian Lance Taylor <iant@google.com>
5869 * options.h (class General_options): Add -z relro.
5870 * layout.cc (Layout::Layout): Initialize relro_segment_.
5871 (Layout::add_output_section_data): Return the output section.
5872 (Layout::make_output_section): Rcognize relro sections and mark
5874 (Layout::attach_allocated_section_to_segment): Put relro sections
5875 in a PT_GNU_RELRO segment.
5876 (Layout::create_initial_dynamic_sections): Mark the .dynamic
5878 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5880 (Layout::linkonce_mapping): Map d.rel.ro.local to
5882 (Layout::output_section_name): Us .data.rel.ro.local for any
5883 section which begins with that.
5884 * layout.h (class Layout): Update add_output_section_data
5885 declaration. Add relro_segment_ field.
5886 * output.cc (Output_section::Output_section): Initialize is_relro_
5887 and is_relro_local_ fields.
5888 (Output_segment::add_output_section): Group relro sections.
5889 (Output_segment::is_first_section_relro): New function.
5890 (Output_segment::maximum_alignment): If there is a relro section,
5891 align the segment to the common page size.
5892 (Output_segment::set_section_addresses): Track whether we are
5893 looking at relro sections. If the last section is a relro
5894 section, align to the common page size.
5895 (Output_segment::set_section_list_addresses): Add in_relro
5896 parameter. Change all callers. Align to the page size when
5897 moving from relro to non-relro section.
5898 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5900 * output.h (class Output_section): Add is_relro_ and
5901 is_relro_local_ fields.
5902 (Output_section::is_relro): New function.
5903 (Output_section::set_is_relro): New function.
5904 (Output_section::is_relro_local): New function.
5905 (Output_section::set_is_relro_local): New function.
5906 (class Output_segment): Update declarations.
5907 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5908 * sparc.cc (Target_sparc::got_section): Likewise.
5909 * x86_64.cc (Target_x86_64::got_section): Likewise.
5910 * testsuite/relro_test_main.cc: New file.
5911 * testsuite/relro_test.cc: New file.
5912 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5913 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5914 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5915 (relro_test.so, relro_test_pic.o): New targets.
5916 * testsuite/Makefile.in: Rebuild.
5918 2008-05-16 Ian Lance Taylor <iant@google.com>
5920 * output.cc (Output_segment::add_output_section): Remove front
5922 * output.h (class Output_segment): Remove
5923 add_initial_output_section and overloaded add_output_section.
5924 Update declaration of remaining add_output_section.
5925 * layout.cc (Layout::create_interp): Call add_output_section
5926 rather than add_initial_output_section.
5927 (Layout::finish_dynamic_section): Likewise.
5929 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5930 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5931 know the dynamic type.
5932 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5933 field. Initialize it in constructor.
5934 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5935 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5936 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5939 * output.cc (Output_reloc::get_address): Change return type to
5941 * output.h (class Output_reloc): Update get_address declaration.
5942 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5943 for section addresses.
5945 2008-05-09 Ian Lance Taylor <iant@google.com>
5948 * gold.cc (gold_nomem): Use return value of write.
5950 2008-05-08 Ian Lance Taylor <iant@google.com>
5952 * symtab.c (Symbol::init_base_output_data): Add version
5953 parameter. Change all callers.
5954 (Symbol::init_base_output_segment): Likewise.
5955 (Symbol::init_base_constant): Likewise.
5956 (Symbol::init_base_undefined): Likewise.
5957 (Sized_symbol::init_output_data): Likewise.
5958 (Sized_symbol::init_output_segment): Likewise.
5959 (Sized_symbol::init_constant): Likewise.
5960 (Sized_symbol::init_undefined): Likewise.
5961 (Symbol_table::do_define_in_output_data): If the new symbol has a
5962 version, mark it as the default.
5963 (Symbol_table::do_define_in_output_segment): Likewise.
5964 (Symbol_table::do_define_as_constant): Likewise.
5965 * symtab.h (class Symbol): Update declarations.
5966 (class Sized_symbol): Likewise.
5967 * resolve.cc (Symbol::override_version): New function.
5968 (Symbol::override_base): Call override_version.
5969 (Symbol::override_base_with_special): Likewise.
5970 * testsuite/ver_script_8.script: New file.
5971 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5972 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5973 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5974 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5976 2008-05-06 Ian Lance Taylor <iant@google.com>
5979 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5981 (class General_options): Remove existing --undefined, and add
5982 --no-undefined instead. Add new --undefined as synonym for -u.
5983 * archive.cc (Archive::add_symbols): Check whether symbol was
5985 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5986 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5987 all uses. Add IS_UNDEFINED. Update declarations to split
5988 different versions of init_base. Declare init_base_undefined.
5989 (Symbol::is_defined): Handle IS_UNDEFINED.
5990 (Symbol::is_undefined): Likewise.
5991 (Symbol::is_weak_undefined): Call is_undefined.
5992 (Symbol::is_absolute): Handle IS_CONSTANT.
5993 (class Sized_symbol): Update declarations to split different
5994 versions of init. Declare init_undefined.
5995 (class Symbol_table): Declare new functions.
5996 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5998 (Symbol::init_base_output_data): Likewise.
5999 (Symbol::init_base_output_segment): Likewise.
6000 (Symbol::init_base_constant): Likewise.
6001 (Symbol::init_base_undefined): New function.
6002 (Sized_symbol::init_object): Rename from init. Change all
6004 (Sized_symbol::init_output_data): Likewise.
6005 (Sized_symbol::init_output_segment): Likewise.
6006 (Sized_symbol::init_constant): Likewise.
6007 (Sized_symbol::init_undefined): New function.
6008 (Symbol_table::add_undefined_symbols_from_command_line): New
6010 (Symbol_table::do_add_undefined_symbols_from_command_line): New
6012 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
6013 (Symbol::output_section): Likewise.
6014 (Symbol::set_output_section): Likewise.
6015 (Symbol_table::sized_finalize_symbol): Likewise.
6016 (Symbol_table::sized_write_globals): Likewise.
6017 * resolve.cc (Symbol_table::should_override): Likewise.
6018 (Symbol::override_base_with_special): Likewise.
6020 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
6021 symbol, change it to have default visibility.
6022 * testsuite/protected_1.cc: New file.
6023 * testsuite/protected_2.cc: New file.
6024 * testsuite/protected_3.cc: New file.
6025 * testsuite/protected_main_1.cc: New file.
6026 * testsuite/protected_main_2.cc: New file.
6027 * testsuite/protected_main_3.cc: New file.
6028 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
6029 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
6030 (protected_1_LDFLAGS, protected_1_LDADD): Define.
6031 (protected_1.so): New target.
6032 (protected_1_pic.o, protected_2_pic.o): New targets.
6033 (protected_3_pic.o): New target.
6034 (check_PROGRAMS): Add protected_2.
6035 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
6036 (protected_2_LDFLAGS, protected_2_LDADD): Define.
6037 * testsuite/Makefile.in: Rebuild.
6039 * options.h (DEFINE_var): Add set_user_set_##varname__.
6040 (DEFINE_bool_alias): New macro.
6041 (class General_options): Define -Bstatic using DEFINE_bool_alias
6042 rather than DEFINE_special. Add --undefined as an alias for -z
6044 * options.cc (General_options::parse_Bstatic): Remove.
6046 * options.h (class General_options): Add --fatal-warnings.
6047 * main.cc (main): Implement --fatal-warnings.
6048 * errors.h (Errors::warning_count): New function.
6050 * options.h (class General_options): Add -Bsymbolic-functions.
6051 * symtab.h (Symbol::is_preemptible): Check for
6052 -Bsymbolic-functions.
6054 2008-05-05 Ian Lance Taylor <iant@google.com>
6056 * options.h (DEFINE_bool): For DASH_Z, create the negative option
6057 as noVARNAME rather than no-VARNAME.
6058 (class General_options): Add option -z combreloc.
6059 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
6061 (Output_reloc::sort_before) [SHT_REL]: New function.
6062 (Output_reloc::sort_before) [SHT_RELA]: New function.
6063 (class Output_data_reloc_base): Add sort_relocs_ field. Define
6064 Sort_relocs_comparison.
6065 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
6066 parameter. Change all callers.
6067 (Output_data_reloc::Output_data_reloc) [both versions]: Add
6068 sort_relocs parameter. Change all callers.
6069 * output.cc (Output_reloc::get_address): New function, broken out
6071 (Output_reloc::write_rel): Call it.
6072 (Output_reloc::compare): New function.
6073 (Output_data_reloc_base::do_write): Optionally sort relocs.
6075 * configure.ac: If targ_extra_obj is set, link it in.
6076 * configure.tgt: Initialize all variables.
6077 (x86_64*): Set targ_extra_obj and targ_extra_size.
6078 * configure: Rebuild.
6080 * object.cc (Sized_relobj::include_section_group): Adjust section
6081 indexes read from group data. Build vector to pass to
6083 * layout.cc (Layout::layout_group): Add flags and shndxes
6084 parameters. Remove contents parameter. Change caller. Update
6085 explicit instantiations.
6086 * layout.h (class Layout): Update layout_group declaration.
6087 * output.cc (Output_data_group::Output_data_group): Add flags and
6088 input_shndxes parameters. Remove contents parameter. Change
6090 (Output_data_group::do_write): Change input_sections_ to
6092 * output.h (class Output_data_group): Update constructor
6093 declaration. Rename input_sections_ to input_shndxes_.
6094 * testsuite/many_sections_test.cc: Add template.
6096 2008-04-30 Cary Coutant <ccoutant@google.com>
6098 * target-reloc.h (relocate_section): Fix dead-pointer bug.
6100 * layout.cc (Layout::include_section): Refactored check for debug
6102 (Layout::add_comdat): Add new parameters. Change type
6103 of signature parameter. Add object and shndx to signatures table.
6104 (Layout::find_kept_object): New function.
6105 * layout.h: Include <cstring>.
6106 (Layout::is_debug_info_section): New function.
6107 (Layout::add_comdat): Add new parameters.
6108 (Layout::find_kept_object): New function.
6109 (Layout::Kept_section): New struct.
6110 (Layout::Signatures): Change type of map range.
6111 * object.cc (Relobj::output_section_address): New function.
6112 (Sized_relobj::include_section_group): Add new parameters. Change
6113 calls to Layout::add_comdat. Change to build table of kept comdat
6114 groups and table mapping discarded sections to kept sections.
6115 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
6116 (Sized_relobj::do_layout): Change calls to include_section_group and
6117 include_linkonce_section.
6118 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
6119 value to zero when section is discarded.
6120 (Sized_relobj::map_to_kept_section): New function.
6121 * object.h (Relobj::output_section_address): New function.
6122 (Relobj::Comdat_group): New type.
6123 (Relobj::find_comdat_group): New function.
6124 (Relobj::Comdat_group_table): New type.
6125 (Relobj::Kept_comdat_section): New type.
6126 (Relobj::Kept_comdat_section_table): New type.
6127 (Relobj::add_comdat_group): New function.
6128 (Relobj::set_kept_comdat_section): New function.
6129 (Relobj::get_kept_comdat_section): New function.
6130 (Relobj::comdat_groups_): New field.
6131 (Relobj::kept_comdat_sections_): New field.
6132 (Symbol_value::input_value): Update comment.
6133 (Sized_relobj::map_to_kept_section) New function.
6134 (Sized_relobj::include_linkonce_section): Add new parameter.
6135 * target-reloc.h (Comdat_behavior): New type.
6136 (get_comdat_behavior): New function.
6137 (relocate_section): Add code to map a discarded section to the
6138 corresponding kept section when applying a relocation.
6140 2008-04-30 Craig Silverstein <csilvers@google.com>
6142 * dwarf_reader.cc (next_generation_count): New static var.
6143 (Addr2line_cache_entry): New struct.
6144 (addr2line_cache): New static var.
6145 (Dwarf_line_info::one_addr2line): Added caching.
6146 (Dwarf_line_info::clear_addr2line_cache): New function.
6147 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
6148 cache-size parameter.
6149 (Dwarf_line_info::one_addr2line_cache): New function.
6150 * symtab.cc (Symbol_table::detect_odr_violations): Pass
6151 new cache-size argument to one_addr2line(), and clear cache.
6153 2008-04-28 Cary Coutant <ccoutant@google.com>
6155 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
6156 R_386_PC8 relocations.
6158 2008-04-23 Ian Lance Taylor <iant@google.com>
6160 * object.cc (Sized_relobj::include_section_group): Check for
6161 invalid section group.
6163 * object.cc (make_elf_object): Correct test for 64-bit ELF file
6166 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
6167 than read for file header.
6168 * archive.cc (Archive::include_member): Likewise.
6170 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
6172 * aclocal.m4: Regenerate.
6173 * configure: Regenerate.
6175 2008-04-19 Ian Lance Taylor <iant@google.com>
6177 * version.cc (version_string): Bump to 1.6.
6179 * testsuite/Makefile.am (many_sections_r_test): New target.
6180 (many_sections_r_test_SOURCES): Remove.
6181 (many_sections_r_test_DEPENDENCIES): Remove.
6182 (many_sections_r_test_LDFLAGS): Remove.
6183 (many_sections_r_test_LDADD): Remove.
6185 * object.cc (Sized_relobj::do_add_symbols): Always pass
6186 local_symbol_count_ to add_from_relobj.
6188 * testsuite/Makefile.am (many_sections_check.h): Only check one in
6189 every thousand variables.
6190 * testsuite/Makefile.in: Rebuild.
6192 * object.cc (Xindex::initialize_symtab_xindex): New function.
6193 (Xindex::read_symtab_xindex): New function.
6194 (Xindex::sym_xindex_to_shndx): New function.
6195 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
6197 (Sized_relobj::do_initialize_xindex): New function.
6198 (Sized_relobj::do_read_symbols): Adjust section links.
6199 (Sized_relobj::symbol_section_and_value): Add is_ordinary
6200 parameter. Change all callers.
6201 (Sized_relobj::include_section_group): Adjust section links and
6202 symbol section indexes.
6203 (Sized_relobj::do_layout): Adjust section links.
6204 (Sized_relobj::do_count_local_symbols): Adjust section links and
6205 symbol section indexes.
6206 (Sized_relobj::do_finalize_local_symbols): Distinguish between
6207 ordinary and special symbols.
6208 (Sized_relobj::write_local_symbols): Add symtab_xindex and
6209 dynsym_xindex parameters. Change all callers. Adjust section
6210 links. Use SHN_XINDEX when needed.
6211 (Sized_relobj::get_symbol_location_info): Adjust section links.
6212 Don't get fooled by special symbols.
6213 * object.h (class Xindex): Define.
6214 (class Object): Add xindex_ parameter. Declare virtual functoin
6215 do_initialize_xindex.
6216 (Object::adjust_sym_shndx): New function.
6217 (Object::set_xindex): New protected function.
6218 (class Symbol_value): Add is_ordinary_shndx_ field.
6219 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
6220 (Symbol_value::value): Assert ordinary section.
6221 (Symbol_value::initialize_input_to_output_map): Likewise.
6222 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
6224 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
6226 (class Sized_relobj): Update declarations.
6227 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
6228 parameter. Change all callers.
6229 (Sized_relobj::adjust_shndx): New function.
6230 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
6232 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
6233 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
6234 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
6235 (Sized_dynobj::read_dynsym_section): Adjust section links.
6236 (Sized_dynobj::read_dynamic): Likewise.
6237 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
6239 (Sized_dynobj::do_initialize_xindex): New function.
6240 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
6241 do_initialize_xindex.
6242 (Sized_dynobj::adjust_shndx): New function.
6243 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
6244 dynsym_xindex_ fields.
6245 (Layout::finalize): Add a call to set_section_indexes before
6246 creating the symtab sections.
6247 (Layout::set_section_indexes): Don't do anything if the section
6248 already has a section index.
6249 (Layout::create_symtab_sections): Add shnum parameter. Change
6250 caller. Create .symtab_shndx section if needed.
6251 (Layout::create_shdrs): Add shstrtab_section parameter. Change
6253 (Layout::allocated_output_section_count): New function.
6254 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
6256 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
6257 fields. Update declarations.
6258 (Layout::symtab_xindex): New function.
6259 (Layout::dynsym_xindex): New function.
6260 (class Write_symbols_task): Add layout_ field.
6261 (Write_symbols_task::Write_symbols_task): Add layout parameter.
6263 * output.cc (Output_section_headers::Output_section_headers): Add
6264 shstrtab_section parameter. Change all callers.
6265 (Output_section_headers::do_sized_write): Store overflow values
6266 for section count and section string table section index in
6267 section header zero.
6268 (Output_file_header::do_sized_write): Check for overflow of
6269 section count and section string table section index.
6270 (Output_symtab_xindex::do_write): New function.
6271 (Output_symtab_xindex::endian_do_write): New function.
6272 * output.h (class Output_section_headers): Add shstrtab_section_.
6273 Update declarations.
6274 (class Output_symtab_xindex): Define.
6275 (Output_section::has_out_shndx): New function.
6276 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
6278 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
6280 (Sized_symbol::init): Likewise.
6281 (Symbol::output_section): Check for ordinary symbol.
6282 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
6283 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
6285 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
6286 Change all callers. Simplify handling of symbols from sections
6287 not included in the link.
6288 (Symbol_table::add_from_dynobj): Handle ordinary symbol
6290 (Weak_alias_sorter::operator()): Assert that symbols are
6292 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
6294 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
6295 parameters. Change all callers.
6296 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
6297 symbol distinction. Use SHN_XINDEX when needed.
6298 (Symbol_table::write_section_symbol): Add symtab_xindex
6299 parameter. Change all callers.
6300 (Symbol_table::sized_write_section_symbol): Likewise. Use
6301 SHN_XINDEX when needed.
6302 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
6304 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
6305 (Symbol::is_defined): Check is_ordinary.
6306 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
6307 (Symbol::is_absolute, Symbol::is_common): Likewise.
6308 (class Sized_symbol): Update declarations.
6309 (class Symbol_table): Update declarations.
6310 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
6311 parameters. Change all callers.
6312 (Sized_symbol::override): Likewise.
6313 (Symbol_table::override): Likewise.
6314 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
6315 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
6316 is_ordinary, and orig_st_shndx parameters. Change all callers.
6317 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
6318 to be in an ordinary section.
6319 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
6320 object and is_ordinary parameters. Change all callers.
6321 (Sized_dwarf_line_info::read_relocs): Add object parameter.
6322 Change all callers. Don't add undefined or non-ordinary symbols
6324 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
6326 * dwarf_reader.h (class Sized_dwarf_line_info): Update
6328 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
6329 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
6330 (Sized_relobj::relocate_sections): Likewise.
6331 * target-reloc.h (scan_relocs): Adjust section symbol index.
6332 (scan_relocatable_relocs): Likewise.
6333 * i386.cc (Scan::local): Check for ordinary symbols.
6334 * sparc.cc (Scan::local): Likewise.
6335 * x86_64.cc (Scan::local): Likewise.
6336 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
6337 to symbol_section_and_value.
6338 * testsuite/many_sections_test.cc: New file.
6339 * testsuite/Makefile.am (BUILT_SOURCES): Define.
6340 (check_PROGRAMS): Add many_sections_test.
6341 (many_sections_test_SOURCES): Define.
6342 (many_sections_test_DEPENDENCIES): Define.
6343 (many_sections_test_LDFLAGS): Define.
6344 (BUILT_SOURCES): Add many_sections_define.h.
6345 (many_sections_define.h): New target.
6346 (BUILT_SOURCES): Add many_sections_check.h.
6347 (many_sections_check.h): New target.
6348 (check_PROGRAMS): Add many_sections_r_test.
6349 (many_sections_r_test_SOURCES): Define.
6350 (many_sections_r_test_DEPENDENCIES): Define.
6351 (many_sections_r_test_LDFLAGS): Define.
6352 (many_sections_r_test_LDADD): Define.
6353 (many_sections_r_test.o): New target.
6354 * testsuite/Makefile.in: Rebuild.
6356 2008-04-17 Cary Coutant <ccoutant@google.com>
6358 * errors.cc (Errors::info): New function.
6359 (gold_info): New function.
6360 * errors.h (Errors::info): New function.
6361 * gold.h (gold_info): New function.
6362 * object.cc (Input_objects::add_object): Print trace output.
6363 * options.cc (options::parse_set): New function.
6364 (General_options::parse_wrap): Deleted.
6365 (General_options::General_options): Deleted initializer.
6366 * options.h (options::String_set): New typedef.
6367 (options::parse_set): New function.
6368 (DEFINE_set): New macro.
6369 (General_options::wrap): Changed to use DEFINE_set. Changed
6370 callers of any_wrap_symbols and is_wrap_symbol.
6371 (General_options::trace, General_options::trace_symbol):
6373 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
6374 (General_options::wrap_symbols_): Deleted.
6375 * symtab.cc (Symbol_table::add_from_object): Print trace output.
6377 2008-04-17 David S. Miller <davem@davemloft.net>
6379 * options.cc (General_options::parse_V): New function.
6380 * options.h: Add entries for -V and -Qy.
6382 2008-04-17 Ian Lance Taylor <iant@google.com>
6384 * common.cc (Symbol_table::allocate_commons): Remove options
6385 parameter. Change caller.
6386 (Symbol_table::do_allocate_commons): Remove options parameter.
6387 Change caller. Just call do_allocate_commons_list twice.
6388 (Symbol_table::do_allocate_commons_list): New function, broken out
6389 of do_allocate_commons.
6390 * common.h (class Allocate_commons_task): Remove options_ field.
6392 * symtab.cc (Symbol_table::Symbol_table): Initialize
6394 (Symbol_table::add_from_object): Put TLS common symbols on
6396 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
6397 which are IN_OUTPUT_DATA.
6398 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
6399 allocate_commons and do_allocate_commons declarations. Declare
6400 do_allocate_commons_list.
6401 * gold.cc (queue_middle_tasks): Update creation of
6402 Allocate_commons_task to not pass options.
6403 * testsuite/Makefile.am (INCLUDES): Add -I.. .
6404 (TLS_TEST_C_FLAGS): New variable.
6405 (tls_test_c_pic.o): New target.
6406 (tls_test_shared.so): Link in tls_test_c_pic.o.
6407 (tls_test_c_pic_ie.o): New target.
6408 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
6409 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
6410 (tls_test_c.o): New target.
6411 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
6412 (tls_pic_test_LDADD): Likewise.
6413 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
6414 (tls_shared_gd_to_ie_test_LDADD): Likewise.
6415 (tls_test_c_gnu2.o): New target.
6416 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
6418 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
6419 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
6420 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
6421 * testsuite/tls_test.cc: Include "config.h".
6422 (t_last): Call t11_last.
6423 * testsuite/tls_test.h (t11, t11_last): Declare.
6424 * testsuite/tls_test_c.c: New file.
6425 * testsuite/tls_test_main.cc (thread_routine): Call t11.
6426 * configure.ac: Check for OpenMP support.
6427 * configure, config.in, Makefile.in: Rebuild.
6428 * testsuite/Makefile.in: Rebuild.
6430 2008-04-16 Cary Coutant <ccoutant@google.com>
6432 * i386.cc (Target_i386::define_tls_base_symbol): New function.
6433 (Target_i386::tls_base_symbol_defined_): New field.
6434 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6435 (Target_i386::Scan::global): Likewise.
6436 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
6437 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
6438 (Target_x86_64::tls_base_symbol_defined_): New field.
6439 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6440 (Target_x86_64::Scan::global): Likewise.
6442 2008-04-16 Cary Coutant <ccoutant@google.com>
6444 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
6445 (Symbol::needs_plt_entry): Allow weak undefined symbols.
6446 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
6447 building shared libraries.
6448 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
6449 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
6450 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
6451 * testsuite/Makefile.in: Rebuild.
6452 * testsuite/weak_undef.h: New file.
6453 * testsuite/weak_undef_file1.cc: Add extra test cases.
6454 * testsuite/weak_undef_file2.cc: Likewise.
6455 * testsuite/weak_undef_test.cc: Likewise.
6457 2008-04-16 David S. Miller <davem@davemloft.net>
6459 * sparc.cc (Target_sparc::Scan): Change from struct to class.
6460 Add issued_non_pic_error_ field. Declare check_non_pic.
6461 (Target_sparc::Scan::check_non_pic): New function.
6462 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
6463 (Target_sparc::Scan::global): Likewise.
6465 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
6466 * configure: Rebuild.
6468 * options.h (DEFINE_enable): New macro.
6469 (new_dtags): New enable option.
6470 (initfirst, interpose, loadfltr, nodefaultlib,
6471 nodelete, nodlopen, nodump): New -z options.
6472 * layout.cc (Layout:finish_dynamic_section): If new
6473 dtags enabled, emit DT_RUNPATH. Also, emit a
6474 DT_FLAGS_1 containing any specified -z flags.
6476 2008-04-16 Ian Lance Taylor <iant@google.com>
6478 * copy-relocs.cc: New file.
6479 * copy-relocs.h: New file.
6480 * reloc.cc: Remove Copy_relocs code.
6481 * reloc.h: Likewise.
6482 * reloc-types.h (struct Reloc_types) [both versions]: Add
6483 get_reloc_addend_noerror.
6484 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
6485 variants of add_global which take an addend which must be zero.
6486 * i386.cc: Include "copy-relocs.h".
6487 (class Target_i386): Change type of copy_relocs_ to variable,
6489 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
6491 (Target_i386::do_finalize_sections): Change handling of
6493 * sparc.cc: Include "copy-relocs.h".
6494 (class Target_sparc): Change type of copy_relocs_ to variable,
6496 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
6498 (Target_sparc::do_finalize_sections): Change handling of
6500 * x86_64.cc: Include "copy-relocs.h".
6501 (class Target_x86_64): Change type of copy_relocs_ to variable,
6503 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
6504 class. Change all callers.
6505 (Target_x86_64::do_finalize_sections): Change handling of
6507 * Makefile.am (CCFILES): Add copy-relocs.cc.
6508 (HFILES): Add copy-relocs.h.
6510 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
6512 * testsuite/script_test_4.sh: Permit leading zeroes.
6514 2008-04-15 Ian Lance Taylor <iant@google.com>
6516 * script-sections.cc (Script_sections::create_segments): Use
6517 header_size_adjustment even when there is enough room for the
6519 * testsuite/script_test_4.sh: New file.
6520 * testsuite/script_test_4.t: New file.
6521 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
6522 (check_DATA): Add script_test_4.stdout.
6523 (MOSTLYCLEANFILES): Likewise.
6524 (script_test_4): New target.
6525 (script_test_4.stdout): New target.
6526 * testsuite/Makefile.in: Rebuild.
6528 * sparc.cc: Add definitions for Output_data_plt_sparc class
6531 2008-04-14 David S. Miller <davem@davemloft.net>
6533 * sparc.cc: New file.
6534 * Makefile.am (TARGETSOURCES): Add sparc.cc
6535 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
6536 * configure.tgt: Document targ_extra_size and
6537 targ_extra_big_endian. Add entries for sparc-* and
6539 * configure.ac: Handle targ_extra_size and
6540 targ_extra_big_endian.
6541 * Makefile.in: Rebuild.
6542 * configure: Likewise.
6543 * po/POTFILES.in: Likewise.
6544 * po/gold.pot: Likewise.
6546 2008-04-14 Ian Lance Taylor <iant@google.com>
6548 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
6549 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
6550 in the name/type/flags to section mapping. Don't call
6551 allocate_output_section.
6552 (Layout::choose_output_section): Change parameter from adjust_name
6553 to is_input_section. Don't permit input sections after sections
6554 are attached to segments. Don't call allocate_output_section.
6555 (Layout::layout_eh_frame): Call update_flags_for_input_section,
6556 not write_enable_output_section.
6557 (Layout::make_output_section): Don't push to
6558 unattached_section_list_ nor call attach_to_segment. Call
6559 attach_section_to_segment if sections are attached.
6560 (Layout::attach_sections_to_segments): New function.
6561 (Layout::attach_section_to_segment): New function.
6562 (Layout::attach_allocated_section_to_segment): Rename from
6563 attach_to_segment. Remove flags parameter.
6564 (Layout::allocate_output_section): Remove function.
6565 (Layout::write_enable_output_section): Remove function.
6566 * layout.h (class Layout): Update for above changes. Add new
6567 field sections_are_attached_.
6568 * output.h (Output_section::update_flags_for_input_section): New
6570 * output.cc (Output_section::add_input_section): Call
6571 update_flags_for_input_section.
6572 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
6574 2008-04-11 Cary Coutant <ccoutant@google.com>
6576 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
6577 thought unnecessary.
6578 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
6580 2008-04-11 Ian Lance Taylor <iant@google.com>
6582 * output.h (class Output_section_data): Remove inline definition
6584 * output.cc (Output_section_data::set_addralign): New function.
6586 2008-04-11 Cary Coutant <ccoutant@google.com>
6588 Add support for TLS descriptors for i386 and x86_64.
6589 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
6590 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
6591 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
6593 (Target_i386::got_mod_index_entry): Remove unnecessary code.
6594 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
6595 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
6597 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
6598 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
6599 Fix problem with initial-exec relocations.
6600 (Target_i386::Relocate::relocate_tls): Likewise.
6601 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
6603 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
6604 support for section-plus-offset dynamic table entries.
6605 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
6606 (Output_data_dynamic::Dynamic_entry): Add support for
6607 section-plus-offset dynamic table entries.
6608 (Output_data_dynamic::Classification): Likewise.
6609 (Output_data_dynamic::classification_): Renamed offset_.
6610 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
6611 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
6612 (Target_x86_64::make_plt_section): New function.
6613 (Target_x86_64::reserve_tlsdesc_entries): New function.
6614 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
6615 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
6616 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
6617 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
6618 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
6619 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
6620 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
6621 add extra PLT entry for TLS descriptors.
6622 (Output_data_plt_x86_64::got_): New field.
6623 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
6624 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
6626 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
6628 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
6629 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
6630 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
6631 R_386_TLS_DESC_CALL relocations.
6632 (Target_x86_64::Scan::global): Likewise.
6633 (Target_x86_64::do_finalize_sections): Add dynamic table entries
6634 for TLS descriptors.
6635 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
6636 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
6637 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
6638 GD-to-IE relaxation.
6639 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
6640 and TLS_DESCRIPTORS.
6641 * Makefile.in: Rebuild.
6642 * configure: Rebuild.
6643 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
6644 (tls_test_shared2.so): New target.
6645 (tls_shared_gd_to_ie_test_SOURCES): New variable.
6646 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
6647 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
6648 (tls_shared_gd_to_ie_test_LDADD): New variable.
6649 (tls_shared_gnu2_gd_to_ie_test): New target.
6650 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
6652 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
6653 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
6654 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
6655 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
6656 (tls_shared_gnu2_test): New target.
6657 (tls_test_gnu2_shared.so): New target.
6658 (tls_shared_gnu2_test_SOURCES): New variable.
6659 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
6660 (tls_shared_gnu2_test_LDFLAGS): New variable.
6661 (tls_shared_gnu2_test_LDADD): New variable.
6662 * testsuite/Makefile.in: Rebuild.
6663 * testsuite/Makefile.
6665 2008-04-11 Ian Lance Taylor <iant@google.com>
6667 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
6669 * testsuite/Makefile.in: Rebuild.
6671 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
6673 * testsuite/script_test_2.cc (main): Adjust test.
6675 2008-04-11 David S. Miller <davem@davemloft.net>
6676 Ian Lance Taylor <iant@google.com>
6678 * options.h (General_options): Add entries for '-Y' and
6680 * options.cc (General_options:finalize): If -Y was used, add those
6681 entries to the library path instead of the default "/lib" and
6684 2008-04-11 David S. Miller <davem@davemloft.net>
6686 * testsuite/justsyms.t: Start at 0x100.
6687 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
6688 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
6690 * testsuite/script_test_2.cc: Adjust string and section length
6693 2008-04-09 Ian Lance Taylor <iant@google.com>
6696 * script-sections.cc (Sections_element::allocate_to_segment): Add
6698 (Output_section_definition::allocate_to_segment): Likewise.
6699 (Orphan_output_section::allocate_to_segment): Likewise.
6700 (Script_sections::attach_sections_using_phdrs_clause): Don't
6701 propagate non-PT_LOAD segments to orphan sections.
6702 * testsuite/Makefile.am (script_test_3.stdout): Generate using
6703 readelf rather than objdump.
6704 * testsuite/script_test_3.sh: Adjust accordingly. Test that
6705 .interp section and PT_INTERP segment are the same size.
6706 * testsuite/Makefile.in: Rebuild.
6708 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
6709 aliases for symbols defined in the same object.
6710 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
6711 (weak_alias_test_SOURCES): New variable.
6712 (weak_alias_test_DEPENDENCIES): New variable.
6713 (weak_alias_test_LDFLAGS): New variable.
6714 (weak_alias_test_LDADD): New variable.
6715 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
6716 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
6717 (weak_alias_test_3.o): New target.
6718 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
6719 * testsuite/weak_alias_test_main.cc: New file.
6720 * testsuite/weak_alias_test_1.cc: New file.
6721 * testsuite/weak_alias_test_2.cc: New file.
6722 * testsuite/weak_alias_test_3.cc: New file.
6724 2008-04-08 Ian Lance Taylor <iant@google.com>
6726 * options.h (class General_options): Add --noinhibit-exec option.
6727 * main.cc (main): Check --noinhibit-exec.
6729 * options.h (class General_options): Define --wrap as a special
6730 option. Add wrap_symbols_ field.
6731 (General_options::any_wrap_symbols): New function.
6732 (General_options::is_wrap_symbol): New function.
6733 * options.cc (General_options::parse_wrap): New function.
6734 (General_options::General_options): Initialize wrap_symbols_.
6735 * symtab.cc (Symbol_table::wrap_symbol): New function.
6736 (Symbol_table::add_from_object): Handle --wrap.
6737 * symtab.h (class Symbol_table): Declare wrap_symbol.
6738 * target.h (Target::wrap_char): New function.
6739 (Target::Target_info): Add wrap_char field.
6740 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6741 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6742 * testsuite/testfile.cc (Target_test::test_target_info):
6745 * errors.cc (Errors::undefined_symbol): Mention symbol version if
6748 * layout.h (class Layout): Add added_eh_frame_data_ field.
6749 * layout.cc (Layout::Layout): Initialize new field.
6750 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6751 output section until we find a section we merged successfully.
6752 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6753 that the size be non-zero.
6755 * merge.cc (Object_merge_map::get_output_offset): Remove inline
6758 2008-04-08 Craig Silverstein <csilvers@google.com>
6760 * configure.ac: Export new conditional variable HAVE_ZLIB.
6761 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6763 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6764 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6766 2008-04-07 Ian Lance Taylor <iant@google.com>
6768 * version.cc (version_string): Set to "1.5".
6770 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6771 Add issued_non_pic_error_ field. Declare check_non_pic.
6772 (Target_x86_64::Scan::check_non_pic): New function.
6773 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6774 (Target_x86_64::Scan::global): Likewise.
6776 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6777 addend parameter. Change caller. Handle merge sections.
6778 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6779 Address to Addend. Don't add in the result of
6780 local_section_offset, pass down the addend and use the returned
6782 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6783 Update declarations of local_section_offset and symbol_value.
6784 * testsuite/two_file_test_1.cc (t18): New function.
6785 * testsuite/two_file_test_2.cc (f18): New function.
6786 * testsuite/two_file_test_main.cc (main): Call t18.
6787 * testsuite/two_file_test.h (t18, f18): Declare.
6789 * configure.ac: Don't test for objdump, c++filt, or readelf.
6790 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6792 (TEST_READELF): New variable.
6793 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6794 (check_PROGRAMS): Add two_file_strip_test.
6795 (two_file_strip_test): New target.
6796 (check_PROGRAMS): Add two_file_same_shared_strip_test.
6797 (two_file_same_shared_strip_test_SOURCES): New variable.
6798 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6799 (two_file_same_shared_strip_test_LDFLAGS): New variable.
6800 (two_file_same_shared_strip_test_LDADD): New variable.
6801 (two_file_shared_strip.so): New target.
6802 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6803 (ver_test_5.syms, ver_test_7.syms): Likewise.
6804 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6805 (strip_test_3.stdout): Use TEST_OBJDUMP.
6806 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6808 2008-04-04 Cary Coutant <ccoutant@google.com>
6810 * symtab.h (Symbol::is_weak_undefined): New function.
6811 (Symbol::is_strong_undefined): New function.
6812 (Symbol::is_absolute): New function.
6813 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6814 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6816 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6817 (weak_undef_test): New target.
6818 * testsuite/Makefile.in: Rebuild.
6819 * testsuite/weak_undef_file1.cc: New file.
6820 * testsuite/weak_undef_file2.cc: New file.
6821 * testsuite/weak_undef_test.cc: New file.
6823 2008-04-03 Craig Silverstein <csilvers@google.com>
6825 * compressed_output.h (class Output_compressed_section): Use
6827 * compressed_output.cc (zlib_compress): Use unsigned buffers,
6829 (zlib_compressed_suffix): Removed.
6830 (Output_compressed_section::set_final_data_size): Use unsigned
6832 * testsuite/Makefile.am (flagstest_compress_debug_sections):
6833 Fix linker invocation.
6834 (flagstest_o_specialfile_and_compress_debug_sections):
6836 * testsuite/Makefile.in: Regenerated.
6838 2008-04-02 David S. Miller <davem@davemloft.net>
6840 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6841 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6843 2008-04-02 Craig Silverstein <csilvers@google.com>
6847 2008-04-02 Ian Lance Taylor <iant@google.com>
6849 * fileread.cc (File_read::find_view): Add byteshift and vshifted
6850 parameters. Update for new key type to views_. Change all
6852 (File_read::read): Adjust for byteshift in returned view.
6853 (File_read::add_view): New function, broken out of
6855 (File_read::make_view): New function, broken out of
6857 (File_read::find_or_make_view): Add offset and aligned
6858 parameters. Rewrite accordingly. Change all callers.
6859 (File_read::get_view): Add offset and aligned parameters. Adjust
6860 for byteshift in return value.
6861 (File_read::get_lasting_view): Likewise.
6862 * fileread.h (class File_read): Update declarations.
6863 (class File_read::View): Add byteshift_ field. Add byteshift to
6864 constructor. Add byteshift method.
6865 * archive.h (Archive::clear_uncached_views): New function.
6866 (Archive::get_view): Add aligned parameter. Change all callers.
6867 * object.h (Object::get_view): Add aligned parameter. Change all
6869 (Object::get_lasting_view): Likewise.
6871 * fileread.cc (File_read::release): Don't call clear_views if
6872 there are multiple objects.
6873 * fileread.h (File_read::clear_uncached_views): New function.
6874 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6877 2008-03-31 Cary Coutant <ccoutant@google.com>
6879 Add thin archive support.
6880 * archive.cc (Archive::armagt): New const.
6881 (Archive::setup): Remove task parameter and calls to unlock.
6882 (Archive::unlock_nested_archives): New function.
6883 (Archive::read_header): Add nested_off parameter. Change
6885 (Archive::interpret_header): Likewise.
6886 (Archive::include_all_members): Change to handle thin
6888 (Archive::include_member): Likewise.
6889 * archive.h (Archive::Archive): Add new parameters and
6891 (Archive::armagt): New const.
6892 (Archive::setup): Remove task parameter.
6893 (Archive::unlock_nested_archives): New function.
6894 (Archive::read_header): Add nested_off parameter.
6895 (Archive::interpret_header): Likewise.
6896 (Archive::Nested_archive_table): New typedef.
6897 (Archive::is_thin_archive_): New field.
6898 (Archive::nested_archives_): New field.
6899 (Archive::options_): New field.
6900 (Archive::dirpath_): New field.
6901 (Archive::task_): New field.
6902 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6903 for thin archives. Pass additional parameters to
6904 Archive::Archive. Unlock the archive file after calling
6907 2008-03-29 Ian Lance Taylor <iant@google.com>
6909 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6910 version symbol to be local.
6911 * testsuite/ver_test_4.sh: New file.
6912 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6913 (check_DATA): Add ver_test_4.syms.
6914 (ver_test_4.syms): New target.
6915 * testsuite/Makefile.in: Rebuild.
6918 (Output_section::Input_section_sort_entry::has_priority): New
6920 (Output_section::Input_section_sort_entry::match_file_name): New
6922 (Output_section::Input_section_sort_entry::match_section_name):
6924 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6926 (Output_section::Input_section_sort_entry::match_section_file):
6928 (Output_section::Input_section_sort_compare::operator()): Rewrite
6929 using new Input_section_sort_entry functions. Sort crtbegin and
6930 crtend first. Sort sections with no priority before sections with
6932 * testsuite/initpri1.c (d3): Check j != 4.
6933 (cd5): New constructor/destructor function.
6934 (main): Check j != 2.
6936 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6937 new symbol when resolving, don't call set_is_default.
6938 * testsuite/ver_test_7.cc: New file.
6939 * testsuite/ver_test_7.sh: New file.
6940 * testsuite/Makefile.am (ver_test_7.so): New target.
6941 (ver_test_7.o): New target.
6942 (check_SCRIPTS): Add ver_test_7.sh.
6943 (check_DATA): Add ver_test_7.syms.
6944 (ver_test_7.syms): New target.
6946 2008-03-28 Ian Lance Taylor <iant@google.com>
6948 * layout.cc (Layout::layout): If we see an input section with a
6949 name that needs sorting, set the must_sort flag for the output
6951 (Layout::make_output_section): If the name of the output section
6952 indicates that it might require sorting, set the may_sort flag.
6953 * output.h (Output_section::may_sort_attached_input_sections): New
6955 (Output_section::set_may_sort_attached_input_sections): New
6957 (Output_section::must_sort_attached_input_sections): New
6959 (Output_section::set_must_sort_attached_input_sections): New
6961 (class Output_section): Declare Input_section_sort_entry. Define
6962 Input_section_sort_compare. Declare
6963 sort_attached_input_sections. Add new fields:
6964 may_sort_attached_input_sections_,
6965 must_sort_attached_input_sections_,
6966 attached_input_sections_are_sorted_.
6967 * output.cc (Output_section::Output_section): Initialize new
6969 (Output_section::add_input_section): Add an entry to
6970 input_sections_ if may_sort or must_sort are true.
6971 (Output_section::set_final_data_size): Call
6972 sort_attached_input_sections if necessary.
6973 (Output_section::Input_section_sort_entry): Define new class.
6974 (Output_section::Input_section_sort_compare::operator()): New
6976 (Output_section::sort_attached_input_sections): New function.
6977 * configure.ac: Check whether the compiler supports constructor
6978 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6979 * testsuite/initpri1.c: New file.
6980 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6981 CONSTRUCTOR_PRIORITY.
6982 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6983 (initpri1_LDFLAGS): New variable.
6984 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6986 2008-03-27 Ian Lance Taylor <iant@google.com>
6988 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6989 * testsuite/common_test_1.c: New file.
6990 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6991 (common_test_1_SOURCES): New variable.
6992 (common_test_1_DEPENDENCIES): New variable.
6993 (common_test_1_LDFLAGS): New variable.
6995 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6996 and commons_ correctly when NAME/VERSION does not override
6998 * testsuite/ver_test_6.c: New file.
6999 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
7000 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
7001 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
7003 2008-03-26 Ian Lance Taylor <iant@google.com>
7005 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
7006 of an undefined symbol from a version script.
7007 * testsuite/Makefile.am (ver_test_5.so): New target.
7008 (ver_test_5.o): New target.
7009 (check_SCRIPTS): Add ver_test_5.sh.
7010 (check_DATA): Add ver_test_5.syms.
7011 (ver_test_5.syms): New target.
7012 * testsuite/ver_test_5.cc: New file.
7013 * testsuite/ver_test_5.script: New file.
7014 * testsuite/ver_test_5.sh: New file.
7015 * Makefile.in, testsuite/Makefile.in: Rebuild.
7018 Fix problems building gold with gcc 4.3.0.
7019 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
7020 (gold_error_at_location, gold_warning_at_location): Use it.
7021 * configure.ac: Check whether we can compile and use a template
7022 function with a printf attribute.
7023 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
7024 when jumping over bytes.
7025 * object.cc: Instantiate Object::read_section_data.
7026 * debug.h: Include <cstring>
7027 * dwarf_reader.cc: Include <algorithm>
7028 * main.cc: Include <cstring>.
7029 * options.cc: Include <cstring>.
7030 * output.cc: Include <cstring>.
7031 * script.cc: Include <cstring>.
7032 * script.h: Include <string>.
7033 * symtab.cc: Include <cstring> and <algorithm>.
7034 * target-select.cc: Include <cstring>.
7035 * version.cc: Include <string>.
7036 * testsuite/testmain.cc: Include <cstdlib>.
7037 * configure, config.in: Rebuild.
7039 2008-03-25 Ian Lance Taylor <iant@google.com>
7041 * options.cc: Include "../bfd/bfdver.h".
7042 (options::help): Print bug reporting address.
7044 * version.cc (print_version): Adjust output for current value of
7049 * options.cc (options::help): Print list of supported targets.
7050 * target-select.h: Include <vector>.
7051 (class Target_selector): Make machine_, size_, and is_big_endian_
7052 fields const. Add bfd_name_ and instantiated_target_ fields.
7053 (Target_selector::Target_selector): Add bfd_name parameter.
7054 (Target_selector::recognize): Make non-virtual, call
7056 (Target_selector::recognize_by_name): Make non-virtual, call
7057 do_recognize_by_name.
7058 (Target_selector::supported_names): New function.
7059 (Target_selector::bfd_name): New function.
7060 (Target_selector::do_instantiate_target): New pure virtual
7062 (Target_selector::do_recognize): New virtual function.
7063 (Target_selector::do_recognize_by_name): New virtual function.
7064 (Target_selector::instantiate_target): New private function.
7065 (supported_target_names): Declare.
7066 * target-select.cc (Target_selector::Target_selector): Update for
7067 new parameter and fields.
7068 (select_target_by_name): Check that the name matches before
7069 calling recognize_by_name.
7070 (supported_target_names): New function.
7071 * i386.cc (class Target_selector_i386): Update Target_selector
7072 constructor call. Remove recognize and recognize_by_name. Add
7073 do_instantiate_target.
7074 * x86_64.cc (class Target_selector_x86_64): Likewise.
7075 * testsuite/testfile.cc (class Target_selector_test): Update for
7076 changes to Target_selector.
7078 * README: Rewrite, with some notes on unsupported features.
7080 2008-03-24 Cary Coutant <ccoutant@google.com>
7082 * i386.cc (Target_i386::Got_type): New enum declaration.
7083 (Target_i386::Scan::local): Updated callers of Output_data_got
7085 (Target_i386::Scan::global): Likewise.
7086 (Target_i386::Relocate::relocate): Likewise.
7087 (Target_i386::Relocate::relocate_tls): Likewise.
7088 * object.h (Got_offset_list): New class.
7089 (Sized_relobj::local_has_got_offset): Added got_type parameter.
7090 (Sized_relobj::local_got_offset): Likewise.
7091 (Sized_relobj::set_local_got_offset): Likewise.
7092 (Sized_relobj::local_has_tls_got_offset): Removed.
7093 (Sized_relobj::local_tls_got_offset): Removed.
7094 (Sized_relobj::set_local_tls_got_offset): Removed.
7095 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
7096 * output.cc (Output_data_got::add_global): Added got_type parameter.
7097 (Output_data_got::add_global_with_rel): Likewise.
7098 (Output_data_got::add_global_with_rela): Likewise.
7099 (Output_data_got::add_global_pair_with_rel): New function.
7100 (Output_data_got::add_global_pair_with_rela): New function.
7101 (Output_data_got::add_local): Added got_type parameter.
7102 (Output_data_got::add_local_with_rel): Likewise.
7103 (Output_data_got::add_local_with_rela): Likewise.
7104 (Output_data_got::add_local_pair_with_rel): New function.
7105 (Output_data_got::add_local_pair_with_rela): New function.
7106 (Output_data_got::add_global_tls): Removed.
7107 (Output_data_got::add_global_tls_with_rel): Removed.
7108 (Output_data_got::add_global_tls_with_rela): Removed.
7109 (Output_data_got::add_local_tls): Removed.
7110 (Output_data_got::add_local_tls_with_rel): Removed.
7111 (Output_data_got::add_local_tls_with_rela): Removed.
7112 * output.h (Output_data_got::add_global): Added got_type parameter.
7113 (Output_data_got::add_global_with_rel): Likewise.
7114 (Output_data_got::add_global_with_rela): Likewise.
7115 (Output_data_got::add_global_pair_with_rel): New function.
7116 (Output_data_got::add_global_pair_with_rela): New function.
7117 (Output_data_got::add_local): Added got_type parameter.
7118 (Output_data_got::add_local_with_rel): Likewise.
7119 (Output_data_got::add_local_with_rela): Likewise.
7120 (Output_data_got::add_local_pair_with_rel): New function.
7121 (Output_data_got::add_local_pair_with_rela): New function.
7122 (Output_data_got::add_global_tls): Removed.
7123 (Output_data_got::add_global_tls_with_rel): Removed.
7124 (Output_data_got::add_global_tls_with_rela): Removed.
7125 (Output_data_got::add_local_tls): Removed.
7126 (Output_data_got::add_local_tls_with_rel): Removed.
7127 (Output_data_got::add_local_tls_with_rela): Removed.
7128 * resolve.cc (Symbol::override_base_with_special): Removed
7129 reference to has_got_offset_ field.
7130 * symtab.cc (Symbol::init_fields): Replaced initialization
7131 of got_offset_ with got_offsets_. Removed initialization
7133 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
7134 (Symbol::got_offset): Likewise.
7135 (Symbol::set_got_offset): Likewise.
7136 (Symbol::has_tls_got_offset): Removed.
7137 (Symbol::tls_got_offset): Removed.
7138 (Symbol::set_tls_got_offset): Removed.
7139 (Symbol::got_offset_): Removed.
7140 (Symbol::tls_mod_got_offset_): Removed.
7141 (Symbol::tls_pair_got_offset_): Removed.
7142 (Symbol::got_offsets_): New field.
7143 (Symbol::has_got_offset): Removed.
7144 (Symbol::has_tls_mod_got_offset): Removed.
7145 (Symbol::has_tls_pair_got_offset): Removed.
7146 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
7147 (Target_x86_64::Scan::local): Updated callers of Output_data_got
7149 (Target_x86_64::Scan::global): Likewise.
7150 (Target_x86_64::Relocate::relocate): Likewise.
7151 (Target_x86_64::Relocate::relocate_tls): Likewise.
7153 2008-03-25 Ben Elliston <bje@au.ibm.com>
7155 * yyscript.y: Fix spelling error in comment.
7157 2008-03-24 Ian Lance Taylor <iant@google.com>
7159 * options.h (class General_options): Define build_id option.
7160 * layout.h (class Layout): Declare write_build_id, create_note,
7161 create_build_id. Add build_id_note_ member.
7162 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
7163 "libiberty.h", "md5.h", "sha1.h".
7164 (Layout::Layout): Initialize eh_frame_data_,
7165 eh_frame_hdr_section_, and build_id_note_.
7166 (Layout::finalize): Call create_build_id.
7167 (Layout::create_note): New function, broken out of
7168 Layout::create_gold_note.
7169 (Layout::create_gold_note): Call create_note.
7170 (Layout::create_build_id): New function.
7171 (Layout::write_build_id): New function.
7172 (Close_task_runner::run): Call write_build_id.
7174 * x86_64.cc: Correct license to GPLv3.
7176 2008-03-23 Ian Lance Taylor <iant@google.com>
7178 * options.cc: Include "demangle.h".
7179 (parse_optional_string): New function.
7180 (parse_long_option): Handle takes_optional_argument.
7181 (parse_short_option): Update dash_z initializer. Handle
7182 takes_optional_argument.
7183 (General_options::General_options): Initialize do_demangle_.
7184 (General_options::finalize): Set do_demangle_. Handle demangling
7186 * options.h (parse_optional_string): Declare.
7187 (struct One_option): Add optional_arg field. Update constructor.
7188 Update call constructor calls. Add takes_optional_argument
7190 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
7191 (DEFINE_optional_string): Define.
7192 (General_options::demangle): Change from DEFINE_bool to
7193 DEFINE_optional_string.
7194 (General_options::no_demangle): New function.
7195 (General_options::do_demangle): New function.
7196 (General_options::set_do_demangle): New function.
7197 (General_options::execstack_status_): Move definition to end of
7199 (General_options::static_): Likewise.
7200 (General_options::do_demangle_): New field.
7201 * object.cc (big_endian>::get_symbol_location_info): Call
7202 Options::do_demangle, not Options::demangle.
7203 * symtab.cc (demangle): Likewise.
7205 2008-03-22 Ian Lance Taylor <iant@google.com>
7207 * gold.h: Include <cstddef> and <sys/types.h>
7208 * options.h: Include <cstring>.
7210 2008-03-21 Ian Lance Taylor <iant@google.com>
7212 * Added source code to GNU binutils.