1 2010-03-03 Nick Clifton <nickc@redhat.com>
3 * po/fi.po: New Finnish translation.
5 2010-03-01 Doug Kwan <dougkwan@google.com>
7 * layout.cc (Layout::Layout): Force section types of .init_array*,
8 .preinit_array* and .fini_array* sections.
9 * output.cc (Output_section::Input_section_sort_entry::has_priority):
10 Fix check of return value of std::string::find.().
11 (Output_section::Input_section_sort_compare::operator()): Remove
12 comment about .init_array.
13 (Output_section::Input_section_sort_init_fini_compare::operator()):
15 (Output_section::sort_attached_input_sections): Handle .init_array
16 and .fini_array specially.
17 * output.h (Output_section::Inut_section_sort_compare): Update
19 (Output_section::Input_section_sort_init_fini_compare): New struct.
21 2010-02-26 Doug Kwan <dougkwan@google.com>
23 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
24 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
25 * testsuite/debug_msg.sh: Avoid matching source line number for
26 use of global variable undef_int.
28 2010-02-26 Doug Kwan <dougkwan@google.com>
30 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
31 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
32 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
33 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
34 * options.cc (General_options::General_options): Initialize member
36 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
37 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
38 and rm_no_fix_v4bx.stdout
39 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
40 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
41 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
42 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
44 * Makefile.in: Regenerate.
45 * testsuite/arm_fix_v4bx.s: New file.
46 * testsuite/arm_fix_v4bx.sh: Ditto.
48 2010-02-24 Doug Kwan <dougkwan@google.com>
50 * arm.cc (Target_arm::got_section): Make the .got section the first
51 non RELRO section in the data segment.
52 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
53 suffixes of section names.
55 2010-02-24 Doug Kwan <dougkwan@google.com>
57 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
58 flags and attributes merging if an input file is a binary file.
59 * fileread.cc (Input_file::open): Record format of original file.
60 * fileread.h (Input_file::Format): New enum type.
61 (Input_file::Input_file): Initialize data member format_.
62 (Input_file::format): New method definition.
63 (Input_file::format_):: New data member.
65 2010-02-24 Doug Kwan <dougkwan@google.com>
67 * arm.cc (Arm_output_data_got): New class.
68 (ARM_TCB_SIZE): New constant
69 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
70 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
71 If user uses a script with a SECTIONS clause, issue only a warning
72 for a misplaced EXIDX input section. Otherwise, issue an error.
73 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
75 (Target_arm::got_mode_index_entry): Handle static linking.
76 (Target_arm::Scan::local): Ditto.
77 (Target_arm::Scan::global): Ditto.
78 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
79 all incorrectly implemented relocations.
80 (Target_arm::fix_exidx_coverage): Pass layout to
81 Arm_output_section::fix_exidx_coverage.
82 * layout.cc (Layout::section_name_mapping): Remove trailing dots
83 from ".ARM.exidx." and ".ARM.extab.".
85 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
87 * arm.cc (Target_arm::do_finalize_sections): Create attribute
88 section if it does not already exist.
89 * attributes.cc (Attributes_section_data::Attributes_section_data):
90 Don't crash if size is zero.
92 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
93 Ian Lance Taylor <iant@google.com>
95 * gold.cc (queue_middle_tasks): If no input files were opened,
97 * workqueue.h (Task_function::Task_function): Assert that there is
100 2010-02-22 Doug Kwan <dougkwan@google.com>
102 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
103 * icf.cc (get_section_contents): Cast snprintf arguments to long long
104 types to avoid warnings due to different uint64_t implementations
107 2010-02-21 Doug Kwan <dougkwan@google.com>
109 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
110 handling of the maximum backward branch offset.
111 (Arm_relocate_functions::thumb_branch_common): Ditto.
112 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
113 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
114 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
115 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
116 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
117 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
118 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
119 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
120 thumb_bl_out_of_range thumb_bl_out_of_range.o,
121 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
122 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
123 thumb2_bl_out_of_range.o): New rules.
124 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
125 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
126 thumb2_bl_out_of_range
127 * testsuite/Makefile.in: Regenerate.
128 * testsuite/arm_bl_in_range.s: New file.
129 * testsuite/arm_bl_out_of_range.s: Ditto.
130 * testsuite/arm_branch_in_range.sh: Ditto.
131 * testsuite/arm_branch_range.t: Ditto.
132 * testsuite/thumb2_branch_range.t: Ditto.
133 * testsuite/thumb_bl_in_range.s: Ditto.
134 * testsuite/thumb_bl_out_of_range.s: Ditto.
135 * testsuite/thumb_branch_range.t: Ditto.
137 2010-02-20 Sriraman Tallam <tmsriram@google.com>
139 * gc.h (gc_process_relocs): Change vectors to point to the new list.
140 Add reloc offset information.
141 * icf.cc (get_section_contents): Change iterators to point to the new
142 vectors. Add reloc offset information to the contents.
143 * icf.h (Icf::Sections_reachable_info): New typedef.
144 (Icf::Sections_reachable_list): New typedef.
145 (Icf::Offset_info): New typedef.
146 (Icf::Reloc_info): New struct typedef.
147 (Icf::Reloc_info_list): New typedef.
148 (Icf::symbol_reloc_list): Delete method.
149 (Icf::addend_reloc_list): Delete method.
150 (Icf::section_reloc_list): Delete method.
151 (Icf::reloc_info_list): New method.
152 (Icf::reloc_info_list_): New member.
154 2010-02-19 Doug Kwan <dougkwan@google.com>
156 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
157 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
158 * arm.cc (Arm_relocation_functions): New forward declaration.
159 (Target_arm::Target_arm): Initialize new data members
160 got_mod_index_offset_ and tls_base_symbol_defined_.
161 (Target_arm::Relocate::relocate_tls): New method.
162 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
163 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
165 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
166 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
167 (Target_arm::got_mod_index_offset_,
168 Target_arm::tls_base_symbol_defined_): New data members.
169 (Target_arm::Scan::local, Target::Scan::global,
170 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
173 2010-02-18 Doug Kwan <dougkwan@google.com>
175 * arm.cc (Arm_relobj::find_linked_text_section): New method.
176 (Arm_relobj::make_exidx_input_section): Pass section index of linked
177 text section as a parameter becuase some broken tools may not set
178 the link in section header.
179 (Target_arm::has_got_section): New method.
180 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
181 without any mapping symbol as data only. Remove warning.
182 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
183 link in its section header, try to discover the link by inspecting the
184 REL31 relocation at the beginning of the section.
185 (Target_arm::Scan::check_non_pic): Report name of offending relocation
187 (Target_arm::Scan::global): Treat any reference to the symbol
188 _GLOBAL_OFFSET_TABLE_ as a GOT access.
190 2010-02-12 Sriraman Tallam <tmsriram@google.com>
192 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
193 (Scan::global_reloc_may_be_function_pointer): New function.
194 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
195 (Scan::global_reloc_may_be_function_pointer): New function.
196 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
197 (Scan::global_reloc_may_be_function_pointer): New function.
198 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
199 (Scan::global_reloc_may_be_function_pointer): New function.
200 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
201 (Scan::global_reloc_may_be_function_pointer): New function.
202 (Scan::possible_function_pointer_reloc): New function.
203 (Target_x86_64::can_check_for_function_pointers): New function.
204 * gc.h (gc_process_relocs): Scan relocation types to determine if
205 function pointers were taken for targets that support it.
206 * icf.cc (Icf::find_identical_sections): Include functions for
207 folding in safe ICF whose pointer is not taken.
208 * icf.h (Secn_fptr_taken_set): New typedef.
209 (fptr_section_id_): New member.
210 (section_has_function_pointers): New function.
211 (set_section_has_function_pointers): New function.
212 (check_section_for_function_pointers): New function.
213 * options.h: Fix comment for safe ICF option.
214 * target.h (can_check_for_function_pointers): New function.
215 * testsuite/Makefile.am: Add icf_safe_so_test test case.
216 Modify icf_safe_test for X86-64.
217 * testsuite/Makefile.in: Regenerate.
218 * testsuite/icf_safe_so_test.cc: New file.
219 * testsuite/icf_safe_so_test.sh: New file.
220 * testsuite/icf_safe_test.cc (kept_func_3): New function.
221 (main): Change to take pointer to function kept_func_3.
222 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
223 folding is done correctly for X86-64.
225 2010-02-12 David S. Miller <davem@davemloft.net>
227 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
228 is_symbolless parameter.
229 (Output_reloc<SHT_REL>::is_symbolless): New.
230 (Output_reloc<SHT_REL>::is_symbolless_): New.
231 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
232 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
233 (Output_reloc<SHT_RELA>::is_symbolless): New.
234 (Output_data_reloc::add_global): Handle is_symbolless.
235 (Output_data_reloc::add_global_relative): Likewise.
236 (Output_data_reloc::add_local): Likewise.
237 (Output_data_reloc::add_local_relative): Likewise.
238 (Output_data_reloc::add_symbolless_global_addend): New.
239 (Output_data_reloc::add_symbolless_local_addend): New.
240 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
242 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
243 instead of ->is_relative_
244 (Output_reloc::write): Likewise.
245 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
246 (Output_reloc::write_rel): Simplify.
248 * sparc.cc (Target_sparc::Scan::local): Use
249 ->add_symbolless_local_addend as needed.
250 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
251 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
252 based upon relocation offset.
254 2010-02-11 Doug Kwan <dougkwan@google.com>
256 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
257 (Target_arm::Scan::global): Ditto. Also remove a comment before the
258 beginning of function.
259 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
260 and MOVT_ABS relocations. Those are non issued in scanning. Fix
261 parameter is_32bit in calls to should_apply_static_reloc.
262 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
263 (check_DATA): Add arm_abs_global.stdout.
264 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
265 arm_abs_global.stdout): New rules.
266 (MOSTLLYCLEANFILES): Add arm_abs_global
267 * Makefile.in: Regenerate.
268 * testsuite/arm_abs_global.s: New file.
269 * testsuite/arm_abs_global.sh: Ditto.
270 * testsuite/arm_abs_lib.s: Ditto.
272 2010-02-11 Ian Lance Taylor <iant@google.com>
274 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
276 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
277 Allocate_commons_task first.
278 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
279 task, rather than symtab_lock_.
280 (Gc_process_relocs::~Gc_process_relocs): New function.
281 (Gc_process_relocs::is_runnable): Check this_blocker_.
282 (Gc_process_relocs::locks): Use next_blocker_ rather than
284 (Scan_relocs::~Scan_relocs): New function.
285 (Scan_relocs::is_runnable): Check this_blocker_ rather than
287 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
289 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
290 fields. Add this_blocker_ and next_blocker_ fields. Adjust
291 constructor accordingly.
292 (class Gc_process_relocs): Likewise.
293 (class Scan_relocs): Likewise.
294 * common.h (class Allocate_commons_task): Remove symtab_lock_
295 field, and corresponding constructor parameter.
296 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
298 (Allocate_commons_task::locks): Likewise.
300 2010-02-11 Ian Lance Taylor <iant@google.com>
302 * gold-threads.h (class Once): Define.
303 (class Initialize_lock): Rewrite as child of Once.
304 * gold-threads.cc (class Once_initialize): Define.
305 (once_pointer_control): New static variable.
306 (once_pointer, once_arg): New static variables.
307 (c_run_once): New static function.
308 (Once::Once, Once::run_once, Once::internal_run): New functions.
309 (class Initialize_lock_once): Remove.
310 (initialize_lock_control): Remove.
311 (initialize_lock_pointer): Remove.
312 (initialize_lock_once): Remove.
313 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
314 (Initialize_lock::initialize): Rewrite.
315 (Initialize_lock::do_run_once): New function.
316 * archive.cc (Archive::interpret_header): Only clear name if it is
318 * fileread.cc: Include "gold-threads.h"
319 (file_counts_lock): New static variable.
320 (file_counts_initialize_lock): Likewise.
321 (File_read::release): Only increment counts when using --stats.
322 Use a lock around the increment.
323 * parameters.cc (class Set_parameters_target_once): Define.
324 (set_parameters_target_once): New static variable.
325 (Parameters::Parameters): Move here from parameters.h.
326 (Parameters::set_target): Rewrite.
327 (Parameters::set_target_once): New function.
328 (Parameters::clear_target): Move here and rewrite.
329 * parameters.h (class Parameters): Update declarations. Add
330 set_parameters_target_once_ field.
331 (Parameters::Parameters): Move to parameters.cc.
332 (Parameters::clear_target): Likewise.
333 * readsyms.cc (Read_symbols::do_group): Create a Start_group
335 (Start_group::~Start_group): New function.
336 (Start_group::is_runnable): New function.
337 (Start_group::locks, Start_group::run): New functions.
338 (Finish_group::run): Change saw_undefined to size_t.
339 * readsyms.h (class Start_group): Define.
340 (class Finish_group): Change saw_undefined_ field to size_t.
341 (Finish_group::Finish_group): Remove saw_undefined and
342 this_blocker parameters. Change all callers.
343 (Finish_group::set_saw_undefined): New function.
344 (Finish_group::set_blocker): New function.
345 * symtab.h (class Symbol_table): Change saw_undefined to return
346 size_t. Change saw_undefined_ field to size_t.
347 * target-select.cc (Set_target_once::do_run_once): New function.
348 (Target_selector::Target_selector): Initialize set_target_once_
349 field. Don't initialize lock_ and initialize_lock_ fields.
350 (Target_selector::instantiate_target): Rewrite.
351 (Target_selector::set_target): New function.
352 * target-select.h (class Set_target_once): Define.
353 (class Target_selector): Update declarations. Make
354 Set_target_once a friend. Remove lock_ and initialize_lock_
355 fields. Add set_target_once_ field.
357 2010-02-10 Ian Lance Taylor <iant@google.com>
359 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
361 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
362 (queue_middle_tasks): Add all blockers before queueing any tasks.
363 (queue_final_tasks): Likewise.
364 * token.h (Task_token::add_blockers): New function.
365 * object.h (Input_objects::number_of_relobjs): New function.
367 2010-02-10 Ian Lance Taylor <iant@google.com>
369 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
370 shared, not if not position independent.
371 * x86_64.cc (Relocate::relocate_tls): Likewise.
372 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
373 (tls_pie_pic_test): New target.
374 * testsuite/Makefile.in: Rebuild.
376 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
377 (tls_test_main_pie.o, tls_test_pie.o): New targets.
378 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
379 * testsuite/Makefile.in: Rebuild.
381 2010-02-09 David S. Miller <davem@davemloft.net>
383 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
384 R_SPARC_RELATIVE using ->add_local_relative().
385 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
387 * output.h (Output_data_dynamic::add_section_size): New method
388 that takes two Output_data objects.
389 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
390 entry param. Handle it in initializers.
391 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
392 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
393 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
395 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
396 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
397 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
398 for dynrel_includes_plt.
399 * i386.cc (Target_i386::do_finalize_sections): Likewise.
400 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
401 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
403 (Target_sparc::do_finalize_sections): Update to pass true for
405 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
406 output before .rela.plt
407 (Target_powerpc::do_finalize_sections): Update to pass true for
408 dynrel_includes_plt when 32-bit.
410 2010-02-08 Doug Kwan <dougkwan@google.com>
412 * arm.cc (Arm_relobj::simple_input_section_output_address): New
414 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
415 Arm_relobj::scan_section_for_cortex_a8_stubs,
416 Arm_relobj::do_relocation_section): Instead of calling
417 Output_section::output_address, use faster
418 Arm_relobj::simple_input_section_output_address.
420 2010-02-08 David S. Miller <davem@davemloft.net>
422 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
423 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
424 relocation helper function.
426 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
427 just like R_SPARC_GOT{10,13,22}.
428 (Target_sparc::Scan::local): Likewise.
429 (Target_sparc::Relocate:relocate): Likewise.
431 2010-02-06 Ian Lance Taylor <iant@google.com>
433 * configure.ac: Rewrite targetobjs duplicate removal code to use
434 only shell constructs.
435 * configure: Rebuild.
437 2010-02-05 Doug Kwan <dougkwan@google.com>
440 * arm.cc (Arm_relobj::section_is_scannable): New method.
441 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
442 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
444 2010-02-04 Doug Kwan <dougkwan@google.com>
447 * arm-reloc-property.cc (cstdio): Include.
448 * configure.ac (targetobjs): Remove duplicates.
449 * configure: Regenerate.
450 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
451 big and little endian version for a given address size.
453 2010-02-03 Doug Kwan <dougkwan@google.com>
455 * arm-reloc-property.cc
456 (Arm_reloc_property_table::reloc_name_in_error_message): New method
458 * arm-reloc-property.h
459 (Arm_reloc_property_table::get_implemented_static_reloc_property):
460 New method definition.
461 (Arm_reloc_property_table::reloc_name_in_error_message): New method
463 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
465 (GOT_PREL): Change implemented to Y.
466 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
467 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
468 (Arm_relocate_functions::movw_abs_nc): Remove method.
469 (Arm_relocate_functions::movt_abs): Ditto.
470 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
471 (Arm_relocate_functions::thm_movt_abs): Ditto.
472 (Arm_relocate_functions::movw_rel_nc): Ditto.
473 (Arm_relocate_functions::movw_rel): Ditto.
474 (Arm_relocate_functions::movt_rel): Ditto.
475 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
476 (Arm_relocate_functions:thm_movw_rel): Ditto.
477 (Arm_relocate_functions:thm_movt_rel): Ditto.
478 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
479 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
480 New method definitions.
481 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
482 (Arm_relocation_functions::arm_grp_ldr): Ditto.
483 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
484 (Arm_relocation_functions::arm_grp_ldc): Ditto.
485 (Target_arm::Relocate::relocate): Check for non-static or
486 unimplemented relocation code and exit early. Change calls to
487 Target_arm::reloc_uses_thumb_bit and
488 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
489 instead. Refactor code to handle similar relocations to increase
490 code sharing. Remove check for unsupported relocation code in switch
492 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
493 relocation property table to find out size. Change error message to
494 print out the name of a relocation code instead of the numeric value.
495 (Target_arm::scan_reloc_for_stub): Use relocation property table
496 instead of calling Target_arm::reloc_uses_thumb_bit().
498 2010-02-02 Doug Kwan <dougkwan@google.com>
500 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
501 types of relaxed input section.
503 2010-02-02 Doug Kwan <dougkwan@google.com>
505 * Makefile.am (HFILES): Add arm-reloc-property.h.
507 (TARGETSOURCES): Add arm-reloc-property.cc
508 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
509 (libgold_a_SOURCES): $(DEFFILES)
510 * Makefile.in: Regenerate.
511 * arm-reloc-property.cc: New file.
512 * arm-reloc-property.h: New file.
513 * arm-reloc.def: New file.
514 * arm.cc: Update comments.
515 (arm-reloc-property.h): New included header.
516 (arm_reloc_property_table): New global variable.
517 (Target_arm::do_select_as_default_target): New method definition.
518 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
519 arm-reloc-property to targ_extra_obj.
520 * parameters.cc (set_parameters_target): Call
521 Target::select_as_default_target().
522 * target.h (Target::select_as_default_target): New method definition.
523 (Target::do_select_as_default_target): Same.
525 2010-02-01 Doug Kwan <dougkwan@google.com>
527 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
528 first_output_text_section_.
529 (Arm_exidx_fixup::first_output_text_section): New method definition.
530 (Arm_exidx_fixup::first_output_text_section_): New data member.
531 (Arm_exidx_fixup::process_exidx_section): Record the first text
533 (Arm_output_section::fix_exidx_coverage): Set correct linked section
534 and entsize in output section header.
536 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
538 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
539 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
540 (Arm_relocate_functions::thm_alu11): New Method.
541 (Arm_relocate_functions::thm_pc8): New Method.
542 (Arm_relocate_functions::thm_pc12): New Method.
543 (Target_arm::Scan::local): Handle the relocations.
544 (Target_arm::Scan::global): Likewise.
545 (Target_arm::Relocate::relocate): Likewise.
546 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
548 2010-01-29 Doug Kwan <dougkwan@google.com>
550 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
551 of relocation types as ld.
553 2010-01-29 Doug Kwan <dougkwan@google.com>
555 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
557 (Arm_relocate_functions::thumb_branch_common): Ditto.
558 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
559 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
560 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
561 Arm_relocate_functions::jump24): Remove.
562 (Target_arm::Relocate::relocate): Adjust code to call
563 Arm_relocation_functions::arm_branch_common and
564 Arm_relocation_functions::thumb_branch_common instead of their removed
565 wrappers. Merge switch-cases together to reduce source code size.
567 2010-01-29 Doug Kwan <dougkwan@google.com>
569 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
570 output_local_symbol_count_needs_update_.
571 (Arm_relobj::output_local_symbol_count_needs_update,
572 Arm_relobj::set_output_local_symbol_count_needs_update,
573 Arm_relobj::update_output_local_symbol_count): New methods.
574 (Arm_relobj::output_local_symbol_count_needs_update_): New data
576 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
577 of pointed function as in a R_ARM_PREL31 relocation.
578 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
579 for output local symbol count updating.
580 (Target_arm::do_relax): Update output local symbol counts in objects
582 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
584 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
586 * arm.cc: Added support for the ARM relocations:
587 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
588 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
589 (Arm_relocate_functions::movw_rel_nc): Renamed (was
591 (Arm_relocate_functions::movw_rel): New method.
592 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
593 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
595 (Arm_relocate_functions::thm_movw_rel): New method.
596 (Arm_relocate_functions::thm_movt_rel): Renamed (was
598 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
600 (Target_arm::Scan::global): Likewise.
601 (Target_arm::Relocate::relocate): Likewise.
602 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
605 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
607 * arm.cc: Added support for ARM group relocations.
608 (Target_arm::reloc_needs_sym_origin): New method.
609 (Arm_relocate_functions::calc_grp_kn): New method.
610 (Arm_relocate_functions::calc_grp_residual): New method.
611 (Arm_relocate_functions::calc_grp_gn): New method.
612 (Arm_relocate_functions::arm_grp_alu): New Method.
613 (Arm_relocate_functions::arm_grp_ldr): New Method.
614 (Arm_relocate_functions::arm_grp_ldrs): New Method.
615 (Arm_relocate_functions::arm_grp_ldc): New Method.
616 (Target_arm::Scan::local): Handle the ARM group relocations.
617 (Target_arm::Scan::global): Likewise.
618 (Target_arm::Relocate::relocate): Likewise.
619 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
622 2010-01-26 Doug Kwan <dougkwan@google.com>
624 * arm.cc (set): Include.
625 (class Arm_exidx_fixup): Change type of last_input_section_ to const
627 (Arm_output_section::Text_section_list): New type.
628 (Arm_output_section::append_text_sections_to_list): New method.
629 (Arm_output_section::fix_exidx_coverage): Ditto.
630 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
631 (Arm_relobj::convert_input_section_to_relaxed_section): Use
632 Relobj::set_section_offset() instead of
633 Sized_relobj::invalidate_section_offset().
634 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
635 parameter for section headers. Ignore relocation sections for
636 unallocated sections and EXIDX sections.
637 (Target_arm::fix_exidx_coverage): New method.
638 (Target_arm::output_section_address_less_than): New type.
639 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
640 linked text section instead of the EXIDX section.
641 (Arm_output_section::create_stub_group): Add an assertion to check
642 that this is not an EXIDX output section.
643 (Arm_output_section::append_text_sections_to_list): New method.
644 (Arm_output_section::fix_exidx_coverage): Ditto.
645 (Arm_relobj::scan_sections_for_stubs): Adjust call to
646 Arm_relobj::section_needs_reloc_stub_scanning.
647 (Target_arm::do_relax): Fix EXIDX output section coverage in the
649 (Target_arm::fix_exidx_coverage): New method.
650 * object.h (Relobj::set_output_section): New method.
651 (Sized_relobj::invalidate_section_offset): Remove method.
652 (Sized_relobj::do_invalidate_section_offset): Remove method.
653 (Sized_relobj::do_set_section_offset): Handle offset value -1.
655 2010-01-25 Doug Kwan <dougkwan@google.com>
657 * arm.cc (Arm_exidx_merged_section::do_output_offset):
658 Fix warning due to signed and unsigned comparison on a 32-bit host.
660 2010-01-22 Doug Kwan <dougkwan@google.com>
662 * arm.cc (Target_arm::do_relax): Record an output section for section
663 offset adjustment it contains any stub table that has changed.
664 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
665 offsets in an output section if necessary.
666 * output.cc (Output_section::Output_section): Initialize
667 section_offsets_need_adjustments_.
668 (Output_section::add_input_section_for_script): Renamed to
669 Output_section::add_simple_input_section.
670 (Output_section::save_states): Add a comment.
671 (Output_section::discard_states): New method defintion.
672 (Output_section::adjust_section_offsets): Same.
673 * output.h (Output_section::add_input_section_for_script): Renamed to
674 Output_section::add_simple_input_section.
675 (Output_section::discard_states): New method declaration.
676 (Output_section::adjust_section_offsets): Same.
677 (Output_section::section_offsets_need_adjustment,
678 Output_section::set_section_offsets_need_adjustment): New method
680 (Output_section::section_offsets_need_adjustment_): New data member.
682 (Output_section_element_input::set_section_address): Adjust code for
683 renaming of Output_section::add_input_section_for_script.
684 (Orphan_output_section::set_section_address): Same.
686 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
688 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
689 Fix_v4bx enum values .
690 * gold/options.h (General_options): New option definitions.
691 (General_options::fix_v4bx): New method.
692 (General_options::Fix_v4bx): New enum.
693 * gold/options.cc (General_options::parse_fix_v4bx): New method.
694 (General_options::parse_fix_v4bx_interworking): New method.
696 2010-01-22 Doug Kwan <dougkwan@google.com>
698 * arm.cc (Arm_exidx_fixup): New class.
700 2010-01-21 Doug Kwan <dougkwan@google.com>
702 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
704 (Arm_exidx_section_offset_map): New type.
706 2010-01-21 Doug Kwan <dougkwan@google.com>
708 * arm.cc (Arm_exidx_input_section): New class.
709 (Arm_relobj::exidx_input_section_by_link,
710 Arm_relobj::exidx_input_section_by_shndx,
711 Arm_relobj::make_exidx_input_section): New methods.
712 (read_arm_attributes_section): Remove.
713 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
714 information about them.
715 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
718 2010-01-20 Doug Kwan <dougkwan@google.com>
720 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
721 Input_section_specifier to Section_id.
722 (Target_arm::new_arm_input_section: Adjust code for change of key
724 (Target_arm::find_arm_input_section): Ditto.
725 * gc.h (object.h): Include for Section_id nand Section_id_hash.
726 (Section_id): Remove.
727 (Garbage_collection::Section_id_hash): Remove.
728 * icf.h (object.h): Include for Section_id nand Section_id_hash.
729 (Section_id): Remove.
730 (Icf::Section_id_hash): Remove.
731 * object.h (Section_id, Const_section_id, Section_id_hash,
732 Const_section_id_hash): New type definitions.
733 * output.cc (Output_section::add_relaxed_input_section): Change to
734 use Const_section_id instead of Input_section_specifier as key type.
735 (Output_section::add_merge_input_section): Ditto.
736 (Output_section::build_relaxation_map): Change to use Section_id
737 instead of Input_section_specifier as key type.
738 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
740 (Output_section::convert_input_sections_to_relaxed_sections): Change
741 to use Const_section_id instead of Input_section_specifier as key type.
742 (Output_section::find_merge_section): Ditto.
743 (Output_section::find_relaxed_input_section): Ditto.
744 * output.h (Input_section_specifier): Remove class.
745 (Output_section::Output_section_data_by_input_section_map): Change
746 key type to Const_section_id.
747 (Output_section::Output_relaxed_input_section_by_input_section_map):
749 (Output_section::Relaxation_map): Change key type to Section_id.
751 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
753 * gold/arm.cc: Added support for R_ARM_V4BX relocation
754 (class Arm_v4bx_stub): New class.
755 (DEF_STUBS): Updated definition to support v4_veneer_bx.
756 (Stub_factory::make_arm_v4bx_stub): New method.
757 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
758 (Stub_table::empty): Handle v4bx stubs.
759 (Stub_table::add_arm_v4bx_stub): New method.
760 (Stub_table::find_arm_v4bx_stub): New method.
761 (Arm_relocate_functions::v4bx): New method.
762 (Target_arm::fix_v4bx): New method.
763 (Target_arm::Target_arm): Handle R_ARM_V4BX.
764 (Stub_table::relocate_stubs): Likewise.
765 (Stub_table::do_write): Likewise.
766 (Stub_table::update_data_size_and_addralign): Likewise.
767 (Stub_table::finalize_stubs): Likewise.
768 (Target_arm::Scan::local): Likewise.
769 (Target_arm::Scan::global): Likewise.
770 (Target_arm::do_finalize_sections): Likewise.
771 (Target_arm::Relocate::relocate): Likewise.
772 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
774 (Target_arm::scan_reloc_for_stub): Likewise.
775 (Target_arm::scan_reloc_section_for_stubs): Likewise.
777 2010-01-19 Ian Lance Taylor <iant@google.com>
779 * output.cc (Output_section_headers::do_sized_write): Write large
780 segment count to sh_info field.
781 (Output_file_header::do_sized_write): For large segment count,
782 write PN_XNUM to e_phnum field.
784 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
786 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
787 (Arm_relocate_functions::thm_jump8): New function.
788 (Arm_relocate_functions::thm_jump11): New function.
789 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
791 (Target_arm::Scan::global): Likewise.
792 (Target_arm::Relocate::relocate): Likewise.
793 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
796 2010-01-14 Doug Kwan <dougkwan@google.com>
798 * arm.cc (map, utility): Include headers.
799 (Target_arm::apply_cortex_a8_workaround): New method.
800 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
801 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
802 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
803 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
804 the --[no-]fix-cortex-a8 command line options.
805 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
806 (Target_arm::relocate_stub): Use addend in instruction template.
807 * options.h (DEFINE_bool): Set the user-set flag.
808 (General_options): Add --[no-]-fix-cortex options.
809 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
810 : Update fast look-up map after conversion.
812 2010-01-14 Sriraman Tallam <tmsriram@google.com>
814 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
815 in the first pass of do_layout.
817 2010-01-13 Doug Kwan <dougkwan@google.com>
819 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
820 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
821 apparent compiler problem of not folding static constant integral
822 data members of elfcpp::Elf_sizes<32>.
824 2010-01-13 Doug Kwan <dougkwan@google.com>
826 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
827 Arm_relobj::section_needs_cortex_a8_stub_scanning,
828 Arm_relobj::scan_section_for_cortex_a8_erratum,
829 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
830 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
831 sections to scan for relocation stubs into a new method
832 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
833 relocation and Cortex-A8 stub scanning.
834 (Target_arm::do_relax): Force stubs to be after stubbed sections
835 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
836 the beginning of a new relaxation pass. Update a comment.
837 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
839 2010-01-12 Ian Lance Taylor <iant@google.com>
841 * target-reloc.h (visibility_error): New inline function.
842 (relocate_section): Call visibility_error.
843 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
844 (MOSTLYCLEANFILES): Likewise.
845 (protected_4_pic.o, protected_3.err): New targets.
846 * testsuite/protected_4.cc: New file.
848 2010-01-12 Doug Kwan <dougkwan@google.com>
850 * arm.cc (Cortex_a8_reloc): New class.
851 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
852 and cortex_a8_relocs_info_.
853 (Target_arm::fix_cortex_a8): New method definition.
854 (Target_arm::Cortex_a8_relocs_info): New type.
855 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
856 New data member declarations.
857 (Target_arm::scan_reloc_for_stub): Record information about
858 relocations for THUMB branches that might be exempted from the
859 Cortex-A8 workaround.
860 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
861 at the beginning of a relaxation pass.
863 2010-01-12 Doug Kwan <dougkwan@google.com>
865 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
866 (Arm_relobj::Mapping_symbol_position,
867 Arm_reloj::Mapping_symbol_position_less,
868 Arm_relobj::Mapping_symbols_info): New types.
869 (Target_arm::is_mapping_symbol_name): New method definition.
870 (Arm_relobj::do_count_local_symbols): Save information about mapping
873 2010-01-11 Doug Kwan <dougkwan@google.com>
875 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
876 Arm_relocate_functions::thumb32_branch_upper,
877 Arm_relocate_functions::thumb32_branch_lower,
878 Arm_relocate_functions::thumb32_cond_branch_offset,
879 Arm_relocate_functions::thumb32_cond_branch_upper,
880 Arm_relocate_functions::thumb32_cond_branch_lower,
881 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
882 branch offset encoding.
883 (Arm_relocate_functions::thumb_branch_common): Use new branch
884 offset encoding methods to avoid code duplication.
885 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
886 (Stub_addend_reader::operator()): Use new branch encoding method
887 to avoid code duplication.
889 2010-01-11 Doug Kwan <dougkwan@google.com>
891 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
892 (Target_arm::do_finalize_sections): Define special EXIDX section
893 symbols only if referenced.
894 * gc.h (Garbage_collection::add_reference): New method.
895 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
898 2010-01-11 Ian Lance Taylor <iant@google.com>
900 * script.cc (Version_script_info::build_expression_list_lookup):
901 Change complaing about duplicate wildcard match from error to
904 * script.cc (class Lazy_demangler): Recreate--revert part of patch
906 (Version_script_info::Version_script_info): Initialize globs_,
907 default_version_, default_is_global_, and exact_. Don't
908 initialize globals_ or locals_.
909 (Version_script_info::build_lookup_tables): Build local symbols
911 (Version_script_info::unquote): New function.
912 (Version_script_info::add_exact_match): New function.
913 (Version_script_info::build_expression_list_lookup): Remove lookup
914 parameter. Add is_global parameter. Change all callers. Handle
915 wildcard pattern specially. Unquote pattern. Call
917 (Version_script_info::get_name_to_match): New function.
918 (Version_script_info::get_symbol_version): New function.
919 (Version_script_info::get_symbol_version_helper): Remove.
920 (Version_script_info::check_unmatched_names): Call unquote.
921 * script.h (class Version_script_info): Change get_symbol_version
922 to be non-inline and add is_global parameter; change all callers.
923 Rewrite symbol_is_local. Update declarations. Define struct
924 Version_tree_match, Exact, Globs. Don't define struct Lookup.
925 Remove globals_ and locals_ members. Add exact_, globs_,
926 default_version_, is_global_.
927 (Version_script_info::Glob): Remove pattern, add expression and
928 is_global. Update constructor. Change all callers.
929 * dynobj.cc (Versions::finalize): Mark the version symbol as the
931 (Versions::symbol_section_contents): If a symbol is undefined, or
932 defined in a dynamic object, set the version index to
934 * symtab.cc (Symbol_table::add_from_relobj): Don't call
936 (Symbol_table::add_from_pluginobj): Likewise.
937 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
939 2010-01-11 Doug Kwan <dougkwan@google.com>
941 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
942 (incremental_dump_LDADD): Add linking option for libintl.
943 * Makefile.in: Regenerate.
945 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
948 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
950 * testsuite/Makefile.in: Regenerated.
952 2010-01-10 Doug Kwan <dougkwan@google.com>
954 * options.h (DEFINE_var): Use parentheses around argument varname__
955 in macro body to avoid any unintended subsequent substitutions.
957 2010-01-10 Ian Lance Taylor <iant@google.com>
959 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
960 candidates before doing symbol resolution.
962 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
963 ODR candidates if only one is weak.
965 2010-01-08 Ian Lance Taylor <iant@google.com>
967 * script.cc (Version_script_info::build_expression_list_lookup):
968 Don't warn about ambiguous version, just record the ambiguity.
969 (Version_script_info::get_symbol_version_helper): Give error if
970 version is ambiguous.
972 2010-01-08 Doug Kwan <dougkwan@google.com>
974 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
975 prev_data_size_ and prev_addralign_. Remove initializer for
976 deleted data member has_been_changed_.
977 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
978 to determine if the table is empty.
979 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
981 (Stub_table::add_reloc_stub): Define method in class definition
982 instead of just declaring it there.
983 (Stub_table::add_cortex_a8_stub): New method definition.
984 (Stub_table::update_data_size_and_addralign): Ditto.
985 (Stub_table::finalize_stubs): Ditto.
986 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
987 (Stub_table::do_addralign_): Return address alignment in the
988 (Stub_table::do_reset_address_and_file_offset): Define method in
989 class definition instead of declaring it there. Set current data
990 size to be the data size of the previous pass.
991 (Stub_table::set_final_data_size): Use current data size as the
993 (Stub_table::relocate_stub): Change parameter type of stub from
994 Reloc_stub pointer to Stub pointer.
995 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
996 (Stub_table::Cortex_a8_stub_list): New typedef.
997 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
998 Stub_table::prev_addralign_): New data member.
999 (Arm_relobj::Arm_relobj): Initialize data member
1000 section_has_cortex_a8_workaround_.
1001 (Arm_relobj::section_has_cortex_a8_workaround,
1002 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
1004 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
1006 (Target_arm::relocate_stub): Change parameter type of stub from
1007 Reloc_stub pointer to Stub pointer.
1008 (Insn_template::size, Insn_template::alignment): Handle
1009 THUMB16_SPECIAL_TYPE.
1010 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
1011 Stub_table::update_data_size_and_addralign,
1012 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
1014 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
1015 (Stub_table::do_write): Ditto.
1016 (Target_arm::do_relax): Adjust code for changes in Stub_table.
1018 2010-01-08 Ian Lance Taylor <iant@google.com>
1021 * symtab.h (class Symbol): Remove fields is_target_special_ and
1022 has_plt_offset_. Add field is_defined_in_discarded_section_.
1023 (Symbol::is_defined_in_discarded_section): New function.
1024 (Symbol::set_is_defined_in_discarded_section): New function.
1025 (Symbol::has_plt_offset): Rewrite.
1026 (Symbol::set_plt_offset): Verify that new offset is not -1U.
1027 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
1028 Don't initialize is_target_special_ or has_plt_offset_.
1029 Initialize is_defined_in_discarded_section_.
1030 (Symbol_table::add_from_relobj): If appropriate, set
1031 is_defined_in_discarded_section.
1032 * resolve.cc (Symbol::override_base_with_special): Don't test
1033 is_target_special_. Change has_plt_offset_ to has_plt_offset().
1034 * target-reloc.h (relocate_section): Do special handling for
1035 symbols defined in discarded sections for global symbols as well
1038 2010-01-08 Ian Lance Taylor <iant@google.com>
1040 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
1041 the SHT_SYMTAB case.
1043 2010-01-08 Ian Lance Taylor <iant@google.com>
1045 * object.cc (Sized_relobj::do_layout): Don't get confused if
1046 layout_eh_frame returns NULL.
1048 2010-01-08 Ian Lance Taylor <iant@google.com>
1051 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
1052 dynamic symbol table, use the normal symbol table.
1053 (Sized_dynobj::do_read_symbols): Remove assertion about type of
1056 2010-01-08 Ian Lance Taylor <iant@google.com>
1059 * layout.cc (Layout::include_section): Remove .gnu_debuglink
1062 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
1064 * version.cc (print_version): Change to "Copyright 2010".
1066 2010-01-08 Ian Lance Taylor <iant@google.com>
1070 * i386.cc (class Target_i386): Change return type of plt_section
1072 (class Output_data_plt_i386): Add tls_desc_rel_ field.
1073 (Output_data_plt_i386::Output_data_plt_i386): Initialize
1074 tls_desc_rel_ field.
1075 (Output_data_plt_i386::rel_tls_desc): New function.
1076 (Target_i386::rel_tls_desc_section): New function.
1077 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
1078 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
1079 R_386_TLS_DESC reloc in rel_tls_desc_section.
1080 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
1081 Define struct Tlsdesc_info.
1082 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
1083 (Target_x86_64::do_reloc_symbol_index): New function.
1084 (Target_x86_64::add_tlsdesc_info): New function.
1085 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
1086 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
1088 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
1090 (Output_data_plt_x86_64::rela_tlsdesc): New function.
1091 (Target_x86_64::rela_tlsdesc_section): New function.
1092 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
1094 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
1095 (Target_x86_64::do_reloc_addend): New function.
1096 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
1097 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
1098 declarations. Define TARGET_CODE. Add arg field to u1_ union.
1099 (Output_reloc::type): New function.
1100 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
1101 (Output_reloc::is_target_specific): New function.
1102 (Output_reloc::target_arg): New function.
1103 (class Output_reloc) [SHT_RELA]: Add four new constructors for
1104 absolute relocs and target specific relocs.
1105 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
1106 add_target_specific.
1107 (class Output_data_reloc) [SHT_RELA]: Likewise.
1108 * output.cc (Output_reloc::Output_reloc): Add four new versions
1109 for absolute relocs and target specific relocs.
1110 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
1111 (Output_reloc::get_symbol_index): Likewise.
1112 (Output_reloc::local_section_offset): Check that local_sym_index_
1113 is not TARGET_CODE or 0.
1114 (Output_reloc::symbol_value): Likewise.
1115 (Output_reloc::write) [SHT_RELA]: Call target for target specific
1117 * target.h (class Target): Add reloc_symbol_index and reloc_addend
1118 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
1120 * layout.cc (add_target_dynamic_tags): Use output section for
1121 DT_PLTRELSZ and DT_JMPREL.
1123 2010-01-07 Ian Lance Taylor <iant@google.com>
1126 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
1128 (class Output_data_reloc_generic): Define.
1129 (class Output_data_reloc_base): Change base class to
1130 Output_data_reloc_generic. Change add() method to call
1131 bump_relative_reloc_count for a relative reloc. Remove
1133 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
1135 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
1136 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
1138 * layout.h (class Layout): Update declaration.
1140 2010-01-07 Ian Lance Taylor <iant@google.com>
1142 * output.h (class Output_data): Add const version of
1143 output_section and do_output_section.
1144 (class Output_section_data): Add const version of
1146 (class Output_section): Likewise.
1147 * layout.cc (Layout::add_target_dynamic_tags): New function.
1148 * layout.h (class Layout): Update declarations.
1149 * arm.cc (Target_arm::do_finalize_sections): Use
1150 add_target_dynamic_tags.
1151 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1152 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1153 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1154 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1156 2010-01-07 Ian Lance Taylor <iant@google.com>
1159 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
1162 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
1163 Ian Lance Taylor <iant@google.com>
1166 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
1167 Xindex::read_symtab_xindex.
1169 2010-01-07 Doug Kwan <dougkwan@google.com>
1171 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
1172 (Insn_template::thumb16_bcond_insn): New method declaration.
1173 (Insn_template): Fix spelling.
1174 (Stub::thumb16_special): New method declaration.
1175 (Stub::do_write): Define virtual method which was previously pure
1177 (Stub::do_thumb16_special): New method declaration.
1178 (Stub::do_fixed_endian_write): New template member.
1179 (Reloc_stub::do_write): Remove.
1180 (Reloc_stub::do_fixed_endian_write): Remove.
1181 (Cortex_a8_stub): New class definition.
1182 (Stub_factory::make_cortex_a8_stub): New method definition.
1183 (Stub_factory::Stub_factory): Add missing static storage class
1184 qualifier for elf32_arm_stub_a8_veneer_blx.
1186 2010-01-07 Ian Lance Taylor <iant@google.com>
1189 * options.h (class General_options): Add --warn-unresolved-symbols
1190 and --error-unresolved-symbols.
1191 * errors.cc (Errors::undefined_symbol): Implement
1192 --warn-unresolved-symbols.
1194 * options.h (class General_options): Add -z text and -z textoff.
1195 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
1197 2010-01-06 Sriraman Tallam <tmsriram@google.com>
1199 * gc.h (Garbage_collection::Cident_section_map): New typedef.
1200 (Garbage_collection::cident_sections): New function.
1201 (Garbage_collection::add_cident_section): New function.
1202 (Garbage_collection::cident_sections_): New member.
1203 (gc_process_relocs): Add references to sections whose names are C
1205 * gold.h (cident_section_start_prefix): New constant.
1206 (cident_section_stop_prefix): New constant.
1207 (is_cident): New function.
1208 * layout.cc (Layout::define_section_symbols): Replace string constants
1209 with the newly defined constants.
1210 * object.cc (Sized_relobj::do_layout): Track sections whose names are
1212 * testsuite/Makefile.am: Add gc_orphan_section_test.
1213 * testsuite/Makefile.in: Regenerate.
1214 * testsuite/gc_orphan_section_test.cc: New file.
1215 * testsuite/gc_orphan_section_test.sh: New file.
1217 2010-01-06 Ian Lance Taylor <iant@google.com>
1220 * options.h (class General_options): Add --warn-shared-textrel.
1221 * layout.cc (Layout::finish_dynamic_section): Implement
1222 --warn-shared-textrel.
1225 * options.h (class General_options): Add --warn-multiple-gp.
1227 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1229 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
1230 $(THREADSLIB) and $(LIBDL).
1231 * Makefile.in: Rebuild.
1233 2010-01-06 Ian Lance Taylor <iant@google.com>
1236 * options.cc (General_options::parse_section_start): New function.
1237 (General_options::section_start): New function.
1238 (General_options::General_options): Initialize all members.
1239 * options.h: Include <map>
1240 (class General_options): Add --section-start. Add section_starts_
1242 * layout.cc (Layout::attach_allocated_section_to_segment): If
1243 --section-start was used, set the address of the segment. Remove
1244 local sort_sections.
1245 (Layout::relaxation_loop_body): If the address of the load segment
1246 has been set by --section-start, don't use it.
1247 * output.h (Output_segment::update_flags_for_output_section): New
1249 * output.cc (Output_segment::add_output_section): Call
1250 update_flags_for_output_section.
1252 2010-01-05 Ian Lance Taylor <iant@google.com>
1255 * options.h (class General_options): Add --undefined-version.
1256 * script.cc (struct Version_expression): Add was_matched_by_symbol
1258 (Version_script_info::matched_symbol): New function.
1259 (Version_script_info::get_symbol_version_helper): Call
1261 (Version_script_info::check_unmatched_names): New function.
1262 * script.h (class Version_script_info): Update declarations.
1263 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
1265 * options.h (class General_options): Use DEFINE_bool_alias for
1266 allow_multiple_definition.
1267 * resolve.cc (Symbol_table::should_override): Don't test
1268 allow_multiple_definition.
1271 * options.h (class General_options): Add --cref.
1272 * main.cc (main): Print cref table if --cref. Don't close mapfile
1273 until after printing cref table.
1274 * cref.cc: Include "symtab.h".
1275 (class Cref_inputs): Define Cref_table_compare and Cref_table.
1276 (Cref_table_compare::operator()): New function.
1277 (Cref_inputs::gather_cref): New function.
1278 (filecol): New static const.
1279 (Cref_inputs::print_cref): New function.
1280 (Cref::print_cref): New function.
1281 * cref.h: Include <cstdio>.
1282 (class Cref): Update declarations.
1283 * mapfile.h (Mapfile::file): New function.
1284 * object.h (class Object): Define Symbols. Declare virtual
1285 do_get_global_symbols.
1286 (Object::get_global_symbols): New function.
1287 * object.cc (Input_objects::add_object): Pass object to cref_ if
1289 (Input_objects::archive_start): Likewise.
1290 (Input_objects::archive_stop): Likewise.
1291 (Input_objects::print_cref): New function.
1292 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
1293 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
1295 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
1297 * plugin.h (class Sized_pluginobj): Update declarations.
1299 2010-01-05 Ian Lance Taylor <iant@google.com>
1301 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
1302 to is_default_version. Rename insdef to insdefault.
1303 (Symbol_table::add_from_relobj): Rename def to is_default_version
1304 and local to is_forced_local.
1305 (Symbol_table::add_from_pluginobj): Likewise.
1306 (Symbol_table::add_from_dynobj): Likewise.
1307 (Symbol_table::define_special_symbol): Rename insdef to
1310 2010-01-04 Ian Lance Taylor <iant@google.com>
1313 * options.h (class General_options): Add
1314 --allow-multiple-definition and -z muldefs.
1315 * resolve.cc (Symbol_table::should_override): Don't warn about a
1316 multiple symbol definition if --allow-multiple-definition or -z
1320 * options.h (class General_options): Add --add-needed and
1321 --copy-dt-needed-entries. Tweak --as-needed help entry.
1322 * object.cc (Input_objects::check_dynamic_dependencies): Give an
1323 error if --copy-dt-needed-entries aka --add-needed is used and
1324 would cause a change in behaviour.
1327 * options.h (class General_options): Add -G as a short version of
1328 --shared. Add no-op options -assert, -g, and -i.
1330 2010-01-04 Sriraman Tallam <tmsriram@google.com>
1332 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
1333 check for .text or .gnu.linkonce.t sections.
1334 * icf.cc (Icf::find_identical_sections): Ditto.
1335 Change the detection for mangled function name within the section
1337 * icf.h (is_section_foldable_candidate): New function.
1339 2009-12-30 Ian Lance Taylor <iant@google.com>
1342 * options.h (class General_options): Permit two dashes with
1343 --retain-symbols-file.
1345 2009-12-30 Ian Lance Taylor <iant@google.com>
1348 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
1349 don't put the file header and segment headers in the text
1353 * common.cc (Sort_commons::operator()): Stabilize sort when both
1355 (Symbol_table::do_allocate_commons_list): When allocating common
1356 symbols, skip a symbol which is no longer common.
1357 * symtab.h (Symbol::is_common): Test whether the symbol comes from
1358 an object before checking its type.
1359 * testsuite/common_test_2.c: New file.
1360 * testsuite/common_test_3.c: New file.
1361 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
1362 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
1363 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
1364 (common_test_2_pic.o, common_test_2.so): New targets.
1365 (common_test_3_pic.o, common_test_3.so): New targets.
1366 * testsuite/Makefile.in: Rebuild.
1369 * script.cc (read_input_script): If we see a new SECTIONS clause,
1370 and we have added an input section, give an error.
1371 * layout.h (class Layout): Add have_added_input_section function.
1372 Add have_added_input_section_ field.
1373 * layout.cc (Layout::Layout): Initialize
1374 have_added_input_section_.
1375 (Layout::layout): Set have_added_input_section_.
1376 (Layout::layout_eh_frame): Likewise.
1378 2009-12-30 Ian Lance Taylor <iant@google.com>
1381 * options.h (class General_options): Add --sort-common option.
1382 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
1383 * common.cc (Sort_common): Add sort_order parameter to
1384 constructor. Add sort_order_ field.
1385 (Sort_commons::operator): Check sort_order_.
1386 (Symbol_table::allocate_commons): Determine the sort order.
1387 (Symbol_table::do_allocate_commons): Add sort_order parameter.
1389 (Symbol_table::do_allocate_commons_list): Likewise.
1391 2009-12-30 Ian Lance Taylor <iant@google.com>
1394 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
1395 symbols from this object, don't change the visibility of an
1397 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
1399 2009-12-30 Ian Lance Taylor <iant@google.com>
1402 * script.h (class Version_script_info): Define Language enum.
1403 Update declarations. Define Glob, Exact, and Lookup types. Add
1404 new fields globals_, locals_, and is_finalized_.
1405 * script.cc: Various formatting fixes.
1406 (class Parser_closure): Change language_stack_ from a vector of
1407 std::string to one of Version_script_info::Language. Adjust all
1409 (class Lazy_demangler): Remove.
1410 (struct Version_expression): Change language from std::string to
1411 Version_script_info::Language.
1412 (Version_script_info::Version_script_info): New function.
1413 (Version_script_info::~Version_script_info): Don't call clear.
1414 (Version_script_info::finalize): New function.
1415 (Version_script_info::build_lookup_tables): New function.
1416 (Version_script_info::build_expression_list_lookup): New
1418 (Version_script_info::get_symbol_version_helper): Rewrite to use
1420 (Version_script_info::print_expression_list): Adjust to use
1421 Version_script_info::Language.
1422 (script_push_lex_into_version_mode): Check that the version script
1423 has not been finalized.
1424 (version_script_push_lang): Change language string to
1425 Version_script_info::Language.
1426 * options.cc (Command_line::version_script): New function.
1427 * options.h (class General_options): Add finalize_dynamic_list
1428 function. Change version_script from declaration to definition.
1429 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
1430 * testsuite/version_script.map: Remove duplicate def of foo.
1431 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
1433 * testsuite/Makefile.in: Rebuild.
1435 2009-12-30 Ian Lance Taylor <iant@google.com>
1438 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
1439 if the input symbol index is 0, make the output symbol index 0.
1441 2009-12-30 Ian Lance Taylor <iant@google.com>
1444 * options.h (class General_options): Add -x/--discard-all.
1445 * object.cc (Sized_relobj::do_count_local_symbols): Handle
1446 --discard-all. If the local symbol needs a dynamic entry, check
1447 that before handling --discard-locals.
1449 2009-12-30 Ian Lance Taylor <iant@google.com>
1452 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
1454 (Output_segment::add_output_section): Don't change the flags if
1458 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
1459 GNU hash table if they need a dynamic value. Otherwise, don't add
1460 them if they are defined in a dynamic object or are forced local.
1462 2009-12-29 Ian Lance Taylor <iant@google.com>
1465 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
1466 .gnu.hash table for a 32-bit target.
1469 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
1470 regular and a dynamic object only needs a dynamic symbol table
1471 entry if it is externally visible.
1474 * i386.cc (class Target_i386): Initialize global_offset_table_ in
1475 constructor. Add global_offset_table_ field.
1476 (Target_i386::got_section): Set global_offset_table_.
1477 (Target_i386::do_finalize_sections): Set global_offset_table_
1479 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
1480 in constructor. Add global_offset_table_ field.
1481 (Target_x86_64::got_section): Set global_offset_table_.
1482 (Target_x86_64::do_finalize_sections): Set global_offset_table_
1485 * layout.cc (Layout::Layout): Initialize increase_relro_.
1486 (Layout::get_output_section): Add is_relro, is_last_relro, and
1487 is_first_non_relro parameters. Change all callers.
1488 (Layout::choose_output_section): Likewise.
1489 (Layout::add_output_section_data): Likewise.
1490 (Layout::make_output_section): Likewise.
1491 (Layout::set_segment_offsets): Clear increase_relro when using a
1493 * layout.h (class Layout): Add increase_relro method. Add
1494 increase_relro_ field. Update declarations.
1495 * output.cc (Output_section::Output_section): Initialize
1496 is_last_relro_ and is_first_non_relro_.
1497 (Output_segment::add_output_section): Group relro sections is
1498 do_sort is true. Handle is_last_relro and is_first_non_relro.
1499 (Output_segment::maximum_alignment): Remove relro handling.
1500 (Output_segment::set_section_addresses): Add increase_relro
1501 parameter. Change all callers. Add initial alignment to align
1502 relro sections on separate page. Remove old relro handling.
1503 (Output_segment::set_section_list_addresses): Remove in_relro
1504 parameter. Change all callers.
1505 (Output_segment::set_offset): Add increase parameter. Change all
1506 callers. Remove old relro handling.
1507 * output.h (class Output_section): Add new methods: is_last_relro,
1508 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
1509 Add is_last_relro_ and is_first_non_relro_ fields.
1510 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
1511 Create separate .got.plt section. Call increase_relro.
1512 * x86_64.cc (Target_x86_64::got_section): Likewise.
1513 * testsuite/relro_script_test.t: Add .got.plt.
1516 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
1517 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
1518 (Layout::finalize): Call set_dynamic_symbol_size.
1519 (Layout::set_dynamic_symbol_size): New function.
1520 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
1521 set_dynamic_symbol_size.
1524 * output.h (class Output_section): Add is_entsize_zero_ field.
1525 * output.cc (Output_section::Output_section): Initialize
1527 (Output_section::set_entsize): If two different entsizes are
1528 requested, force it to zero.
1529 (Output_section::add_input_section): Set flags for .debug_str
1530 before updating section flags. Set entsize.
1531 (Output_section::update_flags_for_input_section): Set SHF_MERGE
1532 and SHF_STRING if all input sections have those flags.
1534 2009-12-29 Rafael Espindola <espindola@google.com>
1536 * main.cc (main): Fix the sys time reporting.
1537 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
1540 2009-12-29 Sriraman Tallam <tmsriram@google.com>
1542 * options.cc (General_options::parse_version): Allow -v to exit
1543 without an error if there is nothing to link.
1545 2009-12-29 Ian Lance Taylor <iant@google.com>
1547 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
1548 using a version of gcc before 4.1.
1549 * configure: Rebuild.
1551 2009-12-28 Chris Demetriou <cgd@google.com>
1553 * attributes.cc (Output_attributes_section_data::do_write): Use
1554 std::vector::front rather than std::vector::data.
1556 2009-12-28 Ian Lance Taylor <iant@google.com>
1558 * symtab.h (class Symbol_table): Add enum Defined.
1559 * resolve.cc (Symbol_table::should_override): Add defined
1560 parameter. Change all callers. Test whether object is NULL
1561 before calling a method on it.
1562 (Symbol_table::report_resolve_problem): Add defined parameter.
1564 (Symbol_table::should_override_with_special): Likewise.
1565 * symtab.cc (Symbol_table::define_in_output_data): Add defined
1566 parameter. Change all callers.
1567 (Symbol_table::do_define_in_output_data): Likewise.
1568 (Symbol_table::define_in_output_segment): Likewise.
1569 (Symbol_table::do_define_in_output_segment): Likewise.
1570 (Symbol_table::define_as_constant): Likewise.
1571 (Symbol_table::do_define_as_constant): Likewise.
1572 * script.h (class Symbol_assignment): Add is_defsym parameter to
1573 constructor; change all callers.
1574 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
1575 parameter. Change all callers. Add is_defsym_ field.
1576 (class Parser_closure): Add parsing_defsym parameter to
1577 constructor; change all callers. Add parsing_defsym accessor
1578 function. Add parsing_defsym_ field.
1580 2009-12-28 Ian Lance Taylor <iant@google.com>
1582 * gold.cc (queue_middle_tasks): Fix formatting.
1583 * object.cc (Relobj::is_section_name_included): Likewise.
1585 2009-12-23 Ian Lance Taylor <iant@google.com>
1587 * i386.cc (Target_i386::do_calls_non_split): Recognize
1588 -fsplit-stack prologue for a function with a static chain.
1589 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
1590 -fsplit-stack prologue when using %r11.
1592 2009-12-21 Sriraman Tallam <tmsriram@google.com>
1594 * options.cc (General_options::parse_version): Make -v continue and do
1595 the link like GNU ld does.
1597 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
1599 * Makefile.am (CCFILES): Add timer.cc.
1600 (HFILES): Add timer.h.
1601 * configure.ac: Check for sysconf and times.
1602 * main.cc: include timer.h.
1603 (main): Use Timer instead of get_run_time.
1606 * workqueue.cc: include timer.h.
1607 (Workqueue::find_and_run_task):
1608 Report user, sys and wall time.
1609 * Makefile.in: Regenerate.
1610 * config.in: Regenerate.
1611 * configure: Regenerate.
1613 2009-12-16 Doug Kwan <dougkwan@google.com>
1615 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
1617 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
1618 relaxed input sections.
1619 * output.cc (Output_section::find_relaxed_input_section): Change
1620 return type to Output_relaxed_input_section pointer. Adjust code
1621 for new type of relaxed_input_section_map_.
1622 * output.h (Output_section::find_relaxed_input_section): Change
1623 return type to Output_relaxed_input_section pointer.
1624 (Output_section::Output_relaxed_input_section_by_input_section_map):
1626 (Output_section::relaxed_input_section_map_): Change type to
1627 Output_section::Output_relaxed_input_section_by_input_section_map.
1628 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
1631 2009-12-15 Ian Lance Taylor <iant@google.com>
1633 * layout.cc (Layout::create_shstrtab): Only write out after input
1634 sections if we are compressing debug sections.
1636 2009-12-15 Ian Lance Taylor <iant@google.com>
1638 * archive.cc (Archive::add_symbols): Only look up a symbol without
1639 a version if there is, in fact, a version.
1641 2009-12-14 Ian Lance Taylor <iant@google.com>
1643 Revert -Wshadow changes, all changes from:
1644 2009-12-11 Doug Kwan <dougkwan@google.com>
1645 2009-12-11 Nick Clifton <nickc@redhat.com>
1646 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
1648 2009-12-11 Doug Kwan <dougkwan@google.com>
1650 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
1652 * attributes.cc (Object_attribute::size): Ditto.
1653 (Attributes_section_data::size): Ditto.
1654 (Attributes_section_data::Attributes_section_data): Ditto.
1655 (Output_attributes_section_data::do_write): Ditto.
1656 * attributes.h (Object_attribute::set_type): Ditto.
1657 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
1659 2009-12-11 Nick Clifton <nickc@redhat.com>
1661 * archive.cc: Fix shadowed variable warnings.
1663 * compressed_output.cc: Likewise.
1664 * compressed_output.h: Likewise.
1665 * configure: Likewise.
1666 * dwarf_reader.cc: Likewise.
1667 * dynobj.cc: Likewise.
1668 * dynobj.h: Likewise.
1669 * ehframe.cc: Likewise.
1670 * ehframe.h: Likewise.
1671 * errors.cc: Likewise.
1672 * expression.cc: Likewise.
1673 * fileread.cc: Likewise.
1674 * fileread.h: Likewise.
1675 * freebsd.h: Likewise.
1676 * i386.cc: Likewise.
1678 * incremental.h: Likewise.
1679 * layout.cc: Likewise.
1680 * layout.h: Likewise.
1681 * mapfile.cc: Likewise.
1682 * merge.cc: Likewise.
1683 * merge.h: Likewise.
1684 * object.cc: Likewise.
1685 * object.h: Likewise.
1686 * options.h: Likewise.
1687 * output.cc: Likewise.
1688 * output.h: Likewise.
1689 * parameters.cc: Likewise.
1690 * plugin.cc: Likewise.
1691 * powerpc.cc: Likewise.
1692 * reduced_debug_output.cc: Likewise.
1693 * reduced_debug_output.h: Likewise.
1694 * reloc.cc: Likewise.
1695 * reloc.h: Likewise.
1696 * resolve.cc: Likewise.
1697 * script-sections.cc: Likewise.
1698 * script.cc: Likewise.
1699 * script.h: Likewise.
1700 * sparc.cc: Likewise.
1701 * symtab.cc: Likewise.
1702 * symtab.h: Likewise.
1703 * target-select.cc: Likewise.
1704 * target-select.h: Likewise.
1705 * token.h: Likewise.
1706 * workqueue.cc: Likewise.
1707 * workqueue.h: Likewise.
1708 * x86_64.cc: Likewise.
1710 2009-12-10 Doug Kwan <dougkwan@google.com>
1712 * arm.cc (attributes.h): New include.
1713 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
1714 (Arm_relobj::~Arm_relobj): Delete object pointed by
1715 attributes_section_data_.
1716 (Arm_relobj::attributes_section_data): New method definition.
1717 (Arm_relobj::attributes_section_data_): New data member declaration.
1718 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
1719 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
1720 attributes_section_data_.
1721 (Arm_dynobj::attributes_section_data): New method definition.
1722 (Arm_dynobj::attributes_section_data_): New data member declaration.
1723 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
1724 initialization value of may_use_blx_ to false.
1725 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
1726 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
1727 object attributes to compute results instead of hard-coding.
1728 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
1729 Target_arm::get_secondary_compatible_arch,
1730 Target_arm::set_secondary_compatible_arch
1731 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1732 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
1733 New method declarations.
1734 (Target_arm::get_aeabi_object_attribute): New method definition.
1735 (Target_arm::attributes_section_data_): New data member declaration.
1736 (read_arm_attributes_section): New template definition.
1737 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
1738 (Arm_dynobj::do_read_symbols): Ditto.
1739 (Target_arm::do_finalize_sections): Merge attributes sections from
1740 input. Check for BLX use after attributes section merging.
1741 Fix __exidx_start and __exidx_end visibility. Create an
1742 .ARM.attributes section if necessary.
1743 (Target_arm::get_secondary_compatible_arch,
1744 Target_arm::set_secondary_compatible_arch,
1745 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
1746 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
1747 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
1748 New method definitions.
1750 2009-12-09 Ian Lance Taylor <iant@google.com>
1752 * plugin.cc (Plugin::load): Don't cast from void* to a function
1755 2009-12-09 Ian Lance Taylor <iant@google.com>
1757 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
1760 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
1762 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
1763 Replace two_file_shared_1.so with two_file_shared_2.so.
1764 * testsuite/Makefile.in: Regenerated.
1766 2009-12-08 Doug Kwan <dougkwan@google.com>
1768 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
1769 (HFILES): Add attributes.h and int_encoding.h.
1770 * Makefile.in: Regenerate.
1771 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
1772 function definitions to int_encoding.cc
1773 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
1774 prototypes to int_encoding.h
1775 * reduced_debug_output.cc (int_encoding.h): New include.
1776 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
1777 function definitions to int_encoding.cc
1778 (insert_into_vector, read_from_pointer): Move template definitions to
1780 * attributes.cc: New file.
1781 * attributes.h: New file.
1782 * int_encoding.cc: New file.
1783 * int_encoding.h: New file.
1785 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
1788 * incremental-dump.cc (dump_incremental_inputs): New.
1789 (main): Use dump_incremental_inputs.
1791 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
1794 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
1795 checking elfcpp::STT_FUNC.
1796 (Target_i386::Relocate::relocate): Likewise.
1797 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1799 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
1800 symbols from shared libraries into normal FUNC symbols.
1802 * symtab.h (Symbol): Add is_func and use it.
1804 2009-12-05 Doug Kwan <dougkwan@google.com>
1806 * arm.cc (Target_arm::arm_info): Initialize new fields
1807 attributes_section and attributes_vendor.
1808 * i386.cc (Target_i386::i386_info): Same.
1809 * object.cc (Sized_relobj::do_layout): Skip attribute section.
1810 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1811 fields attributes_section and attributes_vendor.
1812 * sparc.cc (Target_sparc::sparc_info): Same.
1813 * target.h (Target::attributes_section, Target::attributes_vendor,
1814 Target::is_attributes_section, Target::attribute_arg_type,
1815 Target::attributes_order): New method definitions.
1816 (Target::Target_info::attributes_section,
1817 Target::Target_info::attributes_vendor): New fields.
1818 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1819 virtual method definitions.
1820 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1821 attributes_section and attributes_vendor.
1822 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1824 2009-12-05 Doug Kwan <dougkwan@google.com>
1826 * arm.cc: Update comments about interworking and stub generation.
1827 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1828 considered as non-PIC.
1829 (Arm_relocate_functions::base_abs): Fix formatting.
1830 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1831 of function to use GOT entry address instead of offset.
1832 (Target_arm::Scan::global): Issue an error if a symbol would need a
1833 PLT does not get one because it is untyped. Remove code to create
1834 dynamic symbols for relative branches.
1835 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1836 takes unsigned integer instead of boolean.
1838 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1840 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1841 (two_file_test_LDADD): Likewise.
1842 (common_test_1_LDADD): Likewise.
1843 (exception_test_LDADD) Likewise.
1844 (weak_test_LDADD): Likewise.
1845 (many_sections_test_LDADD): Likewise.
1846 (initpri1_LDADD): Likewise.
1847 (script_test_1_LDADD): Likewise.
1848 (script_test_2_LDADD): Likewise.
1849 (justsyms_LDADD): Likewise.
1850 (binary_test_LDADD): Likewise.
1851 (large_LDADD): Likewise.
1852 * testsuite/Makefile.in: Regenerated.
1854 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1856 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1857 (Symbol_table::override_with_special): Likewise.
1858 (Symbol_table::add_from_object): Likewise.
1860 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1862 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1863 Don't set the data_offset twice.
1865 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1867 * testsuite/Makefile.in: Regenerate.
1869 2009-12-03 Doug Kwan <dougkwan@google.com>
1871 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1872 (Target_arm::do_finalize_sections): Add parameter for symbol table
1873 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1874 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1875 parameter for symbol table pointer.
1876 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1877 an additional parameter for a pointer to symbol table.
1878 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1879 parameter for a symbol table pointer.
1880 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1881 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1883 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1884 parameter for a symbol table pointer.
1886 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
1888 * incremental.cc (Incremental_inputs_header)
1889 (Incremental_inputs_header_write, Incremental_inputs_entry)
1890 (Incremental_inputs_entry_write): Move ...
1891 * incremental.h (Incremental_inputs_header)
1892 (Incremental_inputs_header_write, Incremental_inputs_entry)
1893 (Incremental_inputs_entry_write): here.
1895 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1897 * incremental.cc (make_sized_incremental_binary): Set the target.
1898 Error if it is incompatible.
1899 * output.h (Output_file): Add filename method.
1901 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1903 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1904 from the get_* methods.
1906 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1908 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1909 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1910 Write 0 for the data_offset of scripts.
1912 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1914 * testsuite/Makefile.am: Add the incremental_test.sh test.
1915 * testsuite/incremental_test.sh: New.
1916 * testsuite/incremental_test_1.c: New.
1917 * testsuite/incremental_test_2.c: New.
1919 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
1921 * incremental-dump.cc (main): Fix typos.
1923 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
1926 * incremental-dump.cc (main): Use llu to print 64 bit values.
1928 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1929 H.J. Lu <hongjiu.lu@intel.com>
1931 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1933 (incremental_dump_LDADD): Likewise.
1934 * Makefile.in: Regenerated.
1936 2009-11-25 Doug Kwan <dougkwan@google.com>
1940 2009-11-25 Doug Kwan <dougkwan@google.com>
1942 * arm.cc (Target_arm::Target_arm): Move method definition
1943 outside of class definition. Add code to handle
1944 --target1-rel, --target1-abs and --target2= options.
1945 (Target_arm::get_reloc_reloc_type): Change method to be
1946 non-static and const.
1947 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1948 New data member declaration.
1949 (Target_arm::Scan::local, Target_arm::Scan::global,
1950 Target_arm::Relocate::relocate,
1951 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1952 Adjust call to Target_arm::get_real_reloc_type.
1953 (Target_arm::get_real_reloc_type): Use command line options
1954 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1955 * options.h (--target1-rel, --target1-abs, --target2): New
1958 2009-11-25 Doug Kwan <dougkwan@google.com>
1960 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1961 class definition. Add code to handle --target1-rel, --target1-abs
1962 and --target2= options.
1963 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1965 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1967 (Target_arm::Scan::local, Target_arm::Scan::global,
1968 Target_arm::Relocate::relocate,
1969 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1970 call to Target_arm::get_real_reloc_type.
1971 (Target_arm::get_real_reloc_type): Use command line options to
1972 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1973 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1976 2009-11-25 Doug Kwan <dougkwan@google.com>
1978 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1979 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1980 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1982 (Arm_relocate_functions::thm_call): Replace body with a call to
1983 Arm_relocate_functions::thumb_branch_common.
1984 (Arm_relocate_functions::thm_jump24,
1985 Arm_relocate_functions::thm_xpc22): New method definitions.
1986 (Arm_relocate_functions::thumb_branch_common): New method definition.
1987 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1989 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1990 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1992 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1994 * Makefile.am: Build incremental-dump
1995 * Makefile.in: Regenerate.
1996 * incremental-dump.cc: New.
1997 * incremental.cc (Incremental_inputs_header_data,
1998 Incremental_inputs_entry_data): Move to incremental.h
1999 * incremental.h: (Incremental_inputs_header_data,
2000 Incremental_inputs_entry_data): Move from incremental.cc
2002 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2004 * incremental.cc (Incremental_inputs_header,
2005 Incremental_inputs_header_write, Incremental_inputs_entry,
2006 Incremental_inputs_entry_write): Add a typedef with the data type.
2008 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2010 * incremental.cc (Incremental_inputs_header,
2011 Incremental_inputs_header_write, Incremental_inputs_entry,
2012 Incremental_inputs_entry_write): Update comment about which
2013 type has the filed descriptions.
2015 2009-11-15 Doug Kwan <dougkwan@google.com>
2017 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
2018 (Arm_relocate_functions::arm_branch_common): Change method defintion
2019 in class definition to a method declaration and update list of formal
2021 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
2022 Arm_relocation_functions::jump24): Adjust call to
2023 Arm_relocate_functions::arm_branch_common. Update list of formal
2025 (Arm_relocate_functions::xpc25): New method definition.
2026 (Arm_relocate_functions::arm_branch_common): Move method defintion
2027 out from class definition. Use stubs for mode-switching and extending
2029 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
2030 specially. Change code to enable use of stubs in ARM branches.
2032 2009-11-10 Doug Kwan <dougkwan@google.com>
2034 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
2035 in method declaration.
2036 (Target_arm::relocate_stub): New method declaration.
2037 (Target_arm::default_target): Change to return a pointer instead of
2039 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
2040 Target_arm::default_target.
2041 (Arm_Relobj::do_relocate_sections): Remove options paramater in
2043 (Target_arm::relocate_section): Adjust view.
2044 (Target_arm::relocate_stub): New method definition.
2046 2009-11-10 Doug Kwan <dougkwan@google.com>
2048 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
2050 * incremental.cc (open_incremental_binary): Initialized local
2051 variables to avoid warnings.
2052 * object.cc (make_elf_object): Ditto.
2053 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
2056 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
2059 * testsuite/plugin_test.c: Include "config.h".
2061 2009-11-09 Doug Kwan <dougkwan@google.com>
2063 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
2064 (arm_symbol_value): Remove.
2065 (Arm_relocate_functions::arm_branch_common,
2066 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
2067 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
2068 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
2069 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
2070 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
2071 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
2072 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
2073 Arm_relocate_functions::thm_mobw_abs_nc,
2074 Arm_relocate_functions::thm_mov_abs,
2075 Arm_relocate_functions::movw_prel_nc,
2076 Arm_relocate_functions::thm_movt_abs,
2077 Arm_relocate_functions::movt_prel,
2078 Arm_relocate_functions::thm_movw_prel_nc,
2079 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
2080 (Target_arm::Relocate::relocate): Only decompose address into two
2081 parts if relocation type uses the thumb-bit and pass the actual
2082 bit instead of a flag indicating that the thumb-bit is used. Adjust
2083 calls to methods in Arm_relocate_functions for this change.
2085 2009-11-08 Ian Lance Taylor <iant@google.com>
2088 * reloc.cc: Instantiate
2089 Sized_relobj::initialize_input_to_output_maps and
2090 Sized_relobj:free_input_to_output_maps.
2092 2009-11-06 Ian Lance Taylor <iant@google.com>
2095 * defstd.cc (in_segment): Set only_if_ref true for "end".
2097 2009-11-06 Doug Kwan <dougkwan@google.com>
2099 * arm.cc (class Reloc_stub): Correct a comment.
2100 (Target_arm::Target_arm): Initialize arm_input_section_map_.
2101 (Target_arm::scan_section_for_stubs): New method declaration.
2102 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
2103 Change methods from private to protected.
2104 (Target_arm::do_may_relax): New method definition.
2105 (Target_arm::do_relax, Target_arm::group_sections,
2106 Target_arm::scan_reloc_for_stub,
2107 Target_arm::scan_reloc_section_for_stubs): New method declarations.
2108 (Target_arm::arm_input_section_map_): New data member declaration.
2109 (Target_arm::scan_reloc_for_stub,
2110 Target_arm::scan_reloc_section_for_stubs,
2111 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
2112 Target_arm::do_relax): New method definitions.
2114 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
2116 * configure.ac: Check for (struct stat)::st_mtim
2117 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
2118 * config.in: Regenerate.
2119 * configure: Regenerate.
2121 2009-11-05 Ian Lance Taylor <iant@google.com>
2124 * output.cc (Output_segment::add_output_section): Add missing
2127 2009-11-04 Ian Lance Taylor <iant@google.com>
2130 * object.h (class Object): Add is_needed and set_is_needed
2131 methods. Add is_needed_ field. Make bool fields into bitfields.
2132 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
2133 defined in a dynamic object and referenced by a regular object,
2134 set is_needed for the dynamic object.
2135 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
2136 if the file is marked with as_needed and it is not needed.
2138 2009-11-04 Ian Lance Taylor <iant@google.com>
2141 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
2142 tags if data is discarded by linker script.
2143 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2144 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2145 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2146 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2148 2009-11-04 Ian Lance Taylor <iant@google.com>
2150 * layout.cc (Layout::get_output_section): Add is_interp and
2151 is_dynamic_linker_section parameters. Change all callers.
2152 (Layout::choose_output_section): Likewise.
2153 (Layout::make_output_section): Likewise.
2154 (Layout::add_output_section_data): Add is_dynamic_linker_section
2155 parameter. Change all callers.
2156 * layout.h (class Layout): Update declarations.
2157 * output.h (class Output_section): Add is_interp, set_is_interp,
2158 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
2159 Add is_interp_, is_dynamic_linker_section_ fields. Change
2160 generate_code_fills_at_write_ to a bitfield.
2161 * output.cc (Output_section::Output_sections): Initialize new
2163 (Output_segment::add_output_section): Add do_sort parameter.
2166 2009-11-03 Ian Lance Taylor <iant@google.com>
2169 * options.h (class General_options): Add --warn-common.
2170 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
2171 merging two common symbols.
2172 (Symbol_table::should_override): Handle --warn-common when merging
2173 a common symbol with a defined symbol. Use report_resolve_problem
2174 for multiple definitions.
2175 (Symbol_table::report_resolve_problem): New function.
2176 * symtab.h (class Symbol_table): Declare report_resolve_problem.
2178 2009-11-03 Doug Kwan <dougkwan@google.com>
2180 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
2182 (Target_arm::stub_factory): New method definition.
2183 (Target_arm::new_arm_input_section,
2184 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
2185 Target_arm::reloc_uses_thumb_bit): New method declarations.
2186 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
2187 New type definitions.
2188 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
2189 member declarations.
2190 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
2191 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
2192 New method definitions.
2194 2009-11-03 Ian Lance Taylor <iant@google.com>
2196 * options.h (class General_options): Add --warn_constructors.
2198 2009-11-03 Ian Lance Taylor <iant@google.com>
2201 * defstd.cc (in_section): Add entries for __rel_iplt_start,
2202 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
2204 2009-11-03 Ian Lance Taylor <iant@google.com>
2207 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
2208 --msgid-bugs-address.
2209 (install-pdf): New target.
2210 (install-data_yes): Look up one directory to find mkinstalldirs.
2212 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
2214 * po/Make-in (.po.gmo): Don't generate .gmo files in source
2217 2009-10-30 Doug Kwan <dougkwan@google.com>
2219 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
2221 2009-10-30 Doug Kwan <dougkwan@google.com>
2223 * arm.cc (Stub_addend_reader): New struct template definition
2224 and partial specializations.
2225 (Stub_addend_reader::operator()): New method definition for a
2226 partially specialized template.
2228 2009-10-30 Doug Kwan <dougkwan@google.com>
2230 * arm.cc (Arm_relobj::processor_specific_flags): New method
2232 (Arm_relobj::do_read_symbols): New method declaration.
2233 (Arm_relobj::processor_specific_flags_): New data member declaration.
2234 (Arm_dynobj): New class definition.
2235 (Target_arm::do_finalize_sections): Add input_objects parameter.
2236 (Target_arm::do_adjust_elf_header): New method declaration.
2237 (Target_arm::are_eabi_versions_compatible,
2238 (Target_arm::merge_processor_specific_flags): New method declaration.
2239 (Target_arm::do_make_elf_object): New overloaded method definitions
2241 (Arm_relobj::do_read_symbols): New method definition.
2242 (Arm_dynobj::do_read_symbols): Ditto.
2243 (Target_arm::do_finalize_sections): Add input_objects parameters.
2244 Merge processor-specific flags from all input objects.
2245 (Target_arm::are_eabi_versions_compatible,
2246 Target_arm::merge_processor_specific_flags,
2247 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
2248 New method definitions.
2249 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
2250 Input_objects pointer type parameter.
2251 * layout.cc (Layout::finalize): Pass input objects to target's.
2252 finalize_sections function.
2253 * output.cc (Output_file_header::do_sized_write): Set ELF file
2254 header's processor-specific flags.
2255 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
2256 Input_objects pointer type parameter.
2257 * sparc.cc (Target_sparc::do_finalize_sections): Same.
2258 * target.h (Input_objects): New forward class declaration.
2259 (Target::processor_specific_flags,
2260 Target::are_processor_specific_flags_sect): New method definitions.
2261 (Target::finalize_sections): Add input_objects parameter.
2262 (Target::Target): Initialize processor_specific_flags_ and
2263 are_processor_specific_flags_set_.
2264 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
2266 (Target::set_processor_specific_flags): New method definition.
2267 (Target::processor_specific_flags_,
2268 Target::are_processor_specific_flags_set_): New data member
2270 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
2271 Input_objects pointer type parameter.
2273 2009-10-30 Doug Kwan <dougkwan@google.com>
2275 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2277 2009-10-28 Ian Lance Taylor <iant@google.com>
2279 * object.h (class Relobj): Drop options parameter from
2280 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
2281 do_scan_relocs, do_relocate. Change all callers.
2282 (class Sized_relobj): Drop options parameters from
2283 do_gc_process_relocs, do_scan_relocs, do_relocate,
2284 do_relocate_sections, relocate_sections, emit_relocs_scan,
2285 emit_relocs_scan_reltype. Change all callers.
2286 (struct Relocate_info): Remove options field and all references to
2288 * reloc.h (class Read_relocs): Remove options constructor
2289 parameter and options_ field. Change all callers.
2290 (class Gc_process_relocs, class Scan_relocs): Likewise.
2291 (class Relocate_task): Likewise.
2292 * target-reloc.h (scan_relocs): Remove options parameter. Change
2294 (scan_relocatable_relocs): Likewise.
2295 * target.h (class Sized_target): Remove options parameter from
2296 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
2298 * gc.h (gc_process_relocs): Remove options parameter. Change all
2300 * arm.cc: Update functions to remove options parameters.
2301 * i386.cc: Likewise.
2302 * powerpc.cc: Likewise.
2303 * sparc.cc: Likewise.
2304 * x86_64.cc: Likewise.
2305 * testsuite/testfile.cc: Likewise.
2307 2009-10-28 Doug Kwan <dougkwan@google.com>
2309 * arm.cc (Arm_relobj): New class definition.
2310 (Arm_relobj::scan_sections_for_stubs,
2311 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
2312 New method definitions.
2314 2009-10-28 Cary Coutant <ccoutant@google.com>
2316 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
2317 (Plugin::cleanup_done_): New member.
2318 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
2319 (Plugin_manager::cleanup_done_): Remove.
2320 (Plugin_manager::add_input_file): Edit error message.
2321 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
2322 (Plugin_manager::cleanup): Remove use of cleanup_done_.
2324 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
2326 * fileread.cc: (File_read::View::~View): Use the new
2327 data_ownership_ filed.
2328 (File_read::~File_read): Dispose the new whole_file_view_.
2329 (File_read::open): Mmap the whole file if needed.
2330 (File_read::open): Use whole_file_view_ instead of contents_.
2331 (File_read::find_view): Use whole_file_view_ if applicable.
2332 (File_read::do_read): Use whole_file_view_ instead of contents_.
2333 (File_read::make_view): Use whole_file_view_ instead of contents_,
2334 update File_read::View::View call.
2335 (File_read::find_or_make_view): Update File_read::View::View
2337 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
2339 (File_read::View::Data_ownership): New enum.
2340 (File_read::View::View): Replace bool mapped_ with Data_ownership
2342 (File_read::View::mapped_): Remove (replaced by data_ownership_).
2343 (File_read::View::data_ownership_): New field.
2344 (File_read::contents_): Remove (replaced by whole_file_view_).
2345 (File_read::whole_file_view_): New field.
2346 * options.h (class General_options): Add --keep-files-mapped.
2348 2009-10-27 Cary Coutant <ccoutant@google.com>
2350 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
2351 * testsuite/Makefile.am (plugin_test_5): New test case.
2352 * testsuite/Makefile.in: Regenerate.
2354 2009-10-25 Doug Kwan <dougkwan@google.com>
2356 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
2357 from private to protected to allow access by child class.
2358 (Sized_relobj::do_relocate_sections): New method declaration.
2359 (Sized_relobj::relocate_sections): Virtualize.
2360 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
2361 Sized_relobj::relocate_sections. Instantiate template explicitly
2362 for different target sizes and endianity.
2364 2009-10-24 Doug Kwan <dougkwan@google.com>
2366 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
2367 (Arm_input_section::as_arm_input_section): New method.
2368 (Arm_output_section): New class definition.
2369 (Arm_output_section::create_stub_group,
2370 Arm_output_section::group_sections): New method definitions.
2372 2009-10-22 Doug Kwan <dougkwan@google.com>
2374 * arm.cc (Arm_input_section): New class definition.
2375 (Arm_input_section::init, Arm_input_section:do_write,
2376 Arm_input_section::set_final_data_size,
2377 Arm_input_section::do_reset_address_and_file_offset): New method
2380 2009-10-21 Doug Kwan <dougkwan@google.com>
2382 * arm.cc (Stub_table, Arm_input_section): New forward class
2384 (Stub_table): New class defintion.
2385 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
2386 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
2387 New method definition.
2389 2009-10-21 Doug Kwan <dougkwan@google.com>
2391 * arm.cc: Update copyright comments.
2392 (Target_arm): New forward class template declaration.
2393 (Arm_address): New type.
2394 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
2395 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
2396 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
2398 (Insn_template): Same.
2399 (DEF_STUBS): New macro.
2400 (Stub_type): New enum type.
2401 (Stub_template): New class definition.
2404 (Stub_factory): Same.
2405 (Target_arm::Target_arm): Initialize may_use_blx_ and
2406 should_force_pic_veneer_.
2407 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
2408 Target_arm::should_force_pic_veneer,
2409 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
2410 Target_arm::using_thumb_only, Target_arm:;default_target): New
2412 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
2413 New data member declarations.
2414 (Insn_template::size, Insn_template::alignment): New method defintions.
2415 (Stub_template::Stub_template): New method definition.
2416 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
2417 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
2418 (Stub_factory::Stub_factory): New method definition.
2419 * gold.h (string_hash): New template.
2420 * output.h (Input_section_specifier::hash_value): Use
2422 (Input_section_specifier::string_hash): Remove.
2423 * stringpool.cc (Stringpool_template::string_hash): Use
2426 2009-10-20 Doug Kwan <dougkwan@google.com>
2428 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
2429 symbols of relaxed input sections.
2430 * output.h (Output_section::find_relaxed_input_section): Make
2433 2009-10-16 Doug Kwan <dougkwan@google.com>
2435 * dynobj.cc (Versions::Versions): Initialize version_script_.
2436 Only insert base version symbol definition for a shared object
2437 if version script defines any version versions.
2438 (Versions::define_base_version): New method definition.
2439 (Versions::add_def): Check that base version is not needed.
2440 (Versions::add_need): Define base version lazily.
2441 * dynobj.h (Versions::define_base_version): New method declaration.
2442 (Versions::needs_base_version_): New data member declaration.
2443 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
2444 (check_DATA): Add no_version_test.stdout.
2445 (libno_version_test.so, no_version_test.o no_version_test.stdout):
2447 * testsuite/Makefile.in: Regenerate.
2448 * testsuite/no_version_test.c: New file.
2449 * testsuite/no_version_test.sh: Ditto.
2451 2009-10-16 Doug Kwan <dougkwan@google.com>
2453 * expression.cc (class Segment_start_expression): New class definition.
2454 (Segment_start_expression::value): New method definition.
2455 (script_exp_function_segment_start): Return a new
2456 Segment_start_expression.
2457 * gold/script-c.h (script_saw_segment_start_expression): New function
2459 * script-sections.cc (Script_sections::Script_sections): Initialize
2460 SAW_SEGMENT_START_EXPRESSION_ to false.
2461 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
2462 and -Tbbs options to specify section addresses if given in
2463 command line and no SEGMENT_START expression is seen in a script.
2464 * script-sections.h (Script_sections::saw_segment_start_expression,
2465 Script_sections::set_saw_segment_start_expression): New method
2467 (Script_sections::saw_segment_start_expression_): New data member
2469 * script.cc (script_saw_segment_start_expression): New function.
2470 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
2471 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
2472 script_test_7.sh and script_test_8.sh.
2473 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
2474 script_test_8.stdout.
2475 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
2476 (script_test_6, script_test_6.stdout, script_test_7,
2477 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
2478 * Makefile.in: Regenerate.
2479 * testsuite/script_test_6.sh: New file.
2480 * testsuite/script_test_6.t: Same.
2481 * testsuite/script_test_7.sh: Same.
2482 * testsuite/script_test_7.t: Same.
2483 * testsuite/script_test_8.sh: Same.
2485 2009-10-16 Doug Kwan <dougkwan@google.com>
2487 * output.cc (Output_segment::set_section_list_address): Cast
2488 expressions to unsigned long long type to avoid format warnings.
2490 2009-10-15 Ian Lance Taylor <iant@google.com>
2492 * script.cc (Script_options::add_symbol_assignment): Always add a
2493 dot assignment to script_sections_.
2494 * script-sections.cc (Script_sections::add_dot_assignment):
2495 Initialize if necessary.
2497 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
2498 program headers with no load segment if there is a linker script.
2500 * layout.cc (Layout::set_segment_offsets): Align the file offset
2501 to the segment aligment for -N or -n with no load segment.
2502 * output.cc (Output_segment::add_output_section): Don't crash if
2503 the first section is a TLS section.
2504 (Output_segment::set_section_list_addresses): Print an error
2505 message if the address moves backward in a linker script.
2506 * script-sections.cc
2507 (Output_section_element_input::set_section_addresses): Don't
2508 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
2509 (Orphan_output_section::set_section_addresses): Likewise.
2511 2009-10-15 Doug Kwan <dougkwan@google.com>
2513 * layout.cc (Layout::finish_dynamic_section): Generate tags
2514 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
2515 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
2516 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
2518 2009-10-14 Ian Lance Taylor <iant@google.com>
2520 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
2522 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
2523 data_shdr fields of relinfo.
2524 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
2525 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
2526 R_386_TLS_LDO_32, adjust based on section flags.
2527 (Target_i386::Relocate::fix_up_ldo): Remove.
2529 2009-10-13 Ian Lance Taylor <iant@google.com>
2531 Add support for -pie.
2532 * options.h (class General_options): Add -pie and
2534 (General_options::output_is_position_independent): Test -pie.
2535 (General_options::output_is_executable): Return true if not shared
2536 and not relocatable.
2537 (General_options::output_is_pie): Remove.
2538 * options.cc (General_options::finalize): Reject incompatible uses
2540 * gold.cc (queue_middle_tasks): A -pie link is not static.
2541 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
2542 * symtab.cc (Symbol::final_value_is_known): Return false if
2543 output_is_position_independent.
2544 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
2545 output_is_position_independent.
2546 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
2547 output_is_position_independent.
2548 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
2549 output_is_position_independent.
2550 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
2552 (basic_pie_test.o, basic_pie_test): New targets.
2553 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
2554 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
2555 (two_file_pie_test): New target.
2556 * testsuite/Makefile.in: Rebuild.
2557 * README: Remove note saying that -pie is not supported.
2559 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2561 * options.h (class General_options): Add -init and -fini.
2562 * layout.cc (Layout::finish_dynamic_section): Emit
2563 given init and fini functions.
2565 2009-10-13 Sriraman Tallam <tmsriram@google.com>
2567 * gc.h (gc_process_relocs): Check if icf is enabled using new
2569 * gold.cc (queue_initial_tasks): Likewise.
2570 (queue_middle_tasks): Likewise.
2571 * object.cc (do_layout): Likewise.
2572 * symtab.cc (is_section_folded): Likewise.
2573 * main.cc (main): Likewise.
2574 * reloc.cc (Read_relocs::run): Likewise.
2575 (Sized_relobj::do_scan_relocs): Likewise.
2576 * icf.cc (is_function_ctor_or_dtor): New function.
2577 (Icf::find_identical_sections): Check if function is ctor or dtor when
2579 * options.h (General_options::icf): Change option to be an enum.
2580 (Icf_status): New enum.
2581 (icf_enabled): New method.
2582 (icf_safe_folding): New method.
2583 (set_icf_status): New method.
2584 (icf_status_): New variable.
2585 * (options.cc) (General_options::finalize): Set icf_status_.
2586 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
2587 icf_test and icf_keep_unique_test to use the --icf enum flag.
2588 * testsuite/icf_safe_test.sh: New file.
2589 * testsuite/icf_safe_test.cc: New file.
2591 2009-10-12 Sriraman Tallam <tmsriram@google.com>
2593 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
2594 includes to gc.h and icf.h.
2595 * arm.cc: Include gc.h.
2596 * gold.cc: Likewise.
2597 * i386.cc: Likewise.
2598 * powerpc.cc: Likewise.
2599 * sparc.cc: Likewise.
2600 * x86_64.cc: Likewise.
2601 * gc.h: Include icf.h.
2603 2009-10-11 Ian Lance Taylor <iant@google.com>
2605 * plugin.cc: Include "gold.h" before other header files.
2607 2009-10-10 Chris Demetriou <cgd@google.com>
2609 * options.h (Input_file_argument::Input_file_type): New enum.
2610 (Input_file_argument::is_lib_): Replace with...
2611 (Input_file_argument::type_): New member.
2612 (Input_file_argument::Input_file_argument): Take Input_file_type
2613 'type' rather than boolean 'is_lib' as second argument.
2614 (Input_file_argument::is_lib): Use type_.
2615 (Input_file_argument::is_searched_file): New function.
2616 (Input_file_argument::may_need_search): Handle is_searched_file.
2617 * options.cc (General_options::parse_library): Support -l:filename.
2618 (General_options::parse_just_symbols): Update for Input_file_argument
2620 (Command_line::process): Likewise.
2621 * archive.cc (Archive::get_file_and_offset): Likewise.
2622 * plugin.cc (Plugin_manager::release_input_file): Likewise.
2623 * script.cc (read_script_file, script_add_file): Likewise.
2624 * fileread.cc (Input_file::Input_file): Likewise.
2625 (Input_file::will_search_for): Handle is_searched_file.
2626 (Input_file::open): Likewise.
2627 * readsyms.cc (Read_symbols::get_name): Likewise.
2628 * testsuite/Makefile.am (searched_file_test): New test.
2629 * testsuite/Makefile.in: Regenerate.
2630 * testsuite/searched_file_test.cc: New file.
2631 * testsuite/searched_file_test_lib.cc: New file.
2633 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2634 Ian Lance Taylor <iant@google.com>
2636 * descriptor.cc: Include <cstdio> and "binary-io.h".
2637 (Descriptors::open): Open the files in binary mode always.
2638 * script.cc (Lex::get_token): Treat \r as whitespace.
2640 2009-10-09 Ian Lance Taylor <iant@google.com>
2642 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
2644 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2645 Ian Lance Taylor <iant@google.com>
2647 * configure.ac: Check for readv function also.
2648 * fileread.cc (readv): Define if not HAVE_READV.
2649 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
2651 * config.in: Regenerate.
2652 * configure: Regenerate.
2654 2009-10-09 Doug Kwan <dougkwan@google.com>
2656 * layout.cc (Layout::make_output_section): Call target hook to make
2657 ordinary output section.
2658 (Layout::finalize): Adjust parameter list of call the
2659 Target::may_relax().
2660 * layout.h (class Layout::section_list): New method.
2661 * merge.h (Output_merge_base::entsize): Change visibility to public.
2662 (Output_merge_base::is_string, Output_merge_base::do_is_string):
2664 (Output_merge_string::do_is_string): New method.
2665 * object.cc (Sized_relobj::do_setup): renamed from
2666 Sized_relobj::set_up.
2667 * object.h (Sized_relobj::adjust_shndx,
2668 Sized_relobj::initializ_input_to_output_maps,
2669 Sized_relobj::free_input_to_output_maps): Change visibilities to
2671 (Sized_relobj::setup): Virtualize.
2672 (Sized_relobj::do_setup): New method declaration.
2673 (Sized_relobj::invalidate_section_offset,
2674 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
2675 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
2676 * options.cc (parse_int): New function.
2677 * options.h (parse_int): New declaration.
2678 (DEFINE_int): New macro.
2679 (stub_group_size): New option.
2680 * output.cc (Output_section::Output_section): Initialize memebers
2681 merge_section_map_, merge_section_by_properties_map_,
2682 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
2683 (Output_section::add_input_section): Handled deferred code-fill
2684 generation and remove an old comment.
2685 (Output_section::add_relaxed_input_section): New method definition.
2686 (Output_section::add_merge_input_section): Use merge section by
2687 properties map to speed to search. Update merge section maps
2689 (Output_section::build_relaxation_map): New method definition.
2690 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2692 (Output_section::relax_input_section): Renamed to
2693 Output_section::convert_input_sections_to_relaxed_sections and change
2694 interface to take a vector of pointers to relaxed sections.
2695 (Output_section::find_merge_section,
2696 Output_section::find_relaxed_input_section): New method definitions.
2697 (Output_section::is_input_address_mapped,
2698 Output_section::output_offset, Output_section::output_address):
2699 Use output section data maps to speed up searching.
2700 (Output_section::find_starting_output_address): Add comments.
2701 (Output_section::do_write,
2702 Output_section::write_to_postprocessing_buffer): Do code-fill
2703 generation as appropriate.
2704 (Output_section::get_input_sections): Invalidate relaxed input section
2706 (Output_section::restore_states): Adjust type of checkpoint .
2707 Invalidate relaxed input section map.
2708 * output.h (Output_merge_base): New class declaration.
2709 (Input_section_specifier): New class defintion.
2710 (class Output_relaxed_input_section) Change base class to
2711 Output_section_data_build.
2712 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
2713 base class initializer.
2714 (Output_section::add_relaxed_input_section): New method declaration.
2715 (Output_section::Input_section): Change visibility to protected.
2716 (Output_section::Input_section::relobj,
2717 Output_section::Input_section::shndx): Handle relaxed input sections.
2718 Output_section::input_sections) Change visibility to protected. Also
2719 define overload to return a non-const pointer.
2720 (Output_section::Merge_section_properties): New class defintion.
2721 (Output_section::Merge_section_by_properties_map,
2722 Output_section::Output_section_data_by_input_section_map,
2723 Output_section::Relaxation_map): New types.
2724 (Output_section::relax_input_section): Rename method to
2725 Output_section::convert_input_sections_to_relaxed_sections and change
2726 interface to take a vector of relaxed section pointers.
2727 (Output_section::find_merge_section,
2728 Output_section::find_relaxed_input_section,
2729 Output_section::build_relaxation_map,
2730 Output_section::convert_input_sections_in_list_to_relaxed_sections):
2731 New method declarations.
2732 (Output_section::merge_section_map_
2733 Output_section::merge_section_by_properties_map_,
2734 Output_section::relaxed_input_section_map_,
2735 Output_section::is_relaxed_input_section_map_valid_,
2736 Output_section::generate_code_fills_at_write_): New data members.
2737 * script-sections.cc
2738 (Output_section_element_input::set_section_addresses): Call
2739 current_data_size and addralign methods of relaxed input sections.
2740 (Orphan_output_section::set_section_addresses): Call current_data_size
2741 and addralign methods of relaxed input sections.
2742 * symtab.cc (Symbol_table::compute_final_value): Extract template
2743 from the body of Symbol_table::sized_finalize_symbol.
2744 (Symbol_table::sized_finalized_symbol): Call
2745 Symbol_table::compute_final_value.
2746 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
2747 (Symbol_table::compute_final_value): New templated method declaration.
2748 * target.cc (Target::do_make_output_section): New method defintion.
2749 * target.h (Target::make_output_section): New method declaration.
2750 (Target::relax): Add more parameters for input objects, symbol table
2751 and layout. Adjust call to do_relax.
2752 (Target::do_make_output_section): New method declaration.
2753 (Target::do_relax): Add parameters for input objects, symbol table
2756 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2758 * pread.c: Include stdio.h.
2760 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2762 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
2765 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
2767 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2768 Change read_shndx type to unsigned int.
2769 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2771 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2772 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
2773 Change read_shndx type to unsigned int.
2774 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
2776 (Sized_dwarf_line_info::read_line_mappings): Likewise.
2777 * layout.cc (Layout::create_symtab_sections): Cast the result of
2778 local_symcount * symsize to off_t in the gold_assert.
2780 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2782 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
2783 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
2785 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
2786 (Arm_relocate_functions::thm_abs5): New function.
2787 (Arm_relocate_functions::abs12): New function.
2788 (Arm_relocate_functions::abs16): New function.
2789 (Arm_relocate_functions::base_abs): New function.
2790 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
2791 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
2792 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
2794 (Scan::global): Likewise.
2795 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
2796 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
2797 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
2798 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
2801 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2803 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
2804 (Arm_relocate_functions::movt_prel): New function.
2805 (Arm_relocate_functions::thm_movw_prel_nc): New function.
2806 (Arm_relocate_functions::thm_movt_prel): New function.
2807 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
2808 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
2809 (Scan::global, Relocate::relocate): Likewise.
2810 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2812 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2814 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2815 Incremental_checker.
2816 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2818 (class Incremental_inputs_header): New class.
2819 (Incremental_inputs_header_writer): Edit comment.
2820 (Incremental_inputs_entry): New class.
2821 (Incremental_inputs_entry_writer): Edit comment.
2822 (Sized_incremental_binary::do_find_incremental_inputs_section):
2823 Add *strtab_shndx parameter, fill it.
2824 (Sized_incremental_binary::do_check_inputs): New method.
2825 (Incremental_checker::can_incrementally_link_output_file): Use
2826 Sized_incremental_binary::check_inputs.
2827 (Incremental_inputs::report_command_line): Save command line in
2830 (Incremental_binary::find_incremental_inputs_section): New
2832 (Incremental_binary::do_find_incremental_inputs_section): Add
2833 strtab_shndx parameter.
2834 (Incremental_binary::do_check_inputs): New pure virtual method.
2835 (Sized_incremental_binary::do_check_inputs): Declare.
2836 (Incremental_checker::Incremental_checker): Add incremental_inputs
2837 parameter, use it to initialize incremental_inputs_.
2838 (Incremental_checker::incremental_inputs_): New field.
2839 (Incremental_checker::command_line): New method.
2840 (Incremental_checker::inputs): New method.
2841 (Incremental_checker::command_line_): New field.
2843 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2845 * incremental.cc: Include <cstdarg> and "target-select.h".
2846 (vexplain_no_incremental): New function.
2847 (explain_no_incremental): New function.
2848 (Incremental_binary::error): New method.
2849 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2851 (make_sized_incremental_binary): New function.
2852 (open_incremental_binary): New function.
2853 (can_incrementally_link_file): Add checks if output is ELF and has
2855 * incremental.h: Include "elfcpp_file.h" and "output.h".
2856 (Incremental_binary): New class.
2857 (Sized_incremental_binary): New class.
2858 (open_incremental_binary): Declare.
2859 * object.cc (is_elf_object): Use
2860 elfcpp::Elf_recognizer::is_elf_file.
2861 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2862 * output.h (Output_file::filesize): New method.
2864 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2866 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2868 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2869 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2871 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2873 (Arm_relocate_functions::movw_abs_nc): New function.
2874 (Arm_relocate_functions::movt_abs): New function.
2875 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2876 (Arm_relocate_functions::thm_movt_abs): New function.
2877 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2878 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2879 (Scan::global): Likewise.
2880 (Relocate::relocate): Likewise.
2881 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2883 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2885 * arm.cc (Arm_relocate_functions::got_prel) New function.
2886 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2887 (Relocate::relocate): Likewise.
2888 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2890 2009-10-06 Ian Lance Taylor <iant@google.com>
2892 * options.h (class General_options): Define
2893 split_stack_adjust_size parameter.
2894 * object.h (class Object): Add uses_split_stack_ and
2895 has_no_split_stack_ fields. Add uses_split_stack and
2896 has_no_split_stack accessor functions. Declare
2897 handle_split_stack_section.
2898 (class Reloc_symbol_changes): Define.
2899 (class Sized_relobj): Define Function_offsets. Declare
2900 split_stack_adjust, split_stack_adjust_reltype, and
2902 * object.cc (Object::handle_split_stack_section): New function.
2903 (Sized_relobj::do_layout): Call handle_split_stack_section.
2904 * dynobj.cc (Sized_dynobj::do_layout): Call
2905 handle_split_stack_section.
2906 * reloc.cc (Sized_relobj::relocate_sections): Call
2907 split_stack_adjust for executable sections in split_stack
2908 objects. Pass reloc_map to relocate_section.
2909 (Sized_relobj::split_stack_adjust): New function.
2910 (Sized_relobj::split_stack_adjust_reltype): New function.
2911 (Sized_relobj::find_functions): New function.
2912 * target-reloc.h: Include "object.h".
2913 (relocate_section): Add reloc_symbol_changes parameter. Change
2915 * target.h (class Target): Add calls_non_split method. Declare
2916 do_calls_non_split virtual method. Declare match_view and
2918 * target.cc: Include "elfcpp.h".
2919 (Target::do_calls_non_split): New function.
2920 (Target::match_view): New function.
2921 (Target::set_view_to_nop): New function.
2922 * gold.cc (queue_middle_tasks): Give an error if mixing
2923 split-stack and non-split-stack objects with -r.
2924 * i386.cc (Target_i386::relocate_section): Add
2925 reloc_symbol_changes parameter.
2926 (Target_i386::do_calls_non_split): New function.
2927 * x86_64.cc (Target_x86_64::relocate_section): Add
2928 reloc_symbol_changes parameter.
2929 (Target_x86_64::do_calls_non_split): New function.
2930 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2932 * powerpc.cc (Target_powerpc::relocate_section): Add
2933 reloc_symbol_changes parameter.
2934 * sparc.cc (Target_sparc::relocate_section): Add
2935 reloc_symbol_changes parameter.
2936 * configure.ac: Call AM_CONDITIONAL for the default target.
2937 * configure: Rebuild.
2938 * testsuite/Makefile.am (TEST_AS): New variable.
2939 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2940 (check_DATA): Add split_i386 and split_x86_64 files.
2941 (SPLIT_DEFSYMS): Define.
2942 (split_i386_[1234n].o): New targets.
2943 (split_i386_[124]): New targets.
2944 (split_i386_[1234r].stdout): New targets.
2945 (split_x86_64_[1234n].o): New targets.
2946 (split_x86_64_[124]): New targets.
2947 (split_x86_64_[1234r].stdout): New targets.
2948 (MOSTLYCLEANFILES): Add new executables.
2949 * testsuite/split_i386.sh: New file.
2950 * testsuite/split_x86_64.sh: New file.
2951 * testsuite/split_i386_1.s: New file.
2952 * testsuite/split_i386_2.s: New file.
2953 * testsuite/split_i386_3.s: New file.
2954 * testsuite/split_i386_4.s: New file.
2955 * testsuite/split_i386_n.s: New file.
2956 * testsuite/split_x86_64_1.s: New file.
2957 * testsuite/split_x86_64_2.s: New file.
2958 * testsuite/split_x86_64_3.s: New file.
2959 * testsuite/split_x86_64_4.s: New file.
2960 * testsuite/split_x86_64_n.s: New file.
2961 * testsuite/testfile.cc (Target_test): Update relocation_section
2963 * testsuite/Makefile.in: Rebuild.
2965 2009-10-06 Ian Lance Taylor <iant@google.com>
2967 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2968 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2969 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2970 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2971 the address on ldo_addrs_.
2972 (Target_i386::Relocate::fix_up_ldo): New function.
2974 2009-10-06 Rafael Espindola <espindola@google.com>
2976 * plugin.cc (add_input_library): New.
2977 (Plugin::load): Add add_input_library to tv.
2978 (Plugin_manager::add_input_file): Add the is_lib argument.
2979 (add_input_file): Update call to Plugin_manager::add_input_file.
2980 (add_input_library): New.
2981 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2983 2009-09-30 Doug Kwan <dougkwan@google.com>
2985 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2986 symbol and call Symbol::may_need_copy_reloc to determine if
2987 a copy reloc is needed.
2988 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2989 nocopyreloc is given in command line.
2990 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2991 given in command line.
2992 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2993 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2994 of the removed Target_i386::may_need_copy_reloc.
2995 * options.h (copyreloc): New option with default value false.
2996 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2997 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2998 instead of the removed Target_powerpc::may_need_copy_reloc.
2999 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
3000 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
3001 instead of the removed Target_sparc::may_need_copy_reloc.
3002 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
3003 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
3004 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
3005 instead of the removed Target_x86_64::may_need_copy_reloc.
3007 2009-09-30 Ian Lance Taylor <iant@google.com>
3009 * object.h (class Object): Remove target_ field, and target,
3010 sized_target, and set_target methods.
3011 (Object::sized_target): Remove.
3012 (class Sized_relobj): Update declarations. Remove sized_target.
3013 * object.cc (Sized_relobj::setup): Remove target parameter.
3015 (Input_objects::add_object): Don't do anything with the target.
3016 (make_elf_sized_object): Add punconfigured parameter. Change all
3017 callers. Set or test parameter target.
3018 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
3020 * parameters.cc (Parameters::set_target): Change parameter type to
3022 (Parameters::default_target): Remove.
3023 (set_parameters_target): Change parameter type to be non-const.
3024 (parameters_force_valid_target): New function.
3025 (parameters_clear_target): New function.
3026 * parameters.h (class Parameters): Update declarations. Remove
3027 default_target method. Add sized_target and clear_target
3028 methods. Change target_ to be non-const.
3029 (set_parameters_target): Update declaration.
3030 (parameters_force_valid_target): Declare.
3031 (parameters_clear_target): Declare.
3032 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
3033 as NULL if we aren't searching.
3034 (Add_symbols::run): Don't check for compatible target.
3035 * fileread.cc (Input_file::open_binary): Call
3036 parameters_force_valid_target.
3037 * gold.cc (queue_middle_tasks): Likewise.
3038 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
3039 set_target on object.
3040 * dynobj.h (class Sized_dynobj): Update declarations.
3041 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
3042 make_elf_object returns NULL.
3043 (Archive::include_member): Don't check whether object target is
3045 * output.cc (Output_section::add_input_section): Get target from
3047 (Output_section::relax_input_section): Likewise.
3048 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
3050 (Sized_relobj::do_scan_relocs): Likewise.
3051 (Sized_relobj::relocate_sections): Likewise.
3052 * resolve.cc (Symbol_table::resolve): Likewise.
3053 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
3054 parameter. Change all callers.
3055 (Symbol_table::add_from_object): Get target from parameters.
3056 (Symbol_table::add_from_relobj): Don't check object target.
3057 (Symbol_table::add_from_dynobj): Likewise.
3058 (Symbol_table::define_special_symbol): Get target from
3060 * symtab.h (class Symbol_table): Update declaration.
3061 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
3062 parameter. Change all callers. Clear parameter target.
3063 (Binary_test): Test target here.
3064 * testsuite/object_unittest.cc (gold_testsuite): Remove
3065 target_test_pointer parameter. Change all callers.
3066 (Object_test): Test target here.
3068 2009-09-26 Ian Lance Taylor <iant@google.com>
3070 * testsuite/initpri1.c: Don't try to use constructor priorities if
3071 compiling with gcc before 4.3.
3073 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
3075 * testsuite/retain_symbols_file_test.sh (check_present): Change
3076 output file name to retain_symbols_file_test.stdout.
3077 (check_absent): Likewise.
3079 2009-09-18 Craig Silverstein <csilvers@google.com>
3081 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
3082 * options.cc: Include <cerrno> and <fstream>.
3083 (General_options::finalize): Parse -retain-symbols-file tag.
3084 * options.h: New flag.
3085 (General_options): New method should_retain_symbol, new
3086 variable symbols_to_retain.
3087 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
3088 should_retain_symbol map.
3089 * testsuite/Makefile.am (retain_symbols_file_test): New test.
3090 * testsuite/Makefile.in: Regenerate.
3091 * testsuite/retain_symbols_file_test.sh: New file.
3093 2009-09-18 Nick Clifton <nickc@redhat.com>
3095 * po/es.po: Updated Spanish translation.
3097 2009-09-17 Doug Kwan <dougkwan@google.com>
3099 * debug.h (DEBUG_RELAXATION): New constant.
3100 (DEBUG_ALL): Add DEBUG_RELAXATION.
3101 (debug_string_to_enum): Add relaxation debug option.
3103 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
3104 Layout::Relaxation_debug_check::read_sections,
3105 Layout::Relaxation_debug_check::read_sections): New method definitions.
3106 (Layout::Layout): Initialize data members
3107 record_output_section_data_from_scrips_,
3108 script_output_section_data_list_ and relaxation_debug_check_.
3109 (Layout::save_segments, Layout::restore_segments,
3110 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3111 Layout::relaxation_loop_body): New method definitions.
3112 (Layout::finalize): Support relaxation. Move section layout code to
3113 Layout::relaxation_loop_body.
3114 (Layout::set_asection_address_from_script): Move code for orphan
3115 section placement out.
3116 (Layout::place_orphan_sections_in_script): New method definition.
3117 * layout.h (Output_segment_headers, Output_file_header):
3118 New forward class declarations.
3119 (Layout::~Layout): Define.
3120 (Layout::new_output_section_data_from_script): New method definition.
3121 (Layout::place_orphan_sections_in_script): New method declaration.
3122 (Layout::Segment_states): New type declaration.
3123 (Layout::save_segments, Layout::restore_segments,
3124 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3125 Layout::relaxation_loop_body): New method declarations.
3126 (Layout::Output_section_data_list): New type declaration.
3127 (Layout::Relaxation_debug_check): New class definition.
3128 (Layout::record_output_section_data_from_script_,
3129 Layout::script_output_section_data_list_, Layout::segment_states_,
3130 Layout::relaxation_debug_check_): New data members.
3131 * output.cc: (Output_section_headers::do_size): New method definition.
3132 (Output_section_headers::Output_section_headers): Move size
3133 computation to Output_section_headers::do_size.
3134 (Output_segment_headers::do_size): New method definition.
3135 (Output_file_header::Output_file_header): Move size computation to
3136 Output_file_header::do_size and call it.
3137 (Output_file_header::do_size): New method definition.
3138 (Output_data_group::Output_data_group): Adjust call to
3139 Output_section_data.
3140 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
3141 (Output_symtab_xindex::do_write): Add array bound check.
3142 (Output_section::Input_section::print_to_mapfile): Handle
3143 RELAXED_INPUT_SECTION_CODE.
3144 (Output_section::Output_section): Initialize data member checkpoint_.
3145 (Output_section::~Output_section): Delete checkpoint object pointed
3147 (Output_section::add_input_section): Always add an Input_section if
3149 (Output_section::add_merge_input_section): Add assert.
3150 (Output_section::relax_input_section): New method definition.
3151 (Output_section::set_final_data_size): Set load address to zero for
3152 an unallocated section.
3153 (Output_section::do_address_and_file_offset_have_reset_values):
3154 New method definition.
3155 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
3156 Handle relaxed input section.
3157 (Output_section::sort_attached_input_sections): Checkpoint input
3158 section list lazily.
3159 (Output_section::get_input_sections): Change type of input_sections to
3160 list of Simple_input_section pointers. Checkpoint input section list
3161 lazily. Also handle relaxed input sections.
3162 (Output_section::add_input_section_for_script): Take a reference to
3163 a Simple_input_section object instead of Relobj pointer and section
3164 index as parameter. Handle relaxed input sections.
3165 (Output_section::save_states, Output_section::restore_states): New
3167 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
3168 (Output_data::is_data_size_fixed): New method definition.
3169 (Output_data::reset_addresss_and_file_offset): Do not reset data size
3171 (Output_data::address_and_file_offset_have_reset_values): New method
3173 (Output_data::do_address_and_file_offset_have_reset_values): New method
3175 (Output_data::set_data_size): Check that data size is not fixed.
3176 (Output_data::fix_data_size): New method definition.
3177 (Output_data::is_data_size_fixed_): New data member.
3178 (Output_section_headers::set_final_data_size): New method definition.
3179 (Output_section_headers::do_size): New method declaration.
3180 (Output_segment_headers::set_final_data_size): New method definition.
3181 (Output_segment_headers::do_size): New method declaration.
3182 (Output_file_header::set_final_data_size)::New method definition.
3183 (Output_file_header::do_size)::New method declaration.
3184 (Output_section_data::Output_section_data): Add new parameter
3185 is_data_size_fixed and use it to fix data size.
3186 (Output_data_const::Output_data_const): Adjust call to base class
3187 constructor and fix data size.
3188 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
3189 base class constructor and fix data size.
3190 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
3191 base class constructor and fix data size.
3192 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
3193 class constructor and fix data size.
3194 (Output_data_group::set_final_data_size): New method definition.
3195 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
3196 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
3197 class constructor and fix data size.
3198 (Output_relaxed_input_section): New class definition.
3199 (Output_section::Simple_input_section): New class definition.
3200 (Output_section::get_input_sections): Adjust parameter list.
3201 (Output_section::add_input_section_for_script): Same.
3202 (Output_section::save_states, Output_section::restore_states,
3203 Output_section::do_address_and_file_offset_have_reset_values,
3204 (Output_section::Input_section::Input_section): Handle
3205 RELAXED_INPUT_SECTION_CODE. Add new overload for
3206 Output_relaxed_input_section.
3207 (Output_section::Input_section::is_input_section,
3208 Output_section::Input_section::set_output_section): Handle relaxed
3210 (Output_section::Input_section::is_relaxed_input_section,
3211 Output_section::Input_section::output_section_data,
3212 Output_section::Input_section::relaxed_input_section): New method
3214 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
3216 (Output_section::Input_section::u1_): Update comments.
3217 (Output_section::Input_section::u2_): Add new union member poris.
3218 (Output_section::Checkpoint_output_section): New classs definition.
3219 (Output_section::relax_input_section): New method declaration.
3220 (Output_section::checkpoint_): New data member.
3221 (Output_segment): Update comments.
3222 (Output_segment::Output_segment): Un-privatize copy constructor.
3223 (Output_segment::operator=): Un-privatize.
3224 * script-sections.cc (Output_section_element::Input_section_list):
3225 Change element type to Output_section::Simple_input_section.
3226 (Output_section_element_dot_assignment::set_section_addresses):
3227 Register output section data for relaxation clean up.
3228 (Output_data_exression::Output_data_expression): Adjust call to base
3229 constructor to fix data size.
3230 (Output_section_element_data::set_section_addresses): Register
3231 Output_data_expression object for relaxation clean up.
3232 (struct Input_section_info): Replace Relobj pointer and section index
3233 pair with Output_section::Simple_input_section and Convert struct to a
3235 (Input_section_sorter::operator()): Adjust access to
3236 Input_section_info data member to use accessors.
3237 (Output_section_element_input::set_section_addresses): Use layout
3238 parameter. Adjust code to use Output_section::Simple_input_section
3239 and Input_secction_info classes. Register filler for relaxation
3241 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
3242 and section index pair with Output_section::Simple_input_section
3243 class. Adjust code accordingly.
3244 (Phdrs_element::release_segment): New method definition.
3245 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
3247 (Script_sections::release_segments): New method definition.
3248 * gold/script-sections.h (Script_sections::release_segments): New
3250 * gold/target.h (Target::may_relax, Target::relax,
3251 Target::do_may_relax, Target::do_relax): New method definitions.
3253 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3255 * arm.cc (has_signed_unsigned_overflow): New function.
3256 (Arm_relocate_functions::abs8): New function.
3257 (Target_arm::Scan::local): Handle R_ARM_ABS8.
3258 (Target_arm::Scan::global): Likewise.
3259 (Target_arm::relocate::relocate): Likewise.
3260 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3263 2009-09-16 Cary Coutant <ccoutant@google.com>
3265 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
3266 * testsuite/Makefile.in: Regenerate.
3268 2009-09-11 Nick Clifton <nickc@redhat.com>
3270 * po/gold.pot: Updated by the Translation project.
3272 2009-09-08 Cary Coutant <ccoutant@google.com>
3274 * output.cc (Output_file::open): Add execute permission to empty file.
3275 * testsuite/Makefile.am (permission_test): New test.
3276 * testsuite/Makefile.in: Regenerate.
3278 2009-09-02 Ian Lance Taylor <iant@google.com>
3280 * output.cc (Output_file::resize): Call map_no_anonymous rather
3283 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
3285 * gold.cc: Include "incremental.h".
3286 (queue_initial_tasks): Call Incremental_checker methods.
3287 * incremental.cc: Include "output.h".
3288 (Incremental_checker::can_incrementally_link_output_file): New
3290 * incremental.h (Incremental_checker): New class.
3292 * output.cc (Output_file::open_for_modification): New method.
3293 (Output_file::map_anonymous): Changed return type to bool. Record
3295 (Output_file::map_no_anonymous): New method, broken out of map.
3296 (Output_file::map): Use map_no_anonymous and map_anonymous.
3297 * output.h (class Output_file): Update declarations.
3299 2009-08-24 Cary Coutant <ccoutant@google.com>
3301 * options.h (Command_line::Pre_options): New class.
3302 (Command_line::pre_options): New member.
3303 * options.cc (gold::options::ready_to_register): New variable.
3304 (One_option::register_option): Do nothing if not registering options.
3305 Assert if same short option registered twice.
3306 (General_options::General_options): Turn off option registration when
3308 (Command_line::Pre_options::Pre_options): New constructor.
3310 2009-08-24 Cary Coutant <ccoutant@google.com>
3312 * options.h (General_options::no_keep_memory): Remove incorrect
3315 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3317 * Makefile.am (am__skiplex, am__skipyacc): New.
3318 * Makefile.in: Regenerate.
3320 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3322 * Makefile.am (AM_CPPFLAGS): Renamed from ...
3323 (INCLUDES): ... this.
3324 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
3325 (AM_CPPFLAGS): Renamed from ...
3326 (INCLUDE): ... this.
3327 * Makefile.in, testsuite/Makefile.in: Regenerate.
3329 * Makefile.in: Regenerate.
3330 * aclocal.m4: Likewise.
3331 * config.in: Likewise.
3332 * configure: Likewise.
3333 * testsuite/Makefile.in: Likewise.
3335 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3336 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
3337 * Makefile.in: Regenerate.
3338 * testsuite/Makefile.in: Regenerate.
3340 2009-08-19 Cary Coutant <ccoutant@google.com>
3342 * resolve.cc (Symbol_table::resolve): Don't complain about defined
3343 symbols in shared libraries overridden by hidden or internal symbols
3344 in the main program.
3346 2009-08-19 Chris Demetriou <cgd@google.com>
3348 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
3349 checking source file names in error messages.
3351 2009-08-18 Doug Kwan <dougkwan@google.com>
3353 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
3354 an elcpp::Ehdr as parameter. Adjust call to set_target.
3355 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
3356 an elfcpp::Ehdr as parameter.
3357 * object.cc (Object::set_target): Remove the version that looks up
3358 a target and sets it.
3359 (Sized_relobj::setup): Take a Target object instead of
3360 an elfcpp::Ehdr as parameter. Adjust call to set_target.
3361 (make_elf_sized_object): Find target and ask target to
3363 * object.h: (Object::set_target): Remove the version that looks up
3364 a target and sets it.
3365 (Sized_relobj::setup): Take a Target object instead of
3366 an elfcpp:Ehdr as parameter.
3367 * target.cc: Include dynobj.h.
3368 (Target::do_make_elf_object_implementation): New.
3369 (Target::do_make_elf_object): New.
3370 * target.h (Target::make_elf_object): New template declaration.
3371 (Target::do_make_elf_object): New method declarations.
3372 (Target::do_make_elf_object_implementation): New template declaration.
3374 2009-08-14 Ian Lance Taylor <iant@google.com>
3376 * gold.h (FUNCTION_NAME): Define.
3377 (gold_unreachable): Use FUNCTION_NAME.
3379 2009-08-12 Sriraman Tallam <tmsriram@google.com>
3381 * icf.cc (Icf::find_identical_sections): Issue a warning when a
3382 symbol in the --keep-unique list is not found.
3384 2009-08-12 Sriraman Tallam <tmsriram@google.com>
3386 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
3387 been maked as --keep-unique.
3388 (Icf::unfold_section): New function.
3389 * icf.h (Icf::unfold_section): New function.
3390 * options.h (General_options::keep_unique): New option.
3391 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
3392 * testsuite/Makefile.in: Regenerate.
3393 * testsuite/icf_keep_unique_test.sh: New file.
3394 * testsuite/icf_keep_unique_test.cc: New file.
3396 2009-08-12 Cary Coutant <ccoutant@google.com>
3399 * resolve.cc (Symbol_table::resolve): Check for references from
3400 dynamic objects to hidden and internal symbols.
3401 * testsuite/Makefile.am (hidden_test.sh): New test.
3402 * testsuite/Makefile.in: Regenerate.
3403 * testsuite/hidden_test.sh: New script.
3404 * testsuite/hidden_test_1.c: New test source.
3405 * testsuite/hidden_test_main.c: New test source.
3407 2009-08-11 Doug Kwan <dougkwan@google.com>
3409 * arm.cc: Update comments.
3410 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
3411 segment to locate the .ARM.exidx section if present.
3413 2009-08-09 Doug Kwan <dougkwan@google.com>
3415 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
3418 2009-08-07 Sriraman Tallam <tmsriram@google.com>
3419 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
3422 2009-08-06 Sriraman Tallam <tmsriram@google.com>
3424 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
3425 valid tls_segment only for non-debug-section relocations.
3426 * testsuite/Makefile.am: Add gc_tls_test.
3427 * testsuite/Makefile.in: Regenerate.
3428 * testsuite/gc_tls_test.cc: New file.
3429 * testsuite/gc_tls_test.sh: New file.
3431 2009-08-05 Sriraman Tallam <tmsriram@google.com>
3435 * Makefile.am (CCFILES): Add icf.cc.
3437 * Makefile.in: Regenerate.
3438 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
3439 * gc.h (gc_process_relocs): Populate lists used by icf to contain
3440 section, symbol and addend information for the relocs.
3441 * gold.cc (queue_middle_tasks): Call identical code folding.
3442 * gold.h: Add defines for multimap.
3443 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
3444 to the call of finalize_local_symbols.
3445 * main.cc (main): Create object of class Icf.
3446 * object.cc (Sized_relobj::do_layout): Allow this function to be
3447 called twice during icf.
3448 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
3449 to sections marked as identical by icf.
3450 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
3452 (Sized_relobj::do_section_entsize): New function.
3453 * object.h (Object::section_entsize): New function.
3454 (Object::do_section_entsize): New pure virtual function.
3455 (Relobj::finalize_local_symbols): Add new parameter.
3456 (Relobj::do_section_entsize): New function.
3457 * options.h (General_options::icf): New option.
3458 (General_options::icf_iterations): New option.
3459 (General_options::print_icf_sections): New option.
3460 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
3461 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
3462 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
3464 * symtab.cc (Symbol_table::is_section_folded): New function.
3465 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
3466 to sections marked as identical by icf.
3467 * symtab.h (Symbol_table::set_icf): New function.
3468 (Symbol_table::icf): New function.
3469 (Symbol_table::is_section_folded): New function.
3470 (Symbol_table::icf_): New data member.
3471 * target-reloc.h (relocate_section): Ignore sections folded by icf.
3472 * testsuite/Makefile.am: Add commands to build icf_test.
3473 * testsuite/Makefile.in: Regenerate.
3474 * testsuite/icf_test.sh: New file.
3475 * testsuite/icf_test.cc: New file.
3477 2009-07-24 Chris Demetriou <cgd@google.com>
3479 * layout.cc (is_compressible_debug_section): Fix incorrect
3480 comment about compressed section names.
3482 2009-07-20 Ian Lance Taylor <ian@airs.com>
3485 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
3487 2009-07-16 Ian Lance Taylor <iant@google.com>
3490 * layout.h: #include <map>.
3491 (class Kept_section): Change from struct to class. Add accessors
3492 and setters. Add section size to Comdat_group mapping. Change
3493 Comdat_group to std::map. Add is_comdat_ field. Add
3494 linkonce_size field in union.
3495 (class Layout): Update declaration of find_or_add_kept_section.
3496 Don't declare find_kept_object.
3497 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
3498 parameter. Add object, shndx, is_comdat, and is_group_name
3499 parameters. Change all callers. Adjust for new Kept_section.
3500 (Layout::find_kept_object): Remove.
3501 * object.cc (Sized_relobj::include_section_group): Update use of
3502 Kept_section. Rename secnum to shndx. Only record
3503 Kept_comdat_section if sections are the same size.
3504 (Sized_relobj::include_linkonce_section): Update use of
3505 Kept_section. Only record Kept_comdat_section if sections are the
3506 same size. Set size of linkonce section.
3507 (Sized_relobj::map_to_kept_section): Update call to
3508 get_kept_comdat_section.
3509 * object.h (class Sized_relobj): Rename fields in
3510 Kept_comdat_section to drop trailing underscores; change object
3511 field to Relobj*. Change Kept_comdat_section_table to store
3512 struct rather than pointer.
3513 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
3514 Add kept_object and kept_shndx parameters. Change all callers.
3515 (Sized_relobj::get_kept_comdat_section): Change return type to
3516 bool. Add kept_object and kept_shndx parameters. Change all
3518 * plugin.cc (Pluginobj::include_comdat_group): Update call to
3519 Layout::find_or_add_kept_section.
3521 2009-07-09 Ian Lance Taylor <iant@google.com>
3523 * merge.cc (Object_merge_map::initialize_input_to_output_map):
3524 Reserve space in the hash table.
3526 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
3528 * fileread.cc (File_read::get_mtime): New method.
3529 * fileread.h (Timespec): New structure.
3530 (File_read::get_mtime): New method.
3531 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
3532 Renamed from timestamp_nsec.
3533 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
3535 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
3537 (Incremental_inputs::report_archive): Save mtime; style fix.
3538 (Incremental_inputs::report_obejct): Save mtime; style fix.
3539 (Incremental_inputs::report_script): Save mtime; style fix.
3540 (Incremental_inputs::finalize_inputs): Style fix.
3541 (Incremental_inputs::finalize): Style fix.
3542 (Incremental_inputs::create_input_section_data): Store inputs
3544 * incremental.h (Incremental_inputs::report_script): Add mtime
3546 (Incremental_inputs::Input_info::Input_info): Intialize only one
3548 (Incremental_inputs::Input_info::archive): Move to nameless
3550 (Incremental_inputs::Input_info::obejct): Move to nameless union.
3551 (Incremental_inputs::Input_info::script): Move to nameless union.
3552 (Incremental_inputs::mtime): New field.
3553 * script.cc (read_input_script): Pass file mtime to
3555 * script.h (Script_info::inputs): Style fix.
3557 2009-07-01 Ian Lance Taylor <ian@airs.com>
3559 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
3562 2009-06-24 Ian Lance Taylor <iant@google.com>
3565 * layout.cc (Layout::choose_output_section): If we find an
3566 existing section, update the flags.
3567 (Layout::create_notes): New function, broken out of
3569 (Layout::finalize): Don't create note sections.
3570 (Layout::create_note): Don't crash if linker script discards
3572 (Layout::create_gold_note): Likewise.
3573 (Layout::create_build_id): Likewise. Don't set
3574 after_input_sections on the section.
3575 (Layout::create_executable_stack_info): Remove target parameter.
3577 * layout.h (class Layout): Declare create_notes. Update
3578 declaration of create_executable_stack_info.
3579 * gold.cc (queue_middle_tasks): Call create_notes.
3580 * output.cc (Output_section::update_flags_for_input_section): Move
3581 here from output.h. If SHF_ALLOC flag is newly set, mark address
3583 * output.h (Output_data::mark_address_invalid): New function.
3584 (class Output_section): Only declare, not define,
3585 update_flags_for_input_section. Remove set_flags.
3587 2009-06-24 Ian Lance Taylor <iant@google.com>
3589 * script-sections.cc (Output_section_definition::
3590 set_section_addresses): Rename shadowing local load_address to
3593 2009-06-24 Ian Lance Taylor <iant@google.com>
3596 * reloc.cc (relocate_sections): Skip empty relocation sections.
3598 2009-06-23 Ian Lance Taylor <iant@google.com>
3601 * layout.cc (Layout::create_note): Use choose_output_section
3602 rather than make_output_section.
3604 2009-06-23 Ian Lance Taylor <iant@google.com>
3607 * options.cc (General_options::parse_V): Set printed_version_.
3608 (General_options::General_options): Initialize printed_version_.
3609 * options.h (class General_options): Add printed_version_ field.
3610 * gold.cc (queue_initial_tasks): If there are no input files,
3611 don't give a fatal error if we printed the version information.
3612 (queue_middle_tasks): If using -r with a shared object, give a
3613 fatal error rather than an ordinary error.
3615 2009-06-23 Ian Lance Taylor <iant@google.com>
3618 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
3619 (Layout::make_output_section): Set have_stabstr_section_ if we see
3620 a .stab*str section.
3621 (Layout::finalize): Call link_stabs_sections.
3622 (Layout::link_stabs_sections): New file.
3623 * layout.h (class Layout): Add have_stabstr_section_ field.
3624 Declare link_stabs_sections.
3626 2009-06-23 Doug Kwan <dougkwan@google.com>
3628 * Makefile.am (libgold_a_LIBADD): New.
3629 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
3630 * Makefile.in: Regenerate.
3631 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
3632 * configure: Regenerate.
3633 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
3634 * fileread.cc: Include sys/state.h
3635 * gold.h: Declare memmem and strndup if found missing.
3636 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
3638 2009-06-23 Ian Lance Taylor <iant@google.com>
3640 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
3641 * configure: Rebuild.
3643 2009-06-23 Ian Lance Taylor <iant@google.com>
3646 * object.cc (Object::section_contents): Don't try to get a view if
3647 the section has length zero.
3648 (Object::handle_gnu_warning_section): If the section is empty, use
3649 the name of the section as the warning.
3651 2009-06-23 Ian Lance Taylor <iant@google.com>
3654 * stringpool.h (class Stringpool_template): Add optimize_ field.
3655 (Stringpool_template::set_optimize): New function.
3656 * stringpool.cc (Stringpool_template::Stringpool_template):
3657 Initialize optimize_ field.
3658 (Stringpool_template::set_string_offsets): Test local optimize
3659 fild rather than parameter.
3660 * layout.cc (Layout::Layout): Call set_optimize on the section
3663 2009-06-22 Ian Lance Taylor <iant@google.com>
3666 * yyscript.y: Parse TARGET.
3667 * script.cc (script_set_target): New function.
3668 * script-c.h (script_set_target): Declare.
3669 * options.cc (General_options::string_to_object_format): Rename
3670 from string_to_object_format in anonymous namespace. Change
3672 * options.h (class General_options): Declare
3673 string_to_object_format.
3675 2009-06-22 Ian Lance Taylor <iant@google.com>
3677 * script-sections.cc (Script_sections::create_segments): Don't put
3678 program headers in a PT_LOAD segment if -n or -N.
3680 2009-06-22 Ian Lance Taylor <iant@google.com>
3683 * options.h (class General_options): Add -z lazy and -z now. Sort
3684 -z options into alphabetical order.
3685 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
3687 2009-06-21 Ian Lance Taylor <iant@google.com>
3689 * layout.cc (Layout::make_output_section): Call
3690 Target::new_output_section.
3691 (Layout::attach_allocated_section_to_segment): Put large section
3692 sections in a separate load segment with the large segment flag
3694 (Layout::segment_precedes): Sort large data segments after other
3696 (align_file_offset): New static function.
3697 (Layout::set_segment_offsets): Use align_file_offset.
3698 * output.h (class Output_section): Add is_small_section_ and
3699 is_large_section_ fields.
3700 (Output_section::is_small_section): New function.
3701 (Output_section::set_is_small_section): New function.
3702 (Output_section::is_large_section): New function.
3703 (Output_section::set_is_large_section): New function.
3704 (Output_section::is_large_data_section): New function.
3705 (class Output_segment): Add is_large_data_segment_ field.
3706 (Output_segment::is_large_data_segment): New function.
3707 (Output_segment::set_is_large_data_segment): New function.
3708 * output.cc (Output_section::Output_section): Initialize new
3710 (Output_segment::Output_segment): Likewise.
3711 (Output_segment::add_output_section): Add assertion that large
3712 data sections always go in large data segments. Force small data
3713 sections to the end of the list of data sections. Force small BSS
3714 sections to the start of the list of BSS sections. For large BSS
3715 sections to the end of the list of BSS sections.
3716 * symtab.h (class Symbol): Declare is_common_shndx.
3717 (Symbol::is_defined): Check Symbol::is_common_shndx.
3718 (Symbol::is_common): Likewise.
3719 (class Symbol_table): Define enum Commons_section_type. Update
3720 declarations. Add small_commons_ and large_commons_ fields.
3721 * symtab.cc (Symbol::is_common_shndx): New function.
3722 (Symbol_table::Symbol_table): Initialize new fields.
3723 (Symbol_table::add_from_object): Put small and large common
3724 symbols in the right list.
3725 (Symbol_table::sized_finalized_symbol): Check
3726 Symbol::is_common_shndx.
3727 (Symbol_table::sized_write_globals): Likewise.
3728 * common.cc (Symbol_table::do_allocate_commons): Allocate new
3729 common symbol lists. Don't call do_allocate_commons_list if the
3731 (Symbol_table::do_allocate_commons_list): Remove is_tls
3732 parameter. Add comons_section_type parameter. Change all
3733 callers. Handle small and large common symbols.
3734 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
3735 Symbol::is_common_shndx.
3736 * resolve.cc (symbol_to_bits): Likewise.
3737 * target.h (Target::small_common_shndx): New function.
3738 (Target::small_common_section_flags): New function.
3739 (Target::large_common_shndx): New function.
3740 (Target::large_common_section_flags): New function.
3741 (Target::new_output_section): New function.
3742 (Target::Target_info): Add small_common_shndx, large_common_shndx,
3743 small_common_section_flags, and large_common_section_flags
3745 (Target::do_new_output_section): New virtual function.
3746 * arm.cc (Target_arm::arm_info): Initialize new fields.
3747 * i386.cc (Target_i386::i386_info): Likewise.
3748 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3750 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
3751 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3752 (Target_x86_64::do_new_output_section): New function.
3753 * configure.ac: Define conditional MCMODEL_MEDIUM.
3754 * testsuite/Makefile.am (check_PROGRAMS): Add large.
3755 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
3756 (large_LDFLAGS): Define.
3757 * testsuite/large.c: New file.
3758 * testsuite/testfile.cc (Target_test::test_target_info):
3759 Initialize new fields.
3760 * configure, testsuite/Makefile.in: Rebuild.
3762 2009-06-05 Doug Kwan <dougkwan@google.com>
3764 * Makefile.am (CCFILES): Add target.cc.
3765 * Makefile.in: Regenerate.
3766 * i386.cc (class Target_i386): Define new virtual method to
3767 override do_is_local_label_name in parent.
3768 * object.cc (Sized_relobj::do_count_local_symbols): Discard
3769 local symbols if --discard-locals or -X is given.
3770 * options.h (class General_options): Declare new options
3771 '--discard-locals' and '-X' for discarding locals.
3772 * target.h (class Target): Define new methods is_local_label_name.
3773 Declare new virtual method do_is_local_label_name.
3774 * target.cc: New file.
3775 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
3776 (check_SCRIPTS): Add discard_locals_test.sh.
3777 (check_DATA): Add discard_local_tests.syms.
3778 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
3779 (discard_local_tests.syms, discard_locals_test.o): New make rules.
3780 * testsuite/Makefile.in: Regenerate.
3781 * testsuite/discard_locals_test.c: New file.
3782 * testsuite/discard_locals_test.sh: Same.
3784 2009-06-05 Doug Kwan <dougkwan@google.com>
3786 * object.cc (Sized_relobj::Sized_relobj): Initialize
3787 discarded_eh_frame_shndx_ to -1U.
3788 (Sized_relobj::do_layout): Record index of a discard .eh_frame
3790 (Sized_relobj::do_count_local_symbols): Skip local symbols in
3791 a discarded .eh_frame section.
3792 (Sized_relobj::do_finalize_local_symbols): Ditto.
3793 * object.h (class Sized_relobj): Declare new member
3794 discarded_eh_frame_shndx_.
3795 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
3796 (local_labels_test.o, local_labels_test): New rules.
3797 * testsuite/Makefile.in: Regenerate.
3799 2009-06-04 Doug Kwan <dougkwan@google.com>
3801 * layout.cc (Layout::section_name_mapping): Add mapping for
3802 special ARM sections.
3804 2009-06-03 Doug Kwan <dougkwan@google.com>
3806 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
3807 (utils::has_overflow): Same.
3809 2009-06-03 Ian Lance Taylor <iant@google.com>
3811 * layout.cc (Layout::section_name_mapping): New array, replacing
3812 Layout::linkonce_mapping.
3813 (Layout::section_name_mapping_count): New variable, replacing
3814 Layout::linkonce_mapping_count.
3815 (Layout::linkonce_output_name): Remove.
3816 (Layout::output_section_name): Rewrite.
3817 * layout.h (class Layout): Rename Linkonce_mapping to
3818 Section_name_mapping, linkonce_mapping to section_name_mapping,
3819 linkonce_mapping_count to section_name_mapping_count. Don't
3820 declare linkonce_output_name.
3822 2009-06-03 Doug Kwan <dougkwan@google.com>
3824 * gold/arm.cc (namespace utils): New.
3825 (Target_arm::reloc_is_non_pic): Define new method.
3826 (class Arm_relocate_functions): New.
3827 (Target_arm::Relocate::relocate): Handle relocation types used by
3830 2009-06-03 Ian Lance Taylor <iant@google.com>
3832 * arm.cc (Target_arm::scan::global): Use || instead of |.
3834 2009-06-02 Doug Kwan <dougkwan@google.com>
3836 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3837 issued_non_pic_error_.
3838 (class Target_arm::Scan): Declare new method check_non_pic.
3839 Define new method symbol_needs_plt_entry.
3840 Declare new data member issued_non_pic_error_.
3841 (class Target_arm::Relocate): Declare new method
3842 should_apply_static_reloc.
3843 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3844 (Target_arm::Scan::check_non_pic): Define new method.
3845 (Target_arm::Scan::local): Handle a small subset of reloc types used
3847 (Target_arm::Scan::local): Same.
3848 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3850 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3852 * incremental.cc (Incremental_inputs::report_command_line): Filter
3853 out --incremental-* options.
3855 2009-05-29 Doug Kwan <dougkwan@google.com>
3857 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3859 (class Target_arm): Update comment.
3860 (Target_arm::Target_arm): Initialize new data members GOT_,
3861 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3862 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3863 and Target_arm::rel_dyn_section.
3864 Declare new_enum Target_arm::Got_type.
3865 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3867 Update commments for member do_dynsym_value.
3868 (Target_arm::got_size, Target_arm::plt_section,
3869 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3870 new methods inside class defintion.
3871 (Target_arm::got_section): Define new method.
3872 (Target_arm::rel_dyn_section): Same.
3873 (Output_data_plt_arm): New template class.
3874 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3875 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3876 (Output_data_plt_arm::add_entry): Same.
3877 (Output_data_plt_arm::first_plt_entry): Define new
3878 static data member for PLT instruction template.
3879 (Output_data_plt_arm::plt_entry): Same.
3880 (Output_data_plt_arm::do_write): Define new method.
3881 (Target_arm::make_plt_entry): Same.
3882 (Target_arm::do_finalize_sections): Same.
3883 (Target_arm::do_dynsym_value): Same.
3885 2009-05-28 Doug Kwan <dougkwan@google.com>
3887 * Makefile.am (TARGETSOURCES): Add arm.cc.
3888 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3889 * Makefile.in: Regenerate.
3891 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3893 2009-05-26 Doug Kwan <dougkwan@google.com>
3895 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3896 (General_options::check_excluded_libs): Strip off directories in
3897 archive name before matching like GNU ld does.
3898 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3899 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3900 (exclude_libs_test_LDFLAGS): Add linker option
3901 -Wl,--exclude-libs,libexclude_libs_test_3
3902 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3903 an explicit archive without using -l.
3904 (alt/libexclude_libs_test_3.a): New make rule.
3905 * testsuite/Makefile.in: Regenerate.
3906 * testsuite/exclude_libs_test.c : Declare lib3_default().
3908 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3909 * exclude_libs_test_3.c: New file.
3911 2009-05-26 Nick Clifton <nickc@redhat.com>
3913 * po/id.po: New Indonesian translation.
3914 * po/gold.pot: Updated template file.
3916 2009-05-22 Sriraman Tallam <tmsriram@google.com>
3918 * testsuite/Makefile.am: Add -ffunction-sections to compile
3919 gc_comdat_test files. Add -Wl,--gc-sections to build
3921 * testsuite/Makefile.in: Regenerate.
3922 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3924 2009-05-21 Sriraman Tallam <tmsriram@google.com>
3926 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3927 kept comdat section was garbage collected.
3928 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3929 * testsuite/Makefile.in: Regenerate.
3930 * testsuite/gc_comdat_test.sh: New file.
3931 * testsuite/gc_comdat_test_1.cc: New file.
3932 * testsuite/gc_comdat_test_2.cc: New file.
3934 2009-05-19 Doug Kwan <dougkwan@google.com>
3936 * archive.cc (Archive::Archive): Move constructor from archive.h
3937 to here. Initialize no_export_.
3938 (Archive::get_elf_object_for_member): Set no_export flag of object.
3939 * archive.h (Archive::Archive): Move constructor body to
3941 (Archive::no_export): New method.
3942 (Archive::no_export_): New field.
3943 * object.h (Object::Object): Initialize no_export_ to false.
3944 (Object::no_export, Object::set_no_export): New methods.
3945 (Object::no_export_): New field.
3946 * options.cc (General_options::parse_exclude_libs): New method.
3947 (General_options::check_excluded_libs) Same.
3948 * options.h (exclude_libs): New option.
3949 (General_options::check_excluded_libs): New method declaration.
3950 (General_options::excluded_libs_): New field.
3951 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3952 default or protected visibility if an object has no-export flag set.
3953 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3954 (check_SCRIPTS): Add exclude_libs_test.sh.
3955 (check_DATA): Add exclude_libs_test.syms.
3956 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3957 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3958 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3959 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3960 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3961 libexclude_libs_test_2.a): New rules.
3962 * testsuite/Makefile.in: Regenerate.
3963 * testsuite/exclude_libs_test.c: New file.
3964 * testsuite/exclude_libs_test.sh: Ditto.
3965 * testsuite/exclude_libs_test_1.c: Ditto.
3966 * testsuite/exclude_libs_test_2.c: Ditto.
3968 2009-05-15 Ian Lance Taylor <iant@google.com>
3970 * configure.ac: Check for declarations for cases where libiberty.h
3971 checks HAVE_DECL_xxx.
3972 * configure, config.in: Rebuild.
3974 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3976 * gold.h (Incremental_argument_list): Remove (invalid) forward
3978 * incremental.cc (Incremental_inputs::report_achive): New method.
3979 (Incremental_inputs::report_object): New method.
3980 (Incremental_inputs::report_script): New method.
3981 (Incremental_inputs::finalize_inputs): New method.
3982 (Incremental_inputs::finalize): Call finalize_inputs().
3983 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3984 Create inputs entries.
3985 * incremental.h (Incremental_input_type): New enum.
3986 (Incremental_inputs::Incremental_input): Initialize new fields.
3987 (Incremental_inputs::report_inputs): New method.
3988 (Incremental_inputs::report_achive): New method.
3989 (Incremental_inputs::report_object): New method.
3990 (Incremental_inputs::report_script): New method.
3991 (Incremental_inputs::finalize_inputs): New method.
3992 (Incremental_inputs::Input_info): New struct.
3993 (Incremental_inputs::Input_info_map): New typedef.
3994 (Incremental_inputs::lock_): New field.
3995 (Incremental_inputs::Inputs_): New field.
3996 (Incremental_inputs::Inputs_map): New field.
3997 * main.cc (main): Call Incremental_input::report_inputs.
3998 * options.h (Input_argument_list): Typedef moved from
4000 (Input_file_group::Files): Remove, use ::Input_argument_list.
4001 (Input_file_group::Input_argument_list): Remove, use
4002 ::Input_argument_list.
4003 * plugin.cc (Plugin_manager::add_input_file): Add error in
4005 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
4007 * script.cc (read_input_script): Call
4008 Incremental_input::report_script.
4009 * script.h (Script_info): New class.
4011 2009-04-27 Ian Lance Taylor <iant@google.com>
4013 * x86_64.cc (do_adjust_output_section): Set entsize to
4016 2009-04-23 Elliott Hughes <enh@google.com>
4018 * output.cc (Output_file::close): After short writes, continue
4019 writing from the correct offset in the buffer being written.
4021 2009-04-23 Chris Demetriou <cgd@google.com>
4023 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
4024 * configure: Regenerate.
4025 * config.in: Regenerate.
4026 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
4027 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
4029 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
4031 * incremental.cc (Incremental_inputs_header_data): Renamed from
4032 Incremental_input_header_data.
4033 (Incremental_inputs_header_data::data_size): New field.
4034 (Incremental_inputs_header_data::put_input_file_count): Renamed
4035 from input_file_count.
4036 (Incremental_inputs_header_data::put_command_line_offset): Renamed
4037 from command_line_offset.
4038 (Incremental_inputs_header_data::put_reserved): Renamed from
4040 (Incremental_inputs_entry_data): Renamed from
4041 Incremental_input_entry_data.
4042 (Incremental_inputs_entry_data::data_size): New field.
4043 (Incremental_inputs::report_command_line): New method.
4044 (Incremental_inputs::finalize): New method.
4045 (Incremental_inputs::create_incremental_inputs_data): New method.
4046 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
4047 * incremental.h: New file.
4048 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
4049 (Layout::finalize): Create incremental inputs section in
4051 (Layout::create_incremental_info_sections): New method.
4052 * layout.h (Layout::incremental_inputs): New method.
4053 (Layout::create_incremental_info_sections): New method.
4054 (Layout::incremental_inputs_): New field.
4055 * main.cc (main): Notify Incremental_input of the command line.
4057 2009-04-01 Ian Lance Taylor <iant@google.com>
4058 Mikolaj Zalewski <mikolajz@google.com>
4060 * gold.h (reserve_unordered_map): Define, three versions, one for
4061 each version of Unordered_map.
4062 * layout.cc (Layout::Layout): Remove options parameter. Add
4063 number_of_input_files parameter. Don't initialize options_.
4064 Initialize number_of_input_files_ and resized_signatures_. Move
4065 sections_are_attached_.
4066 (Layout::layout_group): Reserve space for group_signatures_.
4067 (Layout::find_or_add_kept_section): Change name parameter to be a
4068 reference. Resize signatures_ map when it gets large enough.
4069 (Layout::layout_eh_frame): Use parameters->options() instead of
4071 (Layout::make_output_section): Likewise.
4072 (Layout::attach_allocated_section_to_segment): Likewise.
4073 (Layout::finalize, Layout::create_executable_stack): Likewise.
4074 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
4075 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
4076 * layout.h (class Layout): Update declarations. Remove options_
4077 field. Add number_of_input_files_ and resized_signatures_
4078 fields. Move sections_are_attached_ field.
4079 * main.cc (main): Pass number of input files to Layout
4080 constructor. Don't pass options.
4082 2009-03-30 Ian Lance Taylor <iant@google.com>
4084 * ffsll.c (ffsll): Correct implementation.
4086 2009-03-27 Ian Lance Taylor <iant@google.com>
4088 * ffsll.c: New file.
4089 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
4090 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
4091 * ftruncate.c (ftruncate): Declare before definition.
4092 * mremap.c (mremap): Likewise.
4093 * pread.c (pread): Likewise.
4094 * configure, Makefile.in, config.in: Rebuild.
4096 * mremap.c: New file.
4097 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
4098 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
4099 (mremap): Declare if HAVE_MREMAP is not defined.
4100 * configure, Makefile.in, config.in: Rebuild.
4102 2009-03-27 Cary Coutant <ccoutant@google.com>
4104 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
4105 position independent.
4106 * sparc.cc (Target_sparc::check_non_pic): Likewise.
4107 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
4109 2009-03-24 Cary Coutant <ccoutant@google.com>
4111 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
4113 (needs_dynamic_reloc): Likewise.
4115 2009-03-24 Ian Lance Taylor <iant@google.com>
4117 * yyscript.y (file_cmd): Recognize EXTERN.
4118 (extern_name_list, extern_name_list_body): New nonterminals.
4119 * script.cc (script_add_extern): Define.
4120 * script-c.h (script_add_extern): Declare.
4122 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
4124 * object.cc (is_elf_object): Define.
4125 * object.h (is_elf_object): Declare.
4126 * archive.cc (Archive::get_elf_object_for_member): Call
4128 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
4130 2009-03-24 Elliott Hughes <enh@google.com>
4132 * output.cc (Output_file::map_anonymous): Define.
4133 (Output_file::map): Use map_anonymous. If the regular mmap fails,
4134 try an anonymous one. Report the size if the mmap fails.
4135 * output.h (class Output_file): Declare map_anonymous.
4137 2009-03-24 Ian Lance Taylor <iant@google.com>
4139 * target-select.cc (instantiate_target): Don't acquire the lock if
4140 the instantiated_target_ field has already been set.
4142 2009-03-23 Ian Lance Taylor <iant@google.com>
4144 * gold-threads.h (class Initialize_lock): Define.
4145 * gold-threads.cc (class Initialize_lock_once): Define.
4146 (initialize_lock_control): New static variable.
4147 (initialize_lock_pointer): New static variable.
4148 (initialize_lock_once): New static function.
4149 (Initialize_lock::Initialize_lock): Define.
4150 (Initialize_lock::initialize): Define.
4151 * target-select.h: Include "gold-threads.h".
4152 (class Target_selector): Add lock_ and initialize_lock_ fields.
4153 Don't define instantiate_target, just declare it.
4154 * target-select.cc (Target_selector::Target_selector): Initialize
4156 (Target_selector::instantiate_target): Define.
4157 * descriptors.h: Include "gold-threads.h".
4158 (class Descriptors): Add initialize_lock_ field.
4159 * descriptors.cc (Descriptors::Descriptors): Initialize new
4161 (Descriptors::open): Use initialize_lock_ field
4162 * errors.h (class Errors): Add initialize_lock_ field.
4163 * errors.cc (Errors::Errors): Initialize new field.
4164 (Errors::initialize_lock): Use initialize_lock_ field.
4165 * powerpc.cc (class Target_selector_powerpc): Remove
4166 instantiated_target_ field. In do_recognize call
4167 instantiate_target rather than do_instantiate_target. In
4168 do_instantiate_target just allocate a new target.
4169 * sparc.cc (class Target_selector_sparc): Likewise.
4171 * freebsd.h: New file.
4172 * i386.cc: Include "freebsd.h".
4173 (Target_i386): Derive from Target_freebsd rather than
4175 (Target_selector_i386): Derive from Target_selector_freebsd rather
4176 than Target_selector.
4177 * x86_64.cc: Include "freebsd.h".
4178 (Target_x86_64): Derive from Target_freebsd rather than
4180 (Target_selector_x86_64): Derive from Target_selector_freebsd
4181 rather than Target_selector.
4182 * target.h (class Target): Add adjust_elf_header and
4183 do_adjust_elf_header.
4184 * output.cc (Output_file_header:: do_sized_write): Call target
4185 adjust_elf_header routine.
4186 * configure.tgt: Set targ_osabi.
4187 * configure.ac: Define GOLD_DEFAULT_OSABI.
4188 * parameters.cc (Parameters::default_target): Pass
4189 GOLD_DEFAULT_OSABI to select_target.
4190 * target-select.h (class Target_selector): Make instantiate_target
4191 protected rather than private.
4192 * Makefile.am (HFILES): Add freebsd.h.
4193 * configure, Makefile.in, config.in: Rebuild.
4195 * merge.cc (do_add_input_section): Correct pend value. Change
4196 message about last entry not being null terminated from error to
4199 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
4201 * incremental.cc: New file.
4202 * Makefile.am (CCFILES): Add incremental.cc.
4203 * Makefile.in: Rebuild.
4205 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
4207 * layout.cc (Layout::output_section_name): Preserve names
4208 of '.note.' sections.
4210 2009-03-19 Ian Lance Taylor <iant@google.com>
4212 * descriptors.cc (Descriptors::open): Check that the options are
4213 valid before using them.
4215 2009-03-18 Ian Lance Taylor <iant@google.com>
4217 * script-sections.h: Include <list>.
4218 (class Script_sections): Change Sections_elements from std::vector
4219 to std::list. Typedef public Elements_iterator. Add
4220 orphan_section_placement_, data_segment_align_start_, and
4221 saw_data_segment_align_ fields. Remove data_segment_align_index_
4223 * script-sections.cc (class Orphan_section_placement): New class.
4224 (class Sections_element): Add virtual functions is_relro and
4225 orphan_section_init. Remove virtual function place_orphan_here.
4226 (class Output_section_definition): Add is_relro and
4227 orphan_section_init. Remove place_orphan_here.
4228 (class Orphan_output_section): Likewise.
4229 (Script_sections::Script_sections): Update for field changes.
4230 (Script_sections::data_segment_align): Set saw_data_segment_align_
4231 and data_segment_align_start_, not data_segment_align_index.
4232 (Script_sections::data_segment_relro_end): Check
4233 saw_data_segment_align_. Use data_segment_align_start_ rather
4234 than data_segment_align_index_.
4235 (Script_sections::place_orphan): Rewrite to use
4236 Orphan_section_placement.
4238 2009-03-17 Ian Lance Taylor <iant@google.com>
4240 * archive.cc (Archive::add_symbols): Check for a version attached
4241 to the symbol name in the archive map.
4242 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
4243 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
4244 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
4245 (ver_test_11.a): New target.
4246 * testsuite/Makefile.in: Rebuild.
4248 * configure.ac: Check for chsize and posix_fallocate. Replace
4250 * ftruncate.c: New file, from gnulib.
4251 * output.cc (posix_fallocate): Define dummy version if not
4252 HAVE_POSIX_FALLOCATE.
4253 (Output_file::map): Call posix_fallocate rather than lseek and
4255 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
4256 * configure, Makefile.in, config.in: Rebuild.
4258 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
4260 * layout.h (Layout::create_note): Add section_name parameter.
4261 * layout.cc (Layout::create_note): Likewise.
4262 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
4264 2009-03-17 Ian Lance Taylor <iant@google.com>
4266 * descriptors.cc: Include "options.h".
4267 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
4268 (Descriptors::open): Always use O_CLOEXEC when opening a new
4269 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
4270 then set FD_CLOEXEC.
4272 * sparc.cc (class Target_sparc): Add has_got_section.
4273 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
4274 make sure we have a GOT section.
4276 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
4277 (Target_sparc::Scan::local): Likewise.
4278 (Target_sparc::Scan::global): Likewise.
4279 (Target_sparc::Relocate::relocate): Likewise.
4280 (Target_sparc::Relocate::relocate_tls): Likewise.
4282 * symtab.cc (Symbol_table::define_default_version): New function,
4283 broken out of add_from_object.
4284 (Symbol_table::add_from_object): Call define_default_version.
4285 (Symbol_table::define_special_symbol): Add resolve_oldsym
4286 parameter. Change all callers. If the version for a symbol comes
4287 from a version script, resolve it with the symbol with the same
4288 name with no version. Also add the symbol without a version if
4290 (do_define_in_output_data): If resolving with oldsym, don't delete
4292 (do_define_in_output_segment): Likewise.
4293 (do_define_as_constant): Likewise.
4294 * symtab.h (class Symbol_table): Update declarations.
4296 2009-03-13 Ian Lance Taylor <iant@google.com>
4298 * readsyms.cc (Read_symbols::incompatible_warning): New function.
4299 (Read_symbols::requeue): New function.
4300 (Read_symbols::do_read_symbols): If make_elf_object fails because
4301 the target type is not configured, and the file was searched for,
4302 issue a warning and retry with the next directory.
4303 (Add_symbols::run): If the file has an incompatible format, and
4304 it was searched for, requeue the Read_symbols task. On error,
4306 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
4307 dirindex parameter to constructor. Change all callers. Declare
4308 incompatible_warning and requeue.
4309 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
4310 input_argument_ and input_group_ fields. Add them to
4311 constructor. Change all callers.
4312 (class Read_script): Add dirindex_ field. Add it to constructor.
4314 * archive.cc (Archive::setup): Remove input_objects parameter.
4316 (Archive::get_file_and_offset): Likewise.
4317 (Archive::read_all_symbols): Likewise.
4318 (Archive::read_symbols): Likewise.
4319 (Archive::get_elf_object_for_member): Remove input_objects
4320 parameter. Add punconfigured parameter. Change all callers.
4321 (Archive::add_symbols): Change return type to bool. Check return
4322 value of include_member.
4323 (Archive::include_all_members): Likewise.
4324 (Archive::include_member): Change return type to bool. Return
4325 false if first included object has incompatible target. Set
4326 included_member_ field.
4327 (Add_archive_symbols::run): If add_symbols returns false, requeue
4329 * archive.h (class Archive): Add included_member_ field.
4330 Initialize it in constructor. Add input_file and searched_for
4331 methods. Update declarations.
4332 (class Add_archive_symbols): Add dirpath_, dirindex_, and
4333 input_argument_ fields. Add them to constructor. Change all
4335 * script.cc: Include "target-select.h".
4336 (class Parser_closure): Add skip_on_incompatible_target_ and
4337 found_incompatible_target_ fields. Add
4338 skip_on_incompatible_target parameter to constructor. Change all
4339 callers. Add methods skip_on_incompatible_target,
4340 clear_skip_on_incompatible_target, found_incompatible_target, and
4341 set_found_incompatible_target.
4342 (read_input_script): Add dirindex parameter. Change all callers.
4343 If parser finds an incompatible target, requeue Read_symbols
4345 (script_set_symbol): Clear skip_on_incompatible_target in
4347 (script_add_assertion, script_parse_option): Likewise.
4348 (script_start_sections, script_add_phdr): Likewise.
4349 (script_check_output_format): New function.
4350 * script.h (read_input_script): Update declaration.
4351 * script-c.h (script_check_output_format): Declare.
4352 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
4353 (ignore_cmd): Remove OUTPUT_FORMAT.
4354 * fileread.cc (Input_file::Input_file): Add explicit this.
4355 (Input_file::will_search_for): New function.
4356 (Input_file::open): Add pindex parameter. Change all callers.
4357 * fileread.h (class Input_file): Add input_file_argument method.
4358 Declare will_search_for. Update declarations.
4359 * object.cc (make_elf_object): Add punconfigured parameter.
4361 * object.h (class Object): Make input_file public. Add
4362 searched_for method.
4363 (make_elf_object): Update declaration.
4364 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
4366 * dirsearch.h (class Dirsearch): Update declaration.
4367 * options.h (class General_options): Add --warn-search-mismatch.
4368 * parameters.cc (Parameters::is_compatible_target): New function.
4369 * parameters.h (class Parameters): Declare is_compatible_target.
4370 * workqueue.cc (Workqueue::add_blocker): New function.
4371 * workqueue.h (class Workqueue): Declare add_blocker.
4373 * fileread.cc (Input_file::open): Remove options parameter.
4375 (Input_file::open_binary): Likewise.
4376 * script.cc (read_input_script): Likewise.
4377 * readsyms.h (class Read_symbols): Remove options_ field. Remove
4378 options parameter from constructor. Change all callers.
4379 (class Read_script): Likewise.
4380 * fileread.h (class Input_file): Update declarations.
4381 * script.h (read_input_script): Update declaration.
4383 2009-03-10 Nick Clifton <nickc@redhat.com>
4385 * po/es.po: New Spanish translation.
4387 2009-03-06 Cary Coutant <ccoutant@google.com>
4389 * options.cc (parse_short_option): Keep dash_z from registering itself.
4391 2009-03-03 Ian Lance Taylor <iant@google.com>
4394 * target-reloc.h (relocate_section): Pass output_section to
4396 * i386.cc (Target_i386::should_apply_static_reloc): Add
4397 output_section parameter. Change all callers.
4398 (Target_i386::Relocate::relocate): Add output_section parameter.
4399 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4400 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
4401 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
4402 * testsuite/two_file_shared.sh: New script.
4403 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
4404 (check_DATA): Add two_file_shared.dbg.
4405 (two_file_shared.dbg): New target.
4406 * testsuite/Makefile.in: Rebuild.
4408 2009-03-01 Ian Lance Taylor <iant@google.com>
4410 * configure.ac: Check for byteswap.h.
4411 * configure: Rebuild.
4412 * config.in: Rebuild.
4414 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
4416 * layout.cc (Layout::find_or_add_kept_section): New function.
4417 (Layout::add_comdat): Removed.
4418 * layout.h (struct Kept_section): Move out of class Layout.
4419 Remove trailing underscores from field names. Add group_sections
4420 field. Rename group_ field to is_group. Change all uses.
4421 (class Layout): Declare find_or_add_kept_section, not add_comdat.
4422 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
4423 comdat_groups_ field.
4424 (Sized_relobj::include_section_group): Use
4425 find_or_add_kept_section and Kept_section::group_sections.
4426 (Sized_relobj::include_linkonce_section): Likewise.
4427 * object.cc (class Sized_relobj): Don't define Comdat_group or
4428 Comdat_group_table. Remove find_comdat_group and
4429 add_comdat_group. Remove comdat_groups_ field.
4430 * plugin.cc (include_comdat_group): Use
4431 Layout::find_or_add_kept_section.
4433 2009-02-28 Ian Lance Taylor <iant@google.com>
4435 * README: --gc-sections and map files are now supported. Document
4436 some build requirements.
4439 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
4440 relocatable link set the value of the section symbol to zero.
4441 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
4442 relocatable link don't include the section address in the local
4445 2009-02-27 Ian Lance Taylor <iant@google.com>
4448 * options.h (class Search_directory): Add is_system_directory.
4449 (class General_options): Declare is_in_system_directory.
4450 * options.cc (get_relative_sysroot): Make static.
4451 (get_default_sysroot): Make static.
4452 (General_optoins::is_in_system_directory): New function.
4453 * fileread.cc (Input_file::is_in_system_directory): New function.
4454 * fileread.h (class Input_file): Declare is_in_system_directory.
4455 * object.h (class Object): Add is_in_system_directory.
4456 (class Input_objects): Remove system_library_directory_ field.
4457 * object.cc (Input_objects::add_object): Don't set
4458 system_library_directory_.
4459 (input_objects::found_in_system_library_directory): Remove.
4460 * symtab.cc (Symbol_table::write_globals): Remove input_objects
4461 parameter. Change all callers.
4462 (Symbol_table::sized_write_globals): Likewise.
4463 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
4464 Call Object::is_in_system_directory.
4465 * symtab.h (class Symbol_table): Update declarations.
4468 * descriptors.h (Open_descriptor): Add is_on_stack field.
4469 * descriptors.cc (Descriptors::open): If the descriptor is on the
4470 top of the stack, remove it. Initialize is_on_stack field.
4471 (Descriptors::release): Only add pod to stack if it is not on the
4473 (Descriptors::close_some_descriptor): Clear stack_next and
4477 * output.cc (Output_section::find_starting_output_address): Rename
4478 from starting_output_address; add PADDR parameter; change return
4480 * output.h (class Output_section): Declare
4481 find_starting_output_address instead of starting_output_address.
4482 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
4483 section symbol for which we can't find a merge section.
4486 * symtab.cc (Symbol_table::add_from_object): If the visibility is
4487 hidden or internal, force the symbol to be local.
4488 * resolve.cc (Symbol::override_visibility): Define.
4489 (Symbol::override_base): Use override_visibility.
4490 (Symbol_table::resolve): Likewise.
4491 (Symbol::override_base_with_special): Likewise.
4492 (Symbol_table::override_with_special): If the visibility is hidden
4493 or internal, force the symbol to be local.
4494 * symtab.h (class Symbol): Add set_visibility and
4495 override_visibility.
4496 * testsuite/ver_test_1.sh: New file.
4497 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
4498 (check_DATA): Add ver_test_1.syms.
4499 (ver_test_1.syms): New target.
4500 * testsuite/Makefile.in: Rebuild.
4502 2009-02-25 Cary Coutant <ccoutant@google.com>
4504 * layout.cc (Layout::choose_output_section): Don't rename sections
4505 when using a linker script that has a SECTIONS clause.
4506 * Makefile.in: Regenerate.
4508 * testsuite/Makefile.am (script_test_5.sh): New test case.
4509 * testsuite/Makefile.in: Regenerate.
4510 * testsuite/script_test_5.cc: New file.
4511 * testsuite/script_test_5.sh: New file.
4512 * testsuite/script_test_5.t: New file.
4514 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
4516 * archive.cc (Archive::include_member): Update calls to add_symbols.
4517 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
4518 the Layout argument.
4519 * dynobj.h (do_add_symbols): Add the Layout argument.
4520 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
4522 * object.h (Object::add_symbols): Add the Layout argument.
4523 (Object::do_add_symbols): Add the Layout argument.
4524 (Sized_relobj::do_add_symbols): Add the Layout argument.
4525 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
4526 Unify the two versions.
4527 (Add_plugin_symbols): Remove.
4528 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
4529 (Sized_pluginobj::do_add_symbols): Unify the two versions.
4530 (Add_plugin_symbols): Remove.
4531 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
4532 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
4533 (Add_symbols::run): Make it work with Pulginobj.
4535 2009-02-06 Ian Lance Taylor <iant@google.com>
4537 * object.cc (Sized_relobj::do_layout): Make info message start
4538 with lower case letter.
4540 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
4542 * binary.cc: Fix file comment.
4544 * options.h (enum Incremental_disposition): Define.
4545 (class General_options): Add new options: --incremental,
4546 --incremental_changed, --incremental_unchanged,
4547 --incremental_unknown. Add incremental_disposition_ and
4548 implicit_incremental_ fields.
4549 (General_options::incremental_disposition): New function.
4550 (class Position_dependent_options): Add incremental_disposition
4552 (Position_dependent_options::copy_from_options): Set incremental
4554 * options.cc (General_options::parse_incremental_changed): New
4556 (General_options::parse_incremental_unchanged): New function.
4557 (General_options::parse_incremental_unknown): New function.
4558 (General_options::General_options): Initialize new fields
4559 incremental_disposition_ and implicit_incremental_.
4560 (General_options::finalize): Check for uasge of --incremental-*
4561 without --incremental.
4563 2009-02-06 Chris Demetriou <cgd@google.com>
4565 * gold.h (gold_undefined_symbol): Change to take only a Symbol
4566 pointer and to report location as the file name associated with
4568 (gold_undefined_symbol_at_location): New function to replace the
4569 old gold_undefined_symbol functionality.
4570 * target-reloc.h (relocate_section): Update to use
4571 gold_undefined_symbol_at_location.
4572 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4573 Call gold_undefined_symbol function rather than gold_error.
4574 * errors.h (Errors::undefined_symbol): Take location as a
4575 string, rather than calculating it from a relocation.
4576 * errors.cc (Errors::fatal): Print "fatal error:" before the
4578 (Errors::error, Errors::error_at_location): Print "error: "
4579 before the formatted message.
4580 (Errors::undefined_symbol): Take location as a string, rather
4581 than calculating it from a relocation.
4582 (gold_undefined_symbol_at_location): New function akin to
4583 old gold_undefined_symbol, calculates location from relocation.
4584 (gold_undefined_symbol): Change to take only a Symbol pointer
4585 and to report location as the file name associated with the symbol.
4586 * testsuite/debug_msg.sh: Update for changed error messages.
4587 * testsuite/undef_symbol.sh: Likewise.
4589 2009-02-04 Duncan Sands <baldrick@free.fr>
4592 * reduced_debug_output.h
4593 (Output_reduced_debug_abbrev_section::failed): Use format for
4595 (Output_reduced_debug_info_section::faild): Likewise.
4597 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
4599 * script.cc (Lazy_demangler): New class.
4600 (Version_script_info::get_symbol_version_helper): Demangle a
4603 2009-01-29 Cary Coutant <ccoutant@google.com>
4605 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
4607 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
4609 2009-01-28 Ian Lance Taylor <iant@google.com>
4611 * version.cc (version_string): Bump to 1.9.
4613 * gold.h: Include <cstring> and <stdint.h>.
4614 * version.cc: Include <cstdio>.
4615 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
4617 * reduced_debug_output.cc (insert_into_vector): Rename from
4618 Insert_into_vector; change all callers. Use Swap_unaligned to
4619 avoid aliasing issue; remove union since it is unnecessary.
4621 2009-01-27 Sriraman Tallam <tmsriram@google.com>
4623 * Makefile.am (CCFILES): Add gc.cc.
4625 * Makefile.in: Regenerate.
4626 * gold.cc (Gc_runner): New class.
4627 (queue_initial_tasks): Call garbage collection related tasks
4628 when corresponding options are invoked.
4629 (queue_middle_gc_tasks): New function.
4630 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
4631 processed early before laying out sections during garbage collection.
4632 * gold.h (queue_middle_gc_tasks): New function.
4633 (is_prefix_of): Move from "layout.cc".
4634 * i386.cc (Target_i386::gc_process_relocs): New function.
4635 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
4636 * main.cc (main): Create object of class "Garbage_collection".
4637 * object.cc (Relobj::copy_symbols_data): New function.
4638 (Relobj::is_section_name_included): New function.
4639 (Sized_relobj::do_layout): Allow this function to be called twice
4640 during garbage collection and defer layout of section during the
4642 * object.h (Relobj::get_symbols_data): New function.
4643 (Relobj::is_section_name_included): New function.
4644 (Relobj::copy_symbols_data): New function.
4645 (Relobj::set_symbols_data): New function.
4646 (Relobj::get_relocs_data): New function.
4647 (Relobj::set_relocs_data): New function.
4648 (Relobj::is_output_section_offset_invalid): New pure virtual function.
4649 (Relobj::gc_process_relocs): New function.
4650 (Relobj::do_gc_process_relocs): New pure virtual function.
4651 (Relobj::sd_): New data member.
4652 (Sized_relobj::is_output_section_offset_invalid): New function.
4653 (Sized_relobj::do_gc_process_relocs): New function.
4654 * options.h (General_options::gc_sections): Modify to not be a no-op.
4655 (General_options::print_gc_sections): New option.
4656 * plugin.cc (Plugin_finish::run): Remove function call to
4657 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
4658 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
4659 * reloc.cc (Read_relocs::run): Add task to process relocs and
4660 determine unreferenced sections when doing garbage collection.
4661 (Gc_process_relocs): New class.
4662 (Sized_relobj::do_gc_process_relocs): New function.
4663 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
4664 sections that are garbage collected.
4665 * reloc.h (Gc_process_relocs): New class.
4666 * sparc.cc (Target_sparc::gc_process_relocs): New function.
4667 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
4668 symbols whose corresponding sections are garbage collected.
4669 (Symbol_table::Symbol_table): Add new parameter for the garbage
4671 (Symbol_table::gc_mark_undef_symbols): New function.
4672 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4673 (Symbol_table::gc_mark_dyn_syms): New function.
4674 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
4676 (Symbol_table::add_from_object): Likewise.
4677 (Symbol_table::add_from_relobj): When building shared objects, do not
4678 treat externally visible symbols as garbage.
4679 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
4680 table information for static and relocatable links.
4681 * symtab.h (Symbol_table::set_gc): New function.
4682 (Symbol_table::gc): New function.
4683 (Symbol_table::gc_mark_undef_symbols): New function.
4684 (Symbol_table::gc_mark_symbol_for_shlib): New function.
4685 (Symbol_table::gc_mark_dyn_syms): New function.
4686 (Symbol_table::gc_): New data member.
4687 * target.h (Sized_target::gc_process_relocs): New pure virtual
4689 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
4690 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
4692 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
4694 * options.h (General_options::gc_sections): Define as a no-op for now.
4695 (General_options::no_keep_memory): Ditto.
4696 (General_options::Bshareable): Define.
4697 * options.cc (General_options::finalize): Honor -Bshareable.
4699 2009-01-20 Andreas Schwab <schwab@suse.de>
4701 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
4702 read the value in the contents, since we don't use it. Use the
4703 template endianness when writing.
4704 (Relocate::relocate): Use it for R_PPC_REL16_HA.
4706 2009-01-19 Andreas Schwab <schwab@suse.de>
4708 * configure.tgt (powerpc64-*): Fix targ_obj.
4710 2009-01-15 Ian Lance Taylor <iant@google.com>
4712 * object.cc (Sized_relobj::write_local_symbols): Don't write out
4713 local symbols when stripping all symbols.
4715 2009-01-14 Cary Coutant <ccoutant@google.com>
4717 * output.cc (Output_reloc): Add explicit instantiations.
4719 2009-01-14 Cary Coutant <ccoutant@google.com>
4721 * archive.cc (Archive::get_elf_object_for_member): Remove call
4722 to File_read::claim_for_plugin.
4723 * descriptors.cc (Descriptors::open): Remove reference to
4725 (Descriptors::claim_for_plugin): Remove.
4726 * descriptors.h (Descriptors::claim_for_plugin): Remove.
4727 (Descriptors::is_claimed): Remove.
4728 (claim_descriptor_for_plugin): Remove.
4729 * fileread.cc (File_read::claim_for_plugin): Remove.
4730 * fileread.h (File_read::claim_for_plugin): Remove.
4731 (File_read::descriptor): Reopen descriptor if necessary.
4732 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
4733 (Plugin_manager::all_symbols_read): Add task parameter. Change
4735 (Plugin_manager::get_input_file): New function.
4736 (Plugin_manager::release_input_file): New function.
4737 (Pluginobj::Pluginobj): Add filesize parameter and initialize
4738 corresponding data member.
4739 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
4740 and pass to base constructor. Change all callers.
4741 (get_input_file, release_input_file): New functions.
4742 (make_sized_plugin_object): Add filesize parameter. Change all callers.
4743 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
4744 (Plugin_manager::all_symbols_read): Add task parameter.
4745 (Plugin_manager::get_input_file): New function.
4746 (Plugin_manager::release_input_file): New function.
4747 (Plugin_manager::task_): New data member.
4748 (Pluginobj::Pluginobj): Add filesize parameter.
4749 (Pluginobj::filename): New function.
4750 (Pluginobj::descriptor): New function.
4751 (Pluginobj::filesize): New function.
4752 (Pluginobj::filesize_): New data member.
4753 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
4754 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
4755 File_read::claim_for_plugin; use Object::unlock to unlock the file.
4757 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
4758 with archive libraries.
4759 * testsuite/Makefile.in: Regenerate.
4760 * testsuite/plugin_test.c (struct sym_info): New type.
4761 (get_input_file, release_input_file): New static variables.
4762 (onload): Capture new transfer vector entries.
4763 (claim_file_hook): Stop reading at end of file according to filesize.
4764 Factor out parsing of readelf output into separate function.
4765 (all_symbols_read_hook): Exercise get_input_file and release_input_file
4766 APIs and get the source file name from the symbol table. Convert
4767 source file name to corresponding object file name. Print info
4768 message when adding new input files.
4769 (parse_readelf_line): New function.
4770 * testsuite/plugin_test_1.sh: Add checks for new info messages.
4771 * testsuite/plugin_test_2.sh: Likewise.
4772 * testsuite/plugin_test_3.sh: Likewise.
4773 * testsuite/plugin_test_4.sh: New test case.
4775 2009-01-07 Ian Lance Taylor <iant@google.com>
4777 * version.cc (version_string): Bump to 1.8.
4779 2008-12-23 Cary Coutant <ccoutant@google.com>
4781 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
4782 * plugin.cc (Plugin_manager::finish): Rename as
4783 layout_deferred_objects. Move cleanup to separate function.
4784 (Plugin_manager::cleanup): New function.
4785 (Plugin_finish::run): Call layout_deferred_objects and cleanup
4787 * plugin.h (Plugin_manager::finish): Rename as
4788 layout_deferred_objects.
4789 (Plugin_manager::cleanup): New function.
4790 (Plugin_manager::cleanup_done): New field.
4792 2008-12-23 Cary Coutant <ccoutant@google.com>
4794 * plugin.cc (is_visible_from_outside): New function.
4795 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
4796 so we don't return "IR only" status for exported symbols or -r links.
4798 * testsuite/Makefile.am (plugin_test_3): New test case.
4799 * testsuite/Makefile.in: Regenerate.
4800 * testsuite/plugin_test_3.sh: New file.
4802 2008-12-22 Cary Coutant <ccoutant@google.com>
4804 * object.cc (Sized_relobj::layout_section): New function.
4805 (Sized_relobj::do_layout): Defer layout of input sections until after
4806 plugin has provided replacement files.
4807 (Sized_relobj::do_layout_deferred_sections): New function.
4808 * object.h (Relobj::set_section_offset): Remove virtual keyword.
4809 (Relobj::layout_deferred_sections): New function.
4810 (Relobj::do_layout_deferred_sections): New function.
4811 (Sized_relobj::do_layout_deferred_sections): New function.
4812 (Sized_relobj::layout_section): New function.
4813 (Sized_relobj::Deferred_layout): New structure.
4814 (Sized_relobj::deferred_layout_): New field.
4815 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4816 Change all callers. Layout deferred sections.
4817 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4819 (Plugin_hook::run): Move code from do_plugin_hook inline.
4820 (Plugin_hook::do_plugin_hook): Remove.
4821 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4822 (Plugin_manager::finish): Renamed, was cleanup.
4823 (Plugin_manager::should_defer_layout): New function.
4824 (Plugin_manager::add_deferred_layout_object): New function.
4825 (Plugin_manager::Deferred_layout_list): New type.
4826 (Plugin_manager::deferred_layout_objects_): New field.
4827 (Plugin_hook::do_plugin_hook): Remove.
4829 2008-12-17 Ian Lance Taylor <iant@google.com>
4831 * options.h (class General_options): Add --no case for
4834 2008-12-16 Cary Coutant <ccoutant@google.com>
4836 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4838 (Plugin_manager::claim_file): Create plugin object even if
4839 plugin did not call the add_symbols callback.
4840 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4841 asking for more symbols than were added.
4842 * testsuite/Makefile.am (plugin_test_1): Add test case with
4844 (empty.syms): New target.
4845 * testsuite/Makefile.in: Regenerate.
4846 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4847 message. Don't call add_symbols if no globals.
4848 (all_symbols_read_hook): Don't provide replacement for empty
4851 2008-12-12 Ian Lance Taylor <iant@google.com>
4853 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4854 r_type == 0 for a local symbol with r_sym == 0.
4855 (scan_relocatable_relocs): Pass r_sym to
4856 local_non_section_strategy.
4857 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4860 * configure.ac: Update test for TLS descriptors: they are
4861 supported as of glibc 2.9.
4862 * configure: Rebuild.
4864 2008-12-11 Ian Lance Taylor <iant@google.com>
4867 * target-reloc.h (Default_scan_relocatable_relocs): For each
4868 function, map r_type == 0 to RELOC_DISCARD.
4870 2008-12-10 Cary Coutant <ccoutant@google.com>
4872 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4873 object to override a kept COMDAT group from a plugin object.
4875 2008-12-09 Ian Lance Taylor <iant@google.com>
4878 * yyscript.y (file_cmd): Handle INPUT.
4880 * testsuite/initpri1.c: Change all declarations to be full
4881 prototypes by adding void, to avoid compiler warnings.
4883 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
4885 * options.cc (General_options::parse_plugin_opt): New.
4886 (General_options::add_plugin): The argument now is just the filename.
4887 (General_options::add_plugin_option): New.
4888 * options.h (plugin_opt): New.
4889 (add_plugin): Change argument name.
4890 (add_plugin_option): New.
4891 * plugin.cc (Plugin::load): Don't parse the plugin option.
4892 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4893 (Plugin::add_option): New.
4894 (Plugin::args_): Change type.
4895 (Plugin::filename_): New.
4896 (Plugin_manager::add_plugin_option): New.
4897 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4898 * testsuite/Makefile.in: Regenerate.
4900 2008-12-05 Cary Coutant <ccoutant@google.com>
4902 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4903 Handle --strip-lto-sections option.
4904 * options.h (strip_lto_sections): New option.
4906 2008-12-01 Cary Coutant <ccoutant@google.com>
4908 * plugin.cc (ld_plugin_message): Change format parameter to const.
4909 Fix mismatch between new[] and delete.
4911 2008-11-14 Cary Coutant <ccoutant@google.com>
4913 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4916 2008-11-05 Craig Silverstein <csilvers@google.com>
4918 * options.cc (General_options::parse_dynamic_list): New function.
4919 * options.h (General_options): New flags dynamic_list,
4920 dynamic_list_data, dynamic_list_cpp_new, and
4921 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4922 (General_options::in_dynamic_list): New function.
4923 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4924 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4925 (Lex::can_continue_name): Likewise.
4927 (read_script_file): New parameter script_options.
4928 (read_dynamic_list): New function.
4929 (Script_options::define_dynamic_list): New function.
4930 (dynamic_list_keyword_parsecodes): New variable.
4931 (dynamic_list_keywords): New variable.
4932 * script.h (Script_options::define_dynamic_list): New function
4934 (read_dynamic_list): New function prototype.
4935 * symtab.cc (strprefix): New macro.
4936 (Symbol::should_add_dynsym_entry): Support dynamic_list,
4937 dynamic_list_data, dynamic_list_cpp_new, and
4938 dynamic_list_cpp_typeinfo.
4939 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4940 (dynamic_list_expr): New rule.
4941 (dynamic_list_nodes): Likewise.
4942 (dynamic_list_node): Likewise.
4943 * testsuite/Makefile.am (dynamic_list): New test.
4944 * testsuite/Makefile.in: Regenerated.
4945 * testsuite/dynamic_list.t: New file.
4946 * testsuite/dynamic_list.sh: New file.
4948 2008-11-05 Craig Silverstein <csilvers@google.com>
4950 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4951 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4952 (t11_last): Likewise.
4953 * testsuite/ver_test_6.c (main): Likewise.
4955 2008-10-07 Cary Coutant <ccoutant@google.com>
4957 * options.c (General_options::finalize): Add check for -static and
4959 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4962 2008-10-02 Cary Coutant <ccoutant@google.com>
4964 * plugin.cc (make_sized_plugin_object): Fix conditional
4965 compilation to work when not all targets are enabled.
4967 2008-09-29 Cary Coutant <ccoutant@google.com>
4969 * archive.cc (Archive::get_file_and_offset): Use filename instead
4970 of name to get library path.
4971 (Archive::include_member): Unlock external member of a thin archive.
4973 * testsuite/Makefile.am (TEST_AR): New variable.
4974 (thin_archive_test_1): New test.
4975 (thin_archive_test_2): New test.
4976 * testsuite/Makefile.in: Regenerate.
4977 * testsuite/thin_archive_main.cc: New file.
4978 * testsuite/thin_archive_test_1.cc: New file.
4979 * testsuite/thin_archive_test_2.cc: New file.
4980 * testsuite/thin_archive_test_3.cc: New file.
4981 * testsuite/thin_archive_test_4.cc: New file.
4983 2008-09-29 Cary Coutant <ccoutant@google.com>
4985 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4986 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4988 (Sized_relobj::do_finalize_local_symbols): Likewise.
4989 (Sized_relobj::map_to_kept_section): Likewise.
4990 * object.h (Sized_relobj::invalid_address): New constant.
4991 (Sized_relobj::do_output_section_offset): Check for invalid_address
4993 * output.cc (Output_reloc::local_section_offset): Use constant
4994 invalid_address instead of -1U.
4995 (Output_reloc::get_address): Likewise.
4996 (Output_section::output_address): Change -1U to -1ULL.
4997 * output.h (Output_reloc::invalid_address): New constant.
4998 * reloc.cc (Sized_relobj::write_sections): Use constant
4999 invalid_address instead of -1U.
5000 (Sized_relobj::relocate_sections): Likewise.
5001 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
5002 values for merge sections.
5003 * target-reloc.h (relocate_for_relocatable): Use constant
5004 invalid_address instead of -1U.
5006 2008-09-19 Cary Coutant <ccoutant@google.com>
5008 Add plugin functionality for link-time optimization (LTO).
5009 * configure.ac (plugins): Add --enable-plugins option.
5010 * configure: Regenerate.
5011 * config.in: Regenerate.
5012 * Makefile.am (LIBDL): New variable.
5013 (CCFILES): Add plugin.cc.
5014 (HFILES): Add plugin.h.
5015 (ldadd_var): Add LIBDL.
5016 * Makefile.in: Regenerate.
5018 * archive.cc: Include "plugin.h".
5019 (Archive::setup): Don't preread archive symbols when using a plugin.
5020 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
5021 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
5023 (Archive::include_member): Add symbols from plugin objects.
5024 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
5025 * descriptors.cc (Descriptors::open): Check for file descriptors
5026 abandoned by plugins.
5027 (Descriptors::claim_for_plugin): New function.
5028 * descriptors.h (Descriptors::claim_for_plugin): New function.
5029 (Open_descriptor::is_claimed): New field.
5030 (claim_descriptor_for_plugin): New function.
5031 * fileread.cc (File_read::claim_for_plugin): New function.
5032 * fileread.h (File_read::claim_for_plugin): New function.
5033 (File_read::descriptor): New function.
5034 * gold.cc: Include "plugin.h".
5035 (queue_initial_tasks): Add task to call plugin hooks for generating
5037 * main.cc: Include "plugin.h".
5038 (main): Load plugin libraries.
5039 * object.h (Pluginobj): Declare.
5040 (Object::pluginobj): New function.
5041 (Object::do_pluginobj): New function.
5042 (Object::set_target): New function.
5043 * options.cc: Include "plugin.h".
5044 (General_options::parse_plugin): New function.
5045 (General_options::General_options): Initialize plugins_ field.
5046 (General_options::add_plugin): New function.
5047 * options.h (Plugin_manager): Declare.
5048 (General_options): Add --plugin option.
5049 (General_options::has_plugins): New function.
5050 (General_options::plugins): New function.
5051 (General_options::add_plugin): New function.
5052 (General_options::plugins_): New field.
5053 * plugin.cc: New file.
5054 * plugin.h: New file.
5055 * readsyms.cc: Include "plugin.h".
5056 (Read_symbols::do_read_symbols): Check for archive before checking
5057 for ELF file. Call plugin hooks to claim files.
5058 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
5059 from a real object file; force override when processing replacement
5061 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
5062 (Symbol::init_base_object): Likewise.
5063 (Symbol::init_base_output_data): Likewise.
5064 (Symbol::init_base_output_segment): Likewise.
5065 (Symbol::init_base_constant): Likewise.
5066 (Symbol::init_base_undefined): Likewise.
5067 (Symbol::output_section): Assert that object is not a plugin.
5068 (Symbol_table::add_from_pluginobj): New function.
5069 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
5071 (Symbol_table::sized_write_globals): Likewise.
5072 (Symbol_table::add_from_pluginobj): Instantiate template.
5073 * symtab.h (Sized_pluginobj): Declare.
5074 (Symbol::in_real_elf): New function.
5075 (Symbol::set_in_real_elf): New function.
5076 (Symbol::in_real_elf_): New field.
5077 (Symbol_table::add_from_pluginobj): New function.
5079 * testsuite/Makefile.am (AM_CFLAGS): New variable.
5080 (LIBDL): New variable.
5082 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
5083 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
5084 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
5085 (MOSTLYCLEANFILES): Likewise.
5086 * testsuite/Makefile.in: Regenerate.
5087 * testsuite/plugin_test.c: New file.
5088 * testsuite/plugin_test_1.sh: New file.
5089 * testsuite/plugin_test_2.sh: New file.
5091 2008-09-16 Ian Lance Taylor <iant@google.com>
5093 * target-reloc.h (relocate_section): Check whether a symbol is
5094 defined by the ABI before reporting an undefined symbol error.
5095 * target.h (Target::is_defined_by_abi): Make parameter const.
5096 (Target::do_is_defined_by_abi): Likewise.
5097 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
5098 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
5099 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
5100 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
5101 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
5102 * testsuite/Makefile.in: Rebuild.
5104 * fileread.cc (make_view): Add casts to avoid warning.
5106 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
5108 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
5109 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5111 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
5113 * options.h (General_options::output_is_executable): New.
5114 (General_options::output_is_pie): New.
5115 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
5116 for shared libraries.
5117 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5119 2008-09-11 Chris Demetriou <cgd@google.com>
5121 * options.h (origin): New -z option.
5122 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
5123 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
5126 2008-09-05 Cary Coutant <ccoutant@google.com>
5128 * fileread.cc (File_read::make_view): Add check for attempt to map
5131 2008-09-05 Cary Coutant <ccoutant@google.com>
5133 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
5134 explicit instantiations.
5136 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
5139 * options.cc (General_options::finalize): Allow undefined symbols
5140 in shlibs if linking -shared.
5143 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
5144 symbols as not needing a dynsym entry.
5146 2008-08-20 Craig Silverstein <csilvers@google.com>
5148 * fileread.cc (File_read::open): Do not lock the file unless it
5149 was successfully opened.
5151 2008-08-14 Cary Coutant <ccoutant@google.com>
5153 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
5154 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
5155 * testsuite/tls_test.cc (struct int128): 128-bit struct
5156 for testing TLS relocs with non-zero addend.
5157 (v12): New TLS variable.
5159 (t_last): Add check for v12.
5160 * testsuite/tls_test.h (t12): New function.
5161 * testsuite/tls_test_main.cc (thread_routine): Call new test.
5163 2008-08-13 Ian Lance Taylor <iant@google.com>
5165 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
5166 set tls_segment_ or relro_segment_.
5167 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
5169 * output.h (Output_section::clear_is_relro): New function.
5170 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
5171 sections specially even when output_data_ is empty.
5172 (Output_segment::maximum_alignment): When first section is relro,
5173 only force alignment for PT_LOAD segments.
5174 * script.cc (script_data_segment_align): New function.
5175 (script_data_segment_relro_end): New function.
5176 * script-c.h (script_data_segment_align): Declare.
5177 (script_data_segment_relro_end): Declare.
5178 * script-sections.h (class Script_sections): Declare
5179 data_segment_align and data_segment_relro_end. Add fields
5180 segment_align_index_ and saw_relro_end_.
5181 * script-sections.cc (class Sections_element): Add set_is_relro
5182 virtual function. Add new bool* parameter to place_orphan_here.
5183 Add get_output_section virtual function.
5184 (class Output_section_definition): Add set_is_relro. Add new
5185 bool* parameter to place_orphan_here. Add get_output_section.
5186 Add is_relro_ field.
5187 (Output_section_definition::Output_section_definition): Initialize
5188 evaluated_address_, evaluated_load_address, evaluated_addralign_,
5189 and is_relro_ fields.
5190 (Output_section_definition::place_orphan_here): Add is_relro
5192 (Output_section_definition::set_section_addresses): Set relro for
5194 (Output_section_definition::alternate_constraint): Likewise.
5195 (class Orphan_output_section): Add new bool* parameter to
5196 place_orphan_here. Add get_output_section.
5197 (Orphan_output_section::place_orphan_here): Add is_relro
5199 (Script_sections::Script_sections): Initialize
5200 data_segment_align_index_ and saw_relro_end_.
5201 (Script_sections::data_segment_align): New function.
5202 (Script_sections::data_segment_relro_end): New function.
5203 (Script_sections::place_orphan): Set or clear is_relro.
5204 (Script_sections::set_section_addresses): Force alignment of first
5206 * yyscript.y (exp): Call script_data_segment_align and
5207 script_data_segment_relro_end.
5208 * testsuite/relro_script_test.t: New file.
5209 * testsuite/relro_test.cc (using_script): Declare.
5210 (t1, t2): Test using_script.
5211 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
5212 (relro_script_test_SOURCES): Define.
5213 (relro_script_test_DEPENDENCIES): Define.
5214 (relro_script_test_LDFLAGS): Define.
5215 (relro_script_test_LDADD): Define.
5216 (relro_script_test.so): New target.
5217 * testsuite/Makefile.in: Rebuild.
5219 2008-08-06 Cary Coutant <ccoutant@google.com>
5221 * archive.cc (Archive::total_archives, Archive::total_members)
5222 (Archive::total_members_loaded): New variables.
5223 (Archive::setup): Add parameter. Add option to preread
5225 (Archive::read_armap): Add counter.
5226 (Archive::get_file_and_offset): New function.
5227 (Archive::get_elf_object_for_member): New function.
5228 (Archive::read_all_symbols): New function.
5229 (Archive::read_symbols): New function.
5230 (Archive::add_symbols): Add counters.
5231 (Archive::include_all_members): Use armap to find members if it's
5233 (Archive::include_member): Skip reading symbols if already read.
5234 Factored code into Archive::get_file_and_offset and
5235 Archive::get_elf_object_for_member. Changed call to
5236 Mapfile::report_include_archive_member.
5237 (Archive::print_stats): New function.
5238 * archive.h: Declare Object and Read_symbols_data classes.
5239 (Archive::Archive): Add initializers for new members.
5240 (Archive::setup): Add parameter.
5241 (Archive::print_stats): New function.
5242 (Archive::total_archives, Archive::total_members)
5243 (Archive::total_members_loaded): New variables.
5244 (Archive::get_file_and_offset): New function.
5245 (Archive::get_elf_object_for_member): New function.
5246 (Archive::read_all_symbols): New function.
5247 (Archive::read_symbols): New function.
5248 (Archive::Archive_member): New class.
5249 (Archive::members_): New member.
5250 (Archive::num_members_): New member.
5251 * main.cc: Include archive.h.
5252 (main): Call Archive::print_stats.
5253 * mapfile.cc (Mapfile::report_include_archive_member): Delete
5254 archive parameter; member_name is now the fully-decorated name.
5255 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
5256 * options.h: (General_options): Add --preread-archive-symbols option.
5257 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
5260 2008-08-04 Ian Lance Taylor <iant@google.com>
5262 * symtab.h (Symbol::use_plt_offset): New function.
5263 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
5264 * powerpc.cc (Relocate::relocate): Likewise.
5265 * sparc.cc (Relocate::relocate): Likewise.
5266 * x86_64.cc (Relocate::relocate): Likewise.
5267 * testsuite/weak_plt.sh: New test.
5268 * testsuite/weak_plt_main.cc: New test.
5269 * testsuite/weak_plt_shared.cc: New test.
5270 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
5271 (check_PROGRAMS): Add weak_plt.
5272 (check_DATA): Add weak_plt_shared.so.
5273 (weak_plt_main_pic.o, weak_plt): New targets.
5274 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
5275 * testsuite/Makefile.in: Rebuild.
5277 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
5279 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
5280 * testsuite/Makefile.in: Rebuild.
5282 2008-08-04 Alan Modra <amodra@bigpond.net.au>
5284 * Makefile.am (POTFILES.in): Set LC_ALL=C.
5285 * Makefile.in: Regenerate.
5286 * po/POTFILES.in: Regenerate.
5288 2008-07-29 Ian Lance Taylor <iant@google.com>
5290 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
5291 symbols before other symbols.
5292 * testsuite/script_test_2.cc (test_addr): Declare.
5293 (test_addr_alias): Declare.
5294 (main): Check that test_addr and test_addr_alias have the right
5296 * testsuite/script_test_2.t: Define test_addr_alias and
5299 2008-07-24 Ian Lance Taylor <iant@google.com>
5302 * descriptors.cc: New file.
5303 * descriptors.h: New file.
5304 * gold-threads.h (class Hold_optional_lock): New class.
5305 * fileread.cc: Include "descriptors.h".
5306 (File_read::~File_read): Release descriptor rather than closing
5308 (File_read::open) [file]: Call open_descriptor rather than open.
5309 Set is_descriptor_opened_.
5310 (File_read::open) [memory]: Assert that descriptor is not open.
5311 (File_read::reopen_descriptor): New function.
5312 (File_read::release): Release descriptor.
5313 (File_read::do_read): Make non-const. Reopen descriptor.
5314 (File_read::read): Make non-const.
5315 (File_read::make_view): Reopen descriptor.
5316 (File_read::do_readv): Likewise.
5317 * fileread.h (class File_read): Add is_descriptor_opened_ field.
5318 Update declarations.
5319 * layout.cc: Include "descriptors.h".
5320 (Layout::create_build_id): Use open_descriptor rather than open.
5321 * output.cc: Include "descriptors.h".
5322 (Output_file::open): Use open_descriptor rather than open.
5323 * archive.cc (Archive::const_iterator): Change Archive to be
5325 (Archive::begin, Archive::end): Make non-const.
5326 (Archive::count_members): Likewise.
5327 * archive.h (class Archive): Update declarations.
5328 * object.h (Object::read): Make non-const.
5329 * Makefile.am (CCFILES): Add descriptors.cc.
5330 (HFILES): Add descriptors.h.
5331 * Makefile.in: Rebuild.
5334 * gold.h: Always include <clocale>. Add Solaris workarounds
5335 following code in binutils/sysdep.h.
5338 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
5339 this->eh_frame_hdr_ is NULL before using it.
5341 * dynobj.cc (Versions::Versions): Update comment.
5343 * dynobj.cc (Versions::Versions): If there is an soname, use it as
5344 the base version name.
5346 * stringpool.cc (Stringpool_template::add_with_length): Set key to
5347 array size plus one.
5348 (Stringpool_template::set_string_offsets): Subtract one from key
5349 before using it as an array index.
5350 (Stringpool_template::get_offset_with_length): Likewise.
5351 (Stringpool_template::write_to_buffer): Likewise.
5352 * stringpool.h (Stringpool_template::get_offset_from_key):
5355 2008-07-23 Ian Lance Taylor <iant@google.com>
5358 * object.h (Merged_symbol_value::value): Do our best to handle a
5362 * script.cc (Version_script_info::get_versions): Don't add empty
5363 version tag to return value.
5364 (Version_script_info::get_symbol_version_helper): Change return
5365 type to bool. Add pversion parameter. Change all callers.
5366 (script_register_vers_node): Don't require a non-NULL tag.
5367 * script.h (class Version_script_info): Update declarations.
5368 (Version_script_info::get_symbol_version): Change return type to
5369 bool. Add version parameter. Change all callers.
5370 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
5371 handling. Handle an empty version from a version script.
5372 (Symbol_table::define_special_symbol): Likewise.
5373 * testsuite/ver_test_10.script: New file.
5374 * testsuite/ver_test_10.sh: New file.
5375 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
5376 (check_DATA): Add ver_test_10.syms.
5377 (ver_test_10.syms, ver_test_10.so): New target.
5378 * testsuite/Makefile.in: Rebuild.
5380 2008-07-23 Simon Baldwin <simonb@google.com>
5382 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
5383 to zero for undefined symbols from dynamic libraries.
5385 2008-07-23 Ian Lance Taylor <iant@google.com>
5387 * symtab.cc (Symbol_table::resolve): Remove version parameter.
5389 * symtab.h (class Symbol_table): Update declaration.
5390 * testsuite/ver_test_9.cc: New file.
5391 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
5392 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
5393 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
5394 (ver_test_9.so, ver_test_9.o): New targets.
5395 * testsuite/Makefile.in: Rebuild.
5397 2008-07-22 Ian Lance Taylor <iant@google.com>
5399 * options.h (class General_options): Define --check-sections.
5400 * layout.cc (Layout::set_segment_offsets): Handle
5403 * options.h (class General_options): Define -n/--nmagic and
5405 * options.cc (General_options::finalize): For -n/--nmagic or
5406 -N/--omagic, set -static.
5407 * layout.cc (Layout::attach_allocated_section_to_segment): If
5408 -N/--omagic, don't put read-only and read-write sections in
5410 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
5411 finding a read-only segment.
5412 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
5413 don't set the minimum segment alignment to the common page size,
5414 and don't set the file offset to the address modulo the page size.
5415 * script-sections.cc (Script_sections::create_segments): If
5416 -n/--omagic, don't put read-only and read-write sections in
5419 * cref.cc: New file.
5421 * options.h (class General_options): Add --print-symbol-counts.
5422 * main.cc (main): Issue defined symbol report if requested.
5423 * archive.cc (Archive::interpret_header): Make into a const member
5425 (Archive::add_symbols): Call Input_objects::archive_start and
5427 (Archive::const_iterator): Define new class.
5428 (Archive::begin, Archive::end): New functions.
5429 (Archive::include_all_members): Rewrite to use iterator.
5430 (Archive::count_members): New function.
5431 * archive.h (class Archive): Update declarations.
5432 (Archive::filename): New function.
5433 * object.cc: Include "cref.h".
5434 (Sized_relobj::Sized_relobj): Initialize defined_count_.
5435 (Sized_relobj::do_get_global_symbol_counts): New function.
5436 (Input_objects::add_object): Add object to cross-referencer.
5437 (Input_objects::archive_start): New function.
5438 (Input_objects::archive_stop): New function.
5439 (Input_objects::print_symbol_counts): New function.
5440 * object.h: Declare Cref and Archive.
5441 (Object::get_global_symbol_counts): New function.
5442 (Object::do_get_global_symbol_counts): New pure virtual function.
5443 (class Sized_relobj): Add defined_count_ field. Update
5445 (class Input_objects): Add cref_ field. Update constructor.
5446 Update declarations.
5447 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
5449 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
5451 (Sized_dynobj::do_get_global_symbol_counts): New function.
5452 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
5453 defined_count_. Update declarations. Define Symbols typedef.
5454 * symtab.cc (Symbol_table::add_from_relobj): Add defined
5455 parameter. Change all callers.
5456 (Symbol_table::add_from_dynobj): Add sympointers and defined
5457 parameters. Change all callers.
5458 * symtab.h (class Symbol_table): Update declarations.
5459 * Makefile.am (CCFILES): Add cref.cc.
5460 (HFILES): Add cref.h.
5461 * Makefile.in: Rebuild.
5463 2008-07-22 Simon Baldwin <simonb@google.com>
5465 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
5466 to zero when writing undefined symbols.
5468 2008-07-22 Ian Lance Taylor <iant@google.com>
5470 * output.cc (Output_section::add_input_section): Don't try to
5471 merge empty merge sections.
5473 2008-07-21 Craig Silverstein <csilvers@google.com>
5475 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5476 Include symbol version in error message.
5478 2008-07-20 Chris Demetriou <cgd@google.com>
5480 * configure.ac (gold_cv_c_random_seed): New configured variable.
5481 (RANDOM_SEED_CFLAGS): New substituted variable.
5482 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
5483 * configure: Rebuild.
5484 * Makefile.in: Likewise.
5485 * testsuite/Makefile.in: Likewise.
5487 2008-07-18 Ian Lance Taylor <iant@google.com>
5489 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
5490 where we see NAME/NULL and NAME/VERSION as separate symbols.
5491 * testsuite/ver_test_main.cc (main): Call t4.
5492 (t4, t4_2a): Define.
5493 * testsuite/ver_test_2.cc (t4_2): Define.
5494 * testsuite/ver_test_2.script: Put t4_2a in VER2.
5495 * testsuite/ver_test_4.cc (t4_2a): Define.
5496 * testsuite/ver_test_4.script: Put t4_2a in VER2.
5497 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
5499 2008-07-17 Ian Lance Taylor <iant@google.com>
5501 * dynobj.cc (Versions::add_def): If we give an error about a
5502 missing version, go ahead and create the version anyhow.
5504 2008-07-10 Ian Lance Taylor <iant@google.com>
5506 Handle output sections with more than 0x7fffffff bytes.
5507 * object.h (class Relobj): Change map_to_output_ to
5508 output_sections_, and just keep a section pointer. Change all
5509 uses. Move comdat group support to Sized_relobj.
5510 (Relobj::is_section_specially_mapped): Remove.
5511 (Relobj::output_section): Remove poff parameter. Change all
5513 (Relobj::output_section_offset): New function.
5514 (Relobj::set_section_offset): Rewrite.
5515 (Relobj::map_to_output): Remove.
5516 (Relobj::output_sections): New function.
5517 (Relobj::do_output_section_offset): New pure virtual function.
5518 (Relobj::do_set_section_offset): Likewise.
5519 (class Sized_relobj): Add section_offsets_ field. Add comdat
5520 group support from Relobj. Update declarations.
5521 (Sized_relobj::get_output_section_offset): New function.
5522 (Sized_relobj::do_output_section_offset): New function.
5523 (Sized_relobj::do_set_section_offset): New function.
5524 * object.cc (Relobj::output_section_address): Remove.
5525 (Sized_relobj::Sized_relobj): Initialize new fields.
5526 (Sized_relobj::include_section_group): Cast find_kept_object to
5528 (Sized_relobj::include_linkonce_section): Likewise.
5529 (Sized_relobj::do_layout): Use separate arrays for output section
5531 (Sized_relobj::do_count_local_symbols): Change map_to_output to
5533 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
5534 output_sections and section_offsets.
5535 (Sized_relobj::write_local_symbols): Likewise.
5536 (map_to_kept_section): Compute output address directly.
5537 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
5538 output_sections and section_offsets.
5539 (Sized_relobj::write_sections): Likewise.
5540 (Sized_relobj::relocate_sections): Likewise.
5541 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
5542 * output.h (class Output_reloc): Update declarations. Change
5543 u2_.relobj to Sized_relobj*.
5544 (class Output_data_reloc): Change add functions to use
5546 * output.cc (Output_reloc::Output_reloc): Change relobj to
5548 (Output_reloc::local_section_offset): Change return type to
5549 Elf_Addr. Use get_output_section_offset.
5550 (Output_reloc::get_address): Likewise.
5551 (Output_section::is_input_address_mapped): Don't call
5552 is_section_specially_mapped.
5553 (Output_section::output_offset): Likewise.
5554 (Output_section::output_address): Likewise.
5555 (Output_section::starting_output_address): Likewise.
5556 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
5557 parameter to Sized_relobj*.
5558 (Copy_relocs::need_copy_reloc): Likewise.
5559 (Copy_relocs::save): Likewise.
5560 * copy-relocs.h (class Copy_relocs): Update declarations.
5561 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
5562 Sized_relobj*. Change relobj_ field to Sized_relobj*.
5563 * target-reloc.h (relocate_for_relocatable): Change
5564 offset_in_output_section type to Elf_Addr. Change code that uses
5566 * layout.cc (Layout::layout): Always set *off.
5567 * mapfile.cc (Mapfile::print_input_section): Use
5568 output_section_offset.
5569 * i386.cc (Target_i386::copy_reloc): Change object parameter to
5571 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
5572 * sparc.cc (Target_sparc::copy_reloc): Likewise.
5573 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
5575 2008-07-03 Ian Lance Taylor <iant@google.com>
5577 * layout.cc (Layout::include_section): Do not discard unrecognized
5578 SHT_STRTAB sections.
5580 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
5582 * script.cc (Lex::can_continue_name): Make '?' allowable in
5583 version-script names.
5584 * testsuite/version_script.map: Change glob pattern to use '?'
5586 2008-06-30 Manish Singh <yosh@gimp.org>
5589 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
5592 2008-06-30 Ian Lance Taylor <iant@google.com>
5596 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
5597 versions]: Don't try to read the value in the contents, since we
5598 don't use it. Use the template endianness when writing.
5600 2008-06-25 Cary Coutant <ccoutant@google.com>
5602 * fileread.cc (File_read::make_view): Assert on zero-length view.
5603 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
5604 symbol table when there are no symbols to read.
5606 2008-06-23 Craig Silverstein <csilvers@google.com>
5608 * version.cc (version_string): Bump to 1.7
5610 2008-06-18 Craig Silverstein <csilvers@google.com>
5612 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
5613 constant 0xFFFF to type Valtype.
5614 (Powerpc_relocate_functions::rel16_ha): Likewise.
5616 2008-06-17 Ian Lance Taylor <iant@google.com>
5618 * output.h (Output_section::Input_section): Initialize p2align_ to
5619 zero for Output_section_data constructors.
5620 (Output_section::Input_section::addralign): If not an input
5621 section, return the alignment of the Output_section_data.
5622 * testsuite/copy_test.cc: New file.
5623 * testsuite/copy_test_1.cc: New file.
5624 * testsuite/copy_test_2.cc: New file.
5625 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
5626 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
5627 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
5628 (copy_test_1_pic.o, copy_test_1.so): New targets.
5629 (copy_test_2_pic.o, copy_test_2.so): New targets.
5630 * testsuite/Makefile.in: Rebuild.
5632 * script-sections.cc (Script_sections::place_orphan): Initialize
5633 local variable exact.
5635 2008-06-13 David Edelsohn <edelsohn@gnu.org>
5637 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
5639 2008-06-12 David Edelsohn <edelsohn@gnu.org>
5640 David S. Miller <davem@davemloft.net>
5642 * powerpc.cc: New file.
5643 * Makefile.am (TARGETSOURCES): Add powerpc.cc
5644 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
5645 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
5646 * Makefile.in: Rebuild.
5648 2008-06-09 Ian Lance Taylor <iant@google.com>
5650 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
5652 (throwing, orig_terminate): New static variables.
5653 (terminate_handler): New static function.
5654 (t2): Set terminate handler.
5656 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
5659 * binary.cc (Binary_to_elf::sized_convert): Fix .data
5662 2008-05-30 Cary Coutant <ccoutant@google.com>
5664 * archive.cc (Archive::include_all_members) Correct to step
5665 over symbol table and extended name table in thin archives.
5667 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
5670 * target-reloc.h (relocate_for_relocatable): Fix new_offset
5673 2008-05-28 Caleb Howe <cshowe@google.com>
5675 * reduced_debug_output.cc: New file.
5676 * reduced_debug_output.h: New file.
5677 * options.h (class General_options): Add --strip-debug-non-line.
5678 * options.cc (General_options::finalize): Add strip_debug_non_line
5679 to the strip heirarchy.
5680 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
5682 * layout.cc: Include "reduced_debug_output.h".
5683 (Layout::Layout): Initialize new fields.
5684 (line_only_debug_sections): New static array.
5685 (is_lines_only_debug_sections): New static inline function.
5686 (Layout::include_section): Handle --strip-debug-non-line.
5687 (Layout::make_output_section): If --strip-debug-non-line, build
5688 new output sections for .debug_abbrev and .debug_info.
5689 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
5690 gold. Warn about possible overflow.
5691 (read_signed_LEB_128): Likewise.
5692 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
5693 (read_signed_LEB_128): Declare.
5694 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
5695 (HFILES): Add reduced_debug_output.h.
5696 * Makefile.in: Rebuild.
5698 2008-05-21 Ian Lance Taylor <iant@google.com>
5700 * mapfile.cc: New file.
5701 * mapfile.h: New file.
5702 * options.h (class General_options): Add -M/--print-map and -Map.
5703 * options.cc (General_options::finalize): Make -M equivalent to
5705 * main.cc: Include <cstdio> and "mapfile.h".
5706 (main): Open mapfile if requested.
5707 * gold.cc (class Middle_runner): Add mapfile_ field. Update
5708 constructor. Change caller.
5709 (queue_initial_tasks): Add mapfile parameter. Change caller.
5710 (queue_middle_tasks): Likewise.
5711 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
5713 * archive.cc: Include "mapfile.h".
5714 (Archive::add_symbols): Add mapfile parameter. Change all
5715 callers. Pass mapfile, symbol, and reason to include_member.
5716 (Archive::include_all_members): Add mapfile parameter. Change all
5718 (Archive::include_member): Add mapfile, sym, and why parameters.
5719 Change all callers. Report inclusion to map file.
5720 * archive.h: Include "fileread.h".
5721 (class Archive): Update declarations.
5722 (Archive::file): New const method.
5723 (class Add_archive_symbols): Add mapfile_ field. Update
5724 constructor. Change all callers.
5725 * readsyms.h (class Read_symbols): Likewise.
5726 (class Finish_group): Likewise.
5727 (class Read_script): Likewise.
5728 * common.cc: Include "mapfile.h".
5729 (Symbol_table::allocate_commons): Add mapfile parameter. Change
5731 (Symbol_table::do_allocate_commons): Likewise.
5732 (Symbol_table::do_allocate_commons_list): Likewise. Report common
5733 symbol allocation to mapfile.
5734 * common.h (class Allocate_commons_task): Add mapfile_ field.
5735 Update constructor. Change all callers.
5736 * symtab.h (class Symbol_table): Update declarations.
5737 * layout.cc: Include "mapfile.h".
5738 (Layout_task_runner::run): Print information to mapfile.
5739 (Layout::create_gold_note): Change Output_data_fixed_space to
5740 Output_data_zero_fill.
5741 (Layout::create_build_id): Likewise.
5742 (Layout::print_to_mapfile): New function.
5743 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
5744 constructor. Change caller.
5745 (class Layout): Declare print_to_mapfile.
5746 * output.cc (Output_section::Input_section::print_to_mapfile): New
5748 (Output_section::add_input_section): If producing a map, always
5749 add to input_sections_ list.
5750 (Output_section::do_print_to_mapfile): New function.
5751 (Output_segment::print_sections_to_mapfile): New function.
5752 (Output_segment::print_section_list_to_mapfile): New function.
5753 * output.h: Include "mapfile.h".
5754 (Output_data::print_to_mapfile): New function.
5755 (Output_data::do_print_to_mapfile): New virtual function.
5756 (Output_segment_headers::do_print_to_mapfile): New function.
5757 (Output_file_header::do_print_to_mapfile): New function.
5758 (Output_data_const::do_print_to_mapfile): New function.
5759 (class Output_data_const_buffer): Add map_name_ field. Update
5760 constructor. Change all callers. Add do_print_to_mapfile
5762 (class Output_data_fixed_space): Likewise.
5763 (class Output_data_space): Likewise.
5764 (class Output_data_zero_fill): New class.
5765 (Output_data_strtab::do_print_to_mapfile): New function.
5766 (Output_data_reloc_base::do_print_to_mapfile): New function.
5767 (Output_relocatable_relocs::do_print_to_mapfile): New function.
5768 (Output_data_group::do_print_to_mapfile): New function.
5769 (Output_data_got::do_print_to_mapfile): New function.
5770 (Output_data_dynamic::do_print_to_mapfile): New function.
5771 (Output_symtab_xindex::do_print_to_mapfile): New function.
5772 (class Output_section): Declare do_print_to_mapflie. Declare
5773 print_to_mapfile in Input_section.
5774 (class Output_segment): Declare new functions.
5775 * object.h (Sized_relobj::symbol_count): New function.
5776 * script-sections.cc
5777 (Output_section_element_dot_assignment::set_section_addresses):
5778 Change Output_data_fixed_space to Output_data_zero_fill.
5779 (Output_data_expression::do_print_to_mapfile): New function.
5780 * script.cc (read_input_script): Add mapfile parameter. Change
5782 * script.h (read_input_script): Update declaration.
5783 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
5784 (Eh_frame::do_print_to_mapfile): New function.
5785 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
5786 (Output_merge_string::do_print_to_mapfile): New function.
5787 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
5789 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
5791 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
5793 * Makefile.am (CCFILES): Add mapfile.cc.
5794 (HFILES): Add mapfile.h.
5795 * Makefile.in: Rebuild.
5797 2008-05-19 Ian Lance Taylor <iant@google.com>
5799 * options.h (class General_options): Add -z relro.
5800 * layout.cc (Layout::Layout): Initialize relro_segment_.
5801 (Layout::add_output_section_data): Return the output section.
5802 (Layout::make_output_section): Rcognize relro sections and mark
5804 (Layout::attach_allocated_section_to_segment): Put relro sections
5805 in a PT_GNU_RELRO segment.
5806 (Layout::create_initial_dynamic_sections): Mark the .dynamic
5808 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
5810 (Layout::linkonce_mapping): Map d.rel.ro.local to
5812 (Layout::output_section_name): Us .data.rel.ro.local for any
5813 section which begins with that.
5814 * layout.h (class Layout): Update add_output_section_data
5815 declaration. Add relro_segment_ field.
5816 * output.cc (Output_section::Output_section): Initialize is_relro_
5817 and is_relro_local_ fields.
5818 (Output_segment::add_output_section): Group relro sections.
5819 (Output_segment::is_first_section_relro): New function.
5820 (Output_segment::maximum_alignment): If there is a relro section,
5821 align the segment to the common page size.
5822 (Output_segment::set_section_addresses): Track whether we are
5823 looking at relro sections. If the last section is a relro
5824 section, align to the common page size.
5825 (Output_segment::set_section_list_addresses): Add in_relro
5826 parameter. Change all callers. Align to the page size when
5827 moving from relro to non-relro section.
5828 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5830 * output.h (class Output_section): Add is_relro_ and
5831 is_relro_local_ fields.
5832 (Output_section::is_relro): New function.
5833 (Output_section::set_is_relro): New function.
5834 (Output_section::is_relro_local): New function.
5835 (Output_section::set_is_relro_local): New function.
5836 (class Output_segment): Update declarations.
5837 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5838 * sparc.cc (Target_sparc::got_section): Likewise.
5839 * x86_64.cc (Target_x86_64::got_section): Likewise.
5840 * testsuite/relro_test_main.cc: New file.
5841 * testsuite/relro_test.cc: New file.
5842 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5843 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5844 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5845 (relro_test.so, relro_test_pic.o): New targets.
5846 * testsuite/Makefile.in: Rebuild.
5848 2008-05-16 Ian Lance Taylor <iant@google.com>
5850 * output.cc (Output_segment::add_output_section): Remove front
5852 * output.h (class Output_segment): Remove
5853 add_initial_output_section and overloaded add_output_section.
5854 Update declaration of remaining add_output_section.
5855 * layout.cc (Layout::create_interp): Call add_output_section
5856 rather than add_initial_output_section.
5857 (Layout::finish_dynamic_section): Likewise.
5859 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5860 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5861 know the dynamic type.
5862 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5863 field. Initialize it in constructor.
5864 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5865 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5866 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5869 * output.cc (Output_reloc::get_address): Change return type to
5871 * output.h (class Output_reloc): Update get_address declaration.
5872 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5873 for section addresses.
5875 2008-05-09 Ian Lance Taylor <iant@google.com>
5878 * gold.cc (gold_nomem): Use return value of write.
5880 2008-05-08 Ian Lance Taylor <iant@google.com>
5882 * symtab.c (Symbol::init_base_output_data): Add version
5883 parameter. Change all callers.
5884 (Symbol::init_base_output_segment): Likewise.
5885 (Symbol::init_base_constant): Likewise.
5886 (Symbol::init_base_undefined): Likewise.
5887 (Sized_symbol::init_output_data): Likewise.
5888 (Sized_symbol::init_output_segment): Likewise.
5889 (Sized_symbol::init_constant): Likewise.
5890 (Sized_symbol::init_undefined): Likewise.
5891 (Symbol_table::do_define_in_output_data): If the new symbol has a
5892 version, mark it as the default.
5893 (Symbol_table::do_define_in_output_segment): Likewise.
5894 (Symbol_table::do_define_as_constant): Likewise.
5895 * symtab.h (class Symbol): Update declarations.
5896 (class Sized_symbol): Likewise.
5897 * resolve.cc (Symbol::override_version): New function.
5898 (Symbol::override_base): Call override_version.
5899 (Symbol::override_base_with_special): Likewise.
5900 * testsuite/ver_script_8.script: New file.
5901 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5902 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5903 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5904 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5906 2008-05-06 Ian Lance Taylor <iant@google.com>
5909 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5911 (class General_options): Remove existing --undefined, and add
5912 --no-undefined instead. Add new --undefined as synonym for -u.
5913 * archive.cc (Archive::add_symbols): Check whether symbol was
5915 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5916 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5917 all uses. Add IS_UNDEFINED. Update declarations to split
5918 different versions of init_base. Declare init_base_undefined.
5919 (Symbol::is_defined): Handle IS_UNDEFINED.
5920 (Symbol::is_undefined): Likewise.
5921 (Symbol::is_weak_undefined): Call is_undefined.
5922 (Symbol::is_absolute): Handle IS_CONSTANT.
5923 (class Sized_symbol): Update declarations to split different
5924 versions of init. Declare init_undefined.
5925 (class Symbol_table): Declare new functions.
5926 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5928 (Symbol::init_base_output_data): Likewise.
5929 (Symbol::init_base_output_segment): Likewise.
5930 (Symbol::init_base_constant): Likewise.
5931 (Symbol::init_base_undefined): New function.
5932 (Sized_symbol::init_object): Rename from init. Change all
5934 (Sized_symbol::init_output_data): Likewise.
5935 (Sized_symbol::init_output_segment): Likewise.
5936 (Sized_symbol::init_constant): Likewise.
5937 (Sized_symbol::init_undefined): New function.
5938 (Symbol_table::add_undefined_symbols_from_command_line): New
5940 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5942 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5943 (Symbol::output_section): Likewise.
5944 (Symbol::set_output_section): Likewise.
5945 (Symbol_table::sized_finalize_symbol): Likewise.
5946 (Symbol_table::sized_write_globals): Likewise.
5947 * resolve.cc (Symbol_table::should_override): Likewise.
5948 (Symbol::override_base_with_special): Likewise.
5950 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5951 symbol, change it to have default visibility.
5952 * testsuite/protected_1.cc: New file.
5953 * testsuite/protected_2.cc: New file.
5954 * testsuite/protected_3.cc: New file.
5955 * testsuite/protected_main_1.cc: New file.
5956 * testsuite/protected_main_2.cc: New file.
5957 * testsuite/protected_main_3.cc: New file.
5958 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5959 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5960 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5961 (protected_1.so): New target.
5962 (protected_1_pic.o, protected_2_pic.o): New targets.
5963 (protected_3_pic.o): New target.
5964 (check_PROGRAMS): Add protected_2.
5965 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5966 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5967 * testsuite/Makefile.in: Rebuild.
5969 * options.h (DEFINE_var): Add set_user_set_##varname__.
5970 (DEFINE_bool_alias): New macro.
5971 (class General_options): Define -Bstatic using DEFINE_bool_alias
5972 rather than DEFINE_special. Add --undefined as an alias for -z
5974 * options.cc (General_options::parse_Bstatic): Remove.
5976 * options.h (class General_options): Add --fatal-warnings.
5977 * main.cc (main): Implement --fatal-warnings.
5978 * errors.h (Errors::warning_count): New function.
5980 * options.h (class General_options): Add -Bsymbolic-functions.
5981 * symtab.h (Symbol::is_preemptible): Check for
5982 -Bsymbolic-functions.
5984 2008-05-05 Ian Lance Taylor <iant@google.com>
5986 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5987 as noVARNAME rather than no-VARNAME.
5988 (class General_options): Add option -z combreloc.
5989 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5991 (Output_reloc::sort_before) [SHT_REL]: New function.
5992 (Output_reloc::sort_before) [SHT_RELA]: New function.
5993 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5994 Sort_relocs_comparison.
5995 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5996 parameter. Change all callers.
5997 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5998 sort_relocs parameter. Change all callers.
5999 * output.cc (Output_reloc::get_address): New function, broken out
6001 (Output_reloc::write_rel): Call it.
6002 (Output_reloc::compare): New function.
6003 (Output_data_reloc_base::do_write): Optionally sort relocs.
6005 * configure.ac: If targ_extra_obj is set, link it in.
6006 * configure.tgt: Initialize all variables.
6007 (x86_64*): Set targ_extra_obj and targ_extra_size.
6008 * configure: Rebuild.
6010 * object.cc (Sized_relobj::include_section_group): Adjust section
6011 indexes read from group data. Build vector to pass to
6013 * layout.cc (Layout::layout_group): Add flags and shndxes
6014 parameters. Remove contents parameter. Change caller. Update
6015 explicit instantiations.
6016 * layout.h (class Layout): Update layout_group declaration.
6017 * output.cc (Output_data_group::Output_data_group): Add flags and
6018 input_shndxes parameters. Remove contents parameter. Change
6020 (Output_data_group::do_write): Change input_sections_ to
6022 * output.h (class Output_data_group): Update constructor
6023 declaration. Rename input_sections_ to input_shndxes_.
6024 * testsuite/many_sections_test.cc: Add template.
6026 2008-04-30 Cary Coutant <ccoutant@google.com>
6028 * target-reloc.h (relocate_section): Fix dead-pointer bug.
6030 * layout.cc (Layout::include_section): Refactored check for debug
6032 (Layout::add_comdat): Add new parameters. Change type
6033 of signature parameter. Add object and shndx to signatures table.
6034 (Layout::find_kept_object): New function.
6035 * layout.h: Include <cstring>.
6036 (Layout::is_debug_info_section): New function.
6037 (Layout::add_comdat): Add new parameters.
6038 (Layout::find_kept_object): New function.
6039 (Layout::Kept_section): New struct.
6040 (Layout::Signatures): Change type of map range.
6041 * object.cc (Relobj::output_section_address): New function.
6042 (Sized_relobj::include_section_group): Add new parameters. Change
6043 calls to Layout::add_comdat. Change to build table of kept comdat
6044 groups and table mapping discarded sections to kept sections.
6045 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
6046 (Sized_relobj::do_layout): Change calls to include_section_group and
6047 include_linkonce_section.
6048 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
6049 value to zero when section is discarded.
6050 (Sized_relobj::map_to_kept_section): New function.
6051 * object.h (Relobj::output_section_address): New function.
6052 (Relobj::Comdat_group): New type.
6053 (Relobj::find_comdat_group): New function.
6054 (Relobj::Comdat_group_table): New type.
6055 (Relobj::Kept_comdat_section): New type.
6056 (Relobj::Kept_comdat_section_table): New type.
6057 (Relobj::add_comdat_group): New function.
6058 (Relobj::set_kept_comdat_section): New function.
6059 (Relobj::get_kept_comdat_section): New function.
6060 (Relobj::comdat_groups_): New field.
6061 (Relobj::kept_comdat_sections_): New field.
6062 (Symbol_value::input_value): Update comment.
6063 (Sized_relobj::map_to_kept_section) New function.
6064 (Sized_relobj::include_linkonce_section): Add new parameter.
6065 * target-reloc.h (Comdat_behavior): New type.
6066 (get_comdat_behavior): New function.
6067 (relocate_section): Add code to map a discarded section to the
6068 corresponding kept section when applying a relocation.
6070 2008-04-30 Craig Silverstein <csilvers@google.com>
6072 * dwarf_reader.cc (next_generation_count): New static var.
6073 (Addr2line_cache_entry): New struct.
6074 (addr2line_cache): New static var.
6075 (Dwarf_line_info::one_addr2line): Added caching.
6076 (Dwarf_line_info::clear_addr2line_cache): New function.
6077 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
6078 cache-size parameter.
6079 (Dwarf_line_info::one_addr2line_cache): New function.
6080 * symtab.cc (Symbol_table::detect_odr_violations): Pass
6081 new cache-size argument to one_addr2line(), and clear cache.
6083 2008-04-28 Cary Coutant <ccoutant@google.com>
6085 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
6086 R_386_PC8 relocations.
6088 2008-04-23 Ian Lance Taylor <iant@google.com>
6090 * object.cc (Sized_relobj::include_section_group): Check for
6091 invalid section group.
6093 * object.cc (make_elf_object): Correct test for 64-bit ELF file
6096 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
6097 than read for file header.
6098 * archive.cc (Archive::include_member): Likewise.
6100 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
6102 * aclocal.m4: Regenerate.
6103 * configure: Regenerate.
6105 2008-04-19 Ian Lance Taylor <iant@google.com>
6107 * version.cc (version_string): Bump to 1.6.
6109 * testsuite/Makefile.am (many_sections_r_test): New target.
6110 (many_sections_r_test_SOURCES): Remove.
6111 (many_sections_r_test_DEPENDENCIES): Remove.
6112 (many_sections_r_test_LDFLAGS): Remove.
6113 (many_sections_r_test_LDADD): Remove.
6115 * object.cc (Sized_relobj::do_add_symbols): Always pass
6116 local_symbol_count_ to add_from_relobj.
6118 * testsuite/Makefile.am (many_sections_check.h): Only check one in
6119 every thousand variables.
6120 * testsuite/Makefile.in: Rebuild.
6122 * object.cc (Xindex::initialize_symtab_xindex): New function.
6123 (Xindex::read_symtab_xindex): New function.
6124 (Xindex::sym_xindex_to_shndx): New function.
6125 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
6127 (Sized_relobj::do_initialize_xindex): New function.
6128 (Sized_relobj::do_read_symbols): Adjust section links.
6129 (Sized_relobj::symbol_section_and_value): Add is_ordinary
6130 parameter. Change all callers.
6131 (Sized_relobj::include_section_group): Adjust section links and
6132 symbol section indexes.
6133 (Sized_relobj::do_layout): Adjust section links.
6134 (Sized_relobj::do_count_local_symbols): Adjust section links and
6135 symbol section indexes.
6136 (Sized_relobj::do_finalize_local_symbols): Distinguish between
6137 ordinary and special symbols.
6138 (Sized_relobj::write_local_symbols): Add symtab_xindex and
6139 dynsym_xindex parameters. Change all callers. Adjust section
6140 links. Use SHN_XINDEX when needed.
6141 (Sized_relobj::get_symbol_location_info): Adjust section links.
6142 Don't get fooled by special symbols.
6143 * object.h (class Xindex): Define.
6144 (class Object): Add xindex_ parameter. Declare virtual functoin
6145 do_initialize_xindex.
6146 (Object::adjust_sym_shndx): New function.
6147 (Object::set_xindex): New protected function.
6148 (class Symbol_value): Add is_ordinary_shndx_ field.
6149 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
6150 (Symbol_value::value): Assert ordinary section.
6151 (Symbol_value::initialize_input_to_output_map): Likewise.
6152 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
6154 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
6156 (class Sized_relobj): Update declarations.
6157 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
6158 parameter. Change all callers.
6159 (Sized_relobj::adjust_shndx): New function.
6160 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
6162 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
6163 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
6164 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
6165 (Sized_dynobj::read_dynsym_section): Adjust section links.
6166 (Sized_dynobj::read_dynamic): Likewise.
6167 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
6169 (Sized_dynobj::do_initialize_xindex): New function.
6170 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
6171 do_initialize_xindex.
6172 (Sized_dynobj::adjust_shndx): New function.
6173 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
6174 dynsym_xindex_ fields.
6175 (Layout::finalize): Add a call to set_section_indexes before
6176 creating the symtab sections.
6177 (Layout::set_section_indexes): Don't do anything if the section
6178 already has a section index.
6179 (Layout::create_symtab_sections): Add shnum parameter. Change
6180 caller. Create .symtab_shndx section if needed.
6181 (Layout::create_shdrs): Add shstrtab_section parameter. Change
6183 (Layout::allocated_output_section_count): New function.
6184 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
6186 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
6187 fields. Update declarations.
6188 (Layout::symtab_xindex): New function.
6189 (Layout::dynsym_xindex): New function.
6190 (class Write_symbols_task): Add layout_ field.
6191 (Write_symbols_task::Write_symbols_task): Add layout parameter.
6193 * output.cc (Output_section_headers::Output_section_headers): Add
6194 shstrtab_section parameter. Change all callers.
6195 (Output_section_headers::do_sized_write): Store overflow values
6196 for section count and section string table section index in
6197 section header zero.
6198 (Output_file_header::do_sized_write): Check for overflow of
6199 section count and section string table section index.
6200 (Output_symtab_xindex::do_write): New function.
6201 (Output_symtab_xindex::endian_do_write): New function.
6202 * output.h (class Output_section_headers): Add shstrtab_section_.
6203 Update declarations.
6204 (class Output_symtab_xindex): Define.
6205 (Output_section::has_out_shndx): New function.
6206 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
6208 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
6210 (Sized_symbol::init): Likewise.
6211 (Symbol::output_section): Check for ordinary symbol.
6212 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
6213 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
6215 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
6216 Change all callers. Simplify handling of symbols from sections
6217 not included in the link.
6218 (Symbol_table::add_from_dynobj): Handle ordinary symbol
6220 (Weak_alias_sorter::operator()): Assert that symbols are
6222 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
6224 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
6225 parameters. Change all callers.
6226 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
6227 symbol distinction. Use SHN_XINDEX when needed.
6228 (Symbol_table::write_section_symbol): Add symtab_xindex
6229 parameter. Change all callers.
6230 (Symbol_table::sized_write_section_symbol): Likewise. Use
6231 SHN_XINDEX when needed.
6232 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
6234 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
6235 (Symbol::is_defined): Check is_ordinary.
6236 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
6237 (Symbol::is_absolute, Symbol::is_common): Likewise.
6238 (class Sized_symbol): Update declarations.
6239 (class Symbol_table): Update declarations.
6240 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
6241 parameters. Change all callers.
6242 (Sized_symbol::override): Likewise.
6243 (Symbol_table::override): Likewise.
6244 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
6245 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
6246 is_ordinary, and orig_st_shndx parameters. Change all callers.
6247 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
6248 to be in an ordinary section.
6249 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
6250 object and is_ordinary parameters. Change all callers.
6251 (Sized_dwarf_line_info::read_relocs): Add object parameter.
6252 Change all callers. Don't add undefined or non-ordinary symbols
6254 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
6256 * dwarf_reader.h (class Sized_dwarf_line_info): Update
6258 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
6259 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
6260 (Sized_relobj::relocate_sections): Likewise.
6261 * target-reloc.h (scan_relocs): Adjust section symbol index.
6262 (scan_relocatable_relocs): Likewise.
6263 * i386.cc (Scan::local): Check for ordinary symbols.
6264 * sparc.cc (Scan::local): Likewise.
6265 * x86_64.cc (Scan::local): Likewise.
6266 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
6267 to symbol_section_and_value.
6268 * testsuite/many_sections_test.cc: New file.
6269 * testsuite/Makefile.am (BUILT_SOURCES): Define.
6270 (check_PROGRAMS): Add many_sections_test.
6271 (many_sections_test_SOURCES): Define.
6272 (many_sections_test_DEPENDENCIES): Define.
6273 (many_sections_test_LDFLAGS): Define.
6274 (BUILT_SOURCES): Add many_sections_define.h.
6275 (many_sections_define.h): New target.
6276 (BUILT_SOURCES): Add many_sections_check.h.
6277 (many_sections_check.h): New target.
6278 (check_PROGRAMS): Add many_sections_r_test.
6279 (many_sections_r_test_SOURCES): Define.
6280 (many_sections_r_test_DEPENDENCIES): Define.
6281 (many_sections_r_test_LDFLAGS): Define.
6282 (many_sections_r_test_LDADD): Define.
6283 (many_sections_r_test.o): New target.
6284 * testsuite/Makefile.in: Rebuild.
6286 2008-04-17 Cary Coutant <ccoutant@google.com>
6288 * errors.cc (Errors::info): New function.
6289 (gold_info): New function.
6290 * errors.h (Errors::info): New function.
6291 * gold.h (gold_info): New function.
6292 * object.cc (Input_objects::add_object): Print trace output.
6293 * options.cc (options::parse_set): New function.
6294 (General_options::parse_wrap): Deleted.
6295 (General_options::General_options): Deleted initializer.
6296 * options.h (options::String_set): New typedef.
6297 (options::parse_set): New function.
6298 (DEFINE_set): New macro.
6299 (General_options::wrap): Changed to use DEFINE_set. Changed
6300 callers of any_wrap_symbols and is_wrap_symbol.
6301 (General_options::trace, General_options::trace_symbol):
6303 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
6304 (General_options::wrap_symbols_): Deleted.
6305 * symtab.cc (Symbol_table::add_from_object): Print trace output.
6307 2008-04-17 David S. Miller <davem@davemloft.net>
6309 * options.cc (General_options::parse_V): New function.
6310 * options.h: Add entries for -V and -Qy.
6312 2008-04-17 Ian Lance Taylor <iant@google.com>
6314 * common.cc (Symbol_table::allocate_commons): Remove options
6315 parameter. Change caller.
6316 (Symbol_table::do_allocate_commons): Remove options parameter.
6317 Change caller. Just call do_allocate_commons_list twice.
6318 (Symbol_table::do_allocate_commons_list): New function, broken out
6319 of do_allocate_commons.
6320 * common.h (class Allocate_commons_task): Remove options_ field.
6322 * symtab.cc (Symbol_table::Symbol_table): Initialize
6324 (Symbol_table::add_from_object): Put TLS common symbols on
6326 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
6327 which are IN_OUTPUT_DATA.
6328 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
6329 allocate_commons and do_allocate_commons declarations. Declare
6330 do_allocate_commons_list.
6331 * gold.cc (queue_middle_tasks): Update creation of
6332 Allocate_commons_task to not pass options.
6333 * testsuite/Makefile.am (INCLUDES): Add -I.. .
6334 (TLS_TEST_C_FLAGS): New variable.
6335 (tls_test_c_pic.o): New target.
6336 (tls_test_shared.so): Link in tls_test_c_pic.o.
6337 (tls_test_c_pic_ie.o): New target.
6338 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
6339 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
6340 (tls_test_c.o): New target.
6341 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
6342 (tls_pic_test_LDADD): Likewise.
6343 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
6344 (tls_shared_gd_to_ie_test_LDADD): Likewise.
6345 (tls_test_c_gnu2.o): New target.
6346 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
6348 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
6349 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
6350 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
6351 * testsuite/tls_test.cc: Include "config.h".
6352 (t_last): Call t11_last.
6353 * testsuite/tls_test.h (t11, t11_last): Declare.
6354 * testsuite/tls_test_c.c: New file.
6355 * testsuite/tls_test_main.cc (thread_routine): Call t11.
6356 * configure.ac: Check for OpenMP support.
6357 * configure, config.in, Makefile.in: Rebuild.
6358 * testsuite/Makefile.in: Rebuild.
6360 2008-04-16 Cary Coutant <ccoutant@google.com>
6362 * i386.cc (Target_i386::define_tls_base_symbol): New function.
6363 (Target_i386::tls_base_symbol_defined_): New field.
6364 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6365 (Target_i386::Scan::global): Likewise.
6366 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
6367 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
6368 (Target_x86_64::tls_base_symbol_defined_): New field.
6369 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
6370 (Target_x86_64::Scan::global): Likewise.
6372 2008-04-16 Cary Coutant <ccoutant@google.com>
6374 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
6375 (Symbol::needs_plt_entry): Allow weak undefined symbols.
6376 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
6377 building shared libraries.
6378 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
6379 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
6380 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
6381 * testsuite/Makefile.in: Rebuild.
6382 * testsuite/weak_undef.h: New file.
6383 * testsuite/weak_undef_file1.cc: Add extra test cases.
6384 * testsuite/weak_undef_file2.cc: Likewise.
6385 * testsuite/weak_undef_test.cc: Likewise.
6387 2008-04-16 David S. Miller <davem@davemloft.net>
6389 * sparc.cc (Target_sparc::Scan): Change from struct to class.
6390 Add issued_non_pic_error_ field. Declare check_non_pic.
6391 (Target_sparc::Scan::check_non_pic): New function.
6392 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
6393 (Target_sparc::Scan::global): Likewise.
6395 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
6396 * configure: Rebuild.
6398 * options.h (DEFINE_enable): New macro.
6399 (new_dtags): New enable option.
6400 (initfirst, interpose, loadfltr, nodefaultlib,
6401 nodelete, nodlopen, nodump): New -z options.
6402 * layout.cc (Layout:finish_dynamic_section): If new
6403 dtags enabled, emit DT_RUNPATH. Also, emit a
6404 DT_FLAGS_1 containing any specified -z flags.
6406 2008-04-16 Ian Lance Taylor <iant@google.com>
6408 * copy-relocs.cc: New file.
6409 * copy-relocs.h: New file.
6410 * reloc.cc: Remove Copy_relocs code.
6411 * reloc.h: Likewise.
6412 * reloc-types.h (struct Reloc_types) [both versions]: Add
6413 get_reloc_addend_noerror.
6414 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
6415 variants of add_global which take an addend which must be zero.
6416 * i386.cc: Include "copy-relocs.h".
6417 (class Target_i386): Change type of copy_relocs_ to variable,
6419 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
6421 (Target_i386::do_finalize_sections): Change handling of
6423 * sparc.cc: Include "copy-relocs.h".
6424 (class Target_sparc): Change type of copy_relocs_ to variable,
6426 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
6428 (Target_sparc::do_finalize_sections): Change handling of
6430 * x86_64.cc: Include "copy-relocs.h".
6431 (class Target_x86_64): Change type of copy_relocs_ to variable,
6433 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
6434 class. Change all callers.
6435 (Target_x86_64::do_finalize_sections): Change handling of
6437 * Makefile.am (CCFILES): Add copy-relocs.cc.
6438 (HFILES): Add copy-relocs.h.
6440 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
6442 * testsuite/script_test_4.sh: Permit leading zeroes.
6444 2008-04-15 Ian Lance Taylor <iant@google.com>
6446 * script-sections.cc (Script_sections::create_segments): Use
6447 header_size_adjustment even when there is enough room for the
6449 * testsuite/script_test_4.sh: New file.
6450 * testsuite/script_test_4.t: New file.
6451 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
6452 (check_DATA): Add script_test_4.stdout.
6453 (MOSTLYCLEANFILES): Likewise.
6454 (script_test_4): New target.
6455 (script_test_4.stdout): New target.
6456 * testsuite/Makefile.in: Rebuild.
6458 * sparc.cc: Add definitions for Output_data_plt_sparc class
6461 2008-04-14 David S. Miller <davem@davemloft.net>
6463 * sparc.cc: New file.
6464 * Makefile.am (TARGETSOURCES): Add sparc.cc
6465 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
6466 * configure.tgt: Document targ_extra_size and
6467 targ_extra_big_endian. Add entries for sparc-* and
6469 * configure.ac: Handle targ_extra_size and
6470 targ_extra_big_endian.
6471 * Makefile.in: Rebuild.
6472 * configure: Likewise.
6473 * po/POTFILES.in: Likewise.
6474 * po/gold.pot: Likewise.
6476 2008-04-14 Ian Lance Taylor <iant@google.com>
6478 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
6479 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
6480 in the name/type/flags to section mapping. Don't call
6481 allocate_output_section.
6482 (Layout::choose_output_section): Change parameter from adjust_name
6483 to is_input_section. Don't permit input sections after sections
6484 are attached to segments. Don't call allocate_output_section.
6485 (Layout::layout_eh_frame): Call update_flags_for_input_section,
6486 not write_enable_output_section.
6487 (Layout::make_output_section): Don't push to
6488 unattached_section_list_ nor call attach_to_segment. Call
6489 attach_section_to_segment if sections are attached.
6490 (Layout::attach_sections_to_segments): New function.
6491 (Layout::attach_section_to_segment): New function.
6492 (Layout::attach_allocated_section_to_segment): Rename from
6493 attach_to_segment. Remove flags parameter.
6494 (Layout::allocate_output_section): Remove function.
6495 (Layout::write_enable_output_section): Remove function.
6496 * layout.h (class Layout): Update for above changes. Add new
6497 field sections_are_attached_.
6498 * output.h (Output_section::update_flags_for_input_section): New
6500 * output.cc (Output_section::add_input_section): Call
6501 update_flags_for_input_section.
6502 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
6504 2008-04-11 Cary Coutant <ccoutant@google.com>
6506 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
6507 thought unnecessary.
6508 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
6510 2008-04-11 Ian Lance Taylor <iant@google.com>
6512 * output.h (class Output_section_data): Remove inline definition
6514 * output.cc (Output_section_data::set_addralign): New function.
6516 2008-04-11 Cary Coutant <ccoutant@google.com>
6518 Add support for TLS descriptors for i386 and x86_64.
6519 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
6520 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
6521 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
6523 (Target_i386::got_mod_index_entry): Remove unnecessary code.
6524 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
6525 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
6527 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
6528 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
6529 Fix problem with initial-exec relocations.
6530 (Target_i386::Relocate::relocate_tls): Likewise.
6531 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
6533 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
6534 support for section-plus-offset dynamic table entries.
6535 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
6536 (Output_data_dynamic::Dynamic_entry): Add support for
6537 section-plus-offset dynamic table entries.
6538 (Output_data_dynamic::Classification): Likewise.
6539 (Output_data_dynamic::classification_): Renamed offset_.
6540 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
6541 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
6542 (Target_x86_64::make_plt_section): New function.
6543 (Target_x86_64::reserve_tlsdesc_entries): New function.
6544 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
6545 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
6546 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
6547 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
6548 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
6549 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
6550 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
6551 add extra PLT entry for TLS descriptors.
6552 (Output_data_plt_x86_64::got_): New field.
6553 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
6554 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
6556 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
6558 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
6559 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
6560 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
6561 R_386_TLS_DESC_CALL relocations.
6562 (Target_x86_64::Scan::global): Likewise.
6563 (Target_x86_64::do_finalize_sections): Add dynamic table entries
6564 for TLS descriptors.
6565 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
6566 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
6567 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
6568 GD-to-IE relaxation.
6569 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
6570 and TLS_DESCRIPTORS.
6571 * Makefile.in: Rebuild.
6572 * configure: Rebuild.
6573 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
6574 (tls_test_shared2.so): New target.
6575 (tls_shared_gd_to_ie_test_SOURCES): New variable.
6576 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
6577 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
6578 (tls_shared_gd_to_ie_test_LDADD): New variable.
6579 (tls_shared_gnu2_gd_to_ie_test): New target.
6580 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
6582 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
6583 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
6584 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
6585 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
6586 (tls_shared_gnu2_test): New target.
6587 (tls_test_gnu2_shared.so): New target.
6588 (tls_shared_gnu2_test_SOURCES): New variable.
6589 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
6590 (tls_shared_gnu2_test_LDFLAGS): New variable.
6591 (tls_shared_gnu2_test_LDADD): New variable.
6592 * testsuite/Makefile.in: Rebuild.
6593 * testsuite/Makefile.
6595 2008-04-11 Ian Lance Taylor <iant@google.com>
6597 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
6599 * testsuite/Makefile.in: Rebuild.
6601 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
6603 * testsuite/script_test_2.cc (main): Adjust test.
6605 2008-04-11 David S. Miller <davem@davemloft.net>
6606 Ian Lance Taylor <iant@google.com>
6608 * options.h (General_options): Add entries for '-Y' and
6610 * options.cc (General_options:finalize): If -Y was used, add those
6611 entries to the library path instead of the default "/lib" and
6614 2008-04-11 David S. Miller <davem@davemloft.net>
6616 * testsuite/justsyms.t: Start at 0x100.
6617 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
6618 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
6620 * testsuite/script_test_2.cc: Adjust string and section length
6623 2008-04-09 Ian Lance Taylor <iant@google.com>
6626 * script-sections.cc (Sections_element::allocate_to_segment): Add
6628 (Output_section_definition::allocate_to_segment): Likewise.
6629 (Orphan_output_section::allocate_to_segment): Likewise.
6630 (Script_sections::attach_sections_using_phdrs_clause): Don't
6631 propagate non-PT_LOAD segments to orphan sections.
6632 * testsuite/Makefile.am (script_test_3.stdout): Generate using
6633 readelf rather than objdump.
6634 * testsuite/script_test_3.sh: Adjust accordingly. Test that
6635 .interp section and PT_INTERP segment are the same size.
6636 * testsuite/Makefile.in: Rebuild.
6638 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
6639 aliases for symbols defined in the same object.
6640 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
6641 (weak_alias_test_SOURCES): New variable.
6642 (weak_alias_test_DEPENDENCIES): New variable.
6643 (weak_alias_test_LDFLAGS): New variable.
6644 (weak_alias_test_LDADD): New variable.
6645 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
6646 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
6647 (weak_alias_test_3.o): New target.
6648 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
6649 * testsuite/weak_alias_test_main.cc: New file.
6650 * testsuite/weak_alias_test_1.cc: New file.
6651 * testsuite/weak_alias_test_2.cc: New file.
6652 * testsuite/weak_alias_test_3.cc: New file.
6654 2008-04-08 Ian Lance Taylor <iant@google.com>
6656 * options.h (class General_options): Add --noinhibit-exec option.
6657 * main.cc (main): Check --noinhibit-exec.
6659 * options.h (class General_options): Define --wrap as a special
6660 option. Add wrap_symbols_ field.
6661 (General_options::any_wrap_symbols): New function.
6662 (General_options::is_wrap_symbol): New function.
6663 * options.cc (General_options::parse_wrap): New function.
6664 (General_options::General_options): Initialize wrap_symbols_.
6665 * symtab.cc (Symbol_table::wrap_symbol): New function.
6666 (Symbol_table::add_from_object): Handle --wrap.
6667 * symtab.h (class Symbol_table): Declare wrap_symbol.
6668 * target.h (Target::wrap_char): New function.
6669 (Target::Target_info): Add wrap_char field.
6670 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
6671 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6672 * testsuite/testfile.cc (Target_test::test_target_info):
6675 * errors.cc (Errors::undefined_symbol): Mention symbol version if
6678 * layout.h (class Layout): Add added_eh_frame_data_ field.
6679 * layout.cc (Layout::Layout): Initialize new field.
6680 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
6681 output section until we find a section we merged successfully.
6682 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
6683 that the size be non-zero.
6685 * merge.cc (Object_merge_map::get_output_offset): Remove inline
6688 2008-04-08 Craig Silverstein <csilvers@google.com>
6690 * configure.ac: Export new conditional variable HAVE_ZLIB.
6691 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
6693 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
6694 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6696 2008-04-07 Ian Lance Taylor <iant@google.com>
6698 * version.cc (version_string): Set to "1.5".
6700 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
6701 Add issued_non_pic_error_ field. Declare check_non_pic.
6702 (Target_x86_64::Scan::check_non_pic): New function.
6703 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
6704 (Target_x86_64::Scan::global): Likewise.
6706 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
6707 addend parameter. Change caller. Handle merge sections.
6708 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
6709 Address to Addend. Don't add in the result of
6710 local_section_offset, pass down the addend and use the returned
6712 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
6713 Update declarations of local_section_offset and symbol_value.
6714 * testsuite/two_file_test_1.cc (t18): New function.
6715 * testsuite/two_file_test_2.cc (f18): New function.
6716 * testsuite/two_file_test_main.cc (main): Call t18.
6717 * testsuite/two_file_test.h (t18, f18): Declare.
6719 * configure.ac: Don't test for objdump, c++filt, or readelf.
6720 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
6722 (TEST_READELF): New variable.
6723 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
6724 (check_PROGRAMS): Add two_file_strip_test.
6725 (two_file_strip_test): New target.
6726 (check_PROGRAMS): Add two_file_same_shared_strip_test.
6727 (two_file_same_shared_strip_test_SOURCES): New variable.
6728 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
6729 (two_file_same_shared_strip_test_LDFLAGS): New variable.
6730 (two_file_same_shared_strip_test_LDADD): New variable.
6731 (two_file_shared_strip.so): New target.
6732 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
6733 (ver_test_5.syms, ver_test_7.syms): Likewise.
6734 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
6735 (strip_test_3.stdout): Use TEST_OBJDUMP.
6736 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6738 2008-04-04 Cary Coutant <ccoutant@google.com>
6740 * symtab.h (Symbol::is_weak_undefined): New function.
6741 (Symbol::is_strong_undefined): New function.
6742 (Symbol::is_absolute): New function.
6743 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
6744 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
6746 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
6747 (weak_undef_test): New target.
6748 * testsuite/Makefile.in: Rebuild.
6749 * testsuite/weak_undef_file1.cc: New file.
6750 * testsuite/weak_undef_file2.cc: New file.
6751 * testsuite/weak_undef_test.cc: New file.
6753 2008-04-03 Craig Silverstein <csilvers@google.com>
6755 * compressed_output.h (class Output_compressed_section): Use
6757 * compressed_output.cc (zlib_compress): Use unsigned buffers,
6759 (zlib_compressed_suffix): Removed.
6760 (Output_compressed_section::set_final_data_size): Use unsigned
6762 * testsuite/Makefile.am (flagstest_compress_debug_sections):
6763 Fix linker invocation.
6764 (flagstest_o_specialfile_and_compress_debug_sections):
6766 * testsuite/Makefile.in: Regenerated.
6768 2008-04-02 David S. Miller <davem@davemloft.net>
6770 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
6771 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
6773 2008-04-02 Craig Silverstein <csilvers@google.com>
6777 2008-04-02 Ian Lance Taylor <iant@google.com>
6779 * fileread.cc (File_read::find_view): Add byteshift and vshifted
6780 parameters. Update for new key type to views_. Change all
6782 (File_read::read): Adjust for byteshift in returned view.
6783 (File_read::add_view): New function, broken out of
6785 (File_read::make_view): New function, broken out of
6787 (File_read::find_or_make_view): Add offset and aligned
6788 parameters. Rewrite accordingly. Change all callers.
6789 (File_read::get_view): Add offset and aligned parameters. Adjust
6790 for byteshift in return value.
6791 (File_read::get_lasting_view): Likewise.
6792 * fileread.h (class File_read): Update declarations.
6793 (class File_read::View): Add byteshift_ field. Add byteshift to
6794 constructor. Add byteshift method.
6795 * archive.h (Archive::clear_uncached_views): New function.
6796 (Archive::get_view): Add aligned parameter. Change all callers.
6797 * object.h (Object::get_view): Add aligned parameter. Change all
6799 (Object::get_lasting_view): Likewise.
6801 * fileread.cc (File_read::release): Don't call clear_views if
6802 there are multiple objects.
6803 * fileread.h (File_read::clear_uncached_views): New function.
6804 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
6807 2008-03-31 Cary Coutant <ccoutant@google.com>
6809 Add thin archive support.
6810 * archive.cc (Archive::armagt): New const.
6811 (Archive::setup): Remove task parameter and calls to unlock.
6812 (Archive::unlock_nested_archives): New function.
6813 (Archive::read_header): Add nested_off parameter. Change
6815 (Archive::interpret_header): Likewise.
6816 (Archive::include_all_members): Change to handle thin
6818 (Archive::include_member): Likewise.
6819 * archive.h (Archive::Archive): Add new parameters and
6821 (Archive::armagt): New const.
6822 (Archive::setup): Remove task parameter.
6823 (Archive::unlock_nested_archives): New function.
6824 (Archive::read_header): Add nested_off parameter.
6825 (Archive::interpret_header): Likewise.
6826 (Archive::Nested_archive_table): New typedef.
6827 (Archive::is_thin_archive_): New field.
6828 (Archive::nested_archives_): New field.
6829 (Archive::options_): New field.
6830 (Archive::dirpath_): New field.
6831 (Archive::task_): New field.
6832 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6833 for thin archives. Pass additional parameters to
6834 Archive::Archive. Unlock the archive file after calling
6837 2008-03-29 Ian Lance Taylor <iant@google.com>
6839 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6840 version symbol to be local.
6841 * testsuite/ver_test_4.sh: New file.
6842 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6843 (check_DATA): Add ver_test_4.syms.
6844 (ver_test_4.syms): New target.
6845 * testsuite/Makefile.in: Rebuild.
6848 (Output_section::Input_section_sort_entry::has_priority): New
6850 (Output_section::Input_section_sort_entry::match_file_name): New
6852 (Output_section::Input_section_sort_entry::match_section_name):
6854 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6856 (Output_section::Input_section_sort_entry::match_section_file):
6858 (Output_section::Input_section_sort_compare::operator()): Rewrite
6859 using new Input_section_sort_entry functions. Sort crtbegin and
6860 crtend first. Sort sections with no priority before sections with
6862 * testsuite/initpri1.c (d3): Check j != 4.
6863 (cd5): New constructor/destructor function.
6864 (main): Check j != 2.
6866 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6867 new symbol when resolving, don't call set_is_default.
6868 * testsuite/ver_test_7.cc: New file.
6869 * testsuite/ver_test_7.sh: New file.
6870 * testsuite/Makefile.am (ver_test_7.so): New target.
6871 (ver_test_7.o): New target.
6872 (check_SCRIPTS): Add ver_test_7.sh.
6873 (check_DATA): Add ver_test_7.syms.
6874 (ver_test_7.syms): New target.
6876 2008-03-28 Ian Lance Taylor <iant@google.com>
6878 * layout.cc (Layout::layout): If we see an input section with a
6879 name that needs sorting, set the must_sort flag for the output
6881 (Layout::make_output_section): If the name of the output section
6882 indicates that it might require sorting, set the may_sort flag.
6883 * output.h (Output_section::may_sort_attached_input_sections): New
6885 (Output_section::set_may_sort_attached_input_sections): New
6887 (Output_section::must_sort_attached_input_sections): New
6889 (Output_section::set_must_sort_attached_input_sections): New
6891 (class Output_section): Declare Input_section_sort_entry. Define
6892 Input_section_sort_compare. Declare
6893 sort_attached_input_sections. Add new fields:
6894 may_sort_attached_input_sections_,
6895 must_sort_attached_input_sections_,
6896 attached_input_sections_are_sorted_.
6897 * output.cc (Output_section::Output_section): Initialize new
6899 (Output_section::add_input_section): Add an entry to
6900 input_sections_ if may_sort or must_sort are true.
6901 (Output_section::set_final_data_size): Call
6902 sort_attached_input_sections if necessary.
6903 (Output_section::Input_section_sort_entry): Define new class.
6904 (Output_section::Input_section_sort_compare::operator()): New
6906 (Output_section::sort_attached_input_sections): New function.
6907 * configure.ac: Check whether the compiler supports constructor
6908 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6909 * testsuite/initpri1.c: New file.
6910 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6911 CONSTRUCTOR_PRIORITY.
6912 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6913 (initpri1_LDFLAGS): New variable.
6914 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6916 2008-03-27 Ian Lance Taylor <iant@google.com>
6918 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6919 * testsuite/common_test_1.c: New file.
6920 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6921 (common_test_1_SOURCES): New variable.
6922 (common_test_1_DEPENDENCIES): New variable.
6923 (common_test_1_LDFLAGS): New variable.
6925 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6926 and commons_ correctly when NAME/VERSION does not override
6928 * testsuite/ver_test_6.c: New file.
6929 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6930 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6931 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6933 2008-03-26 Ian Lance Taylor <iant@google.com>
6935 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6936 of an undefined symbol from a version script.
6937 * testsuite/Makefile.am (ver_test_5.so): New target.
6938 (ver_test_5.o): New target.
6939 (check_SCRIPTS): Add ver_test_5.sh.
6940 (check_DATA): Add ver_test_5.syms.
6941 (ver_test_5.syms): New target.
6942 * testsuite/ver_test_5.cc: New file.
6943 * testsuite/ver_test_5.script: New file.
6944 * testsuite/ver_test_5.sh: New file.
6945 * Makefile.in, testsuite/Makefile.in: Rebuild.
6948 Fix problems building gold with gcc 4.3.0.
6949 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6950 (gold_error_at_location, gold_warning_at_location): Use it.
6951 * configure.ac: Check whether we can compile and use a template
6952 function with a printf attribute.
6953 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6954 when jumping over bytes.
6955 * object.cc: Instantiate Object::read_section_data.
6956 * debug.h: Include <cstring>
6957 * dwarf_reader.cc: Include <algorithm>
6958 * main.cc: Include <cstring>.
6959 * options.cc: Include <cstring>.
6960 * output.cc: Include <cstring>.
6961 * script.cc: Include <cstring>.
6962 * script.h: Include <string>.
6963 * symtab.cc: Include <cstring> and <algorithm>.
6964 * target-select.cc: Include <cstring>.
6965 * version.cc: Include <string>.
6966 * testsuite/testmain.cc: Include <cstdlib>.
6967 * configure, config.in: Rebuild.
6969 2008-03-25 Ian Lance Taylor <iant@google.com>
6971 * options.cc: Include "../bfd/bfdver.h".
6972 (options::help): Print bug reporting address.
6974 * version.cc (print_version): Adjust output for current value of
6979 * options.cc (options::help): Print list of supported targets.
6980 * target-select.h: Include <vector>.
6981 (class Target_selector): Make machine_, size_, and is_big_endian_
6982 fields const. Add bfd_name_ and instantiated_target_ fields.
6983 (Target_selector::Target_selector): Add bfd_name parameter.
6984 (Target_selector::recognize): Make non-virtual, call
6986 (Target_selector::recognize_by_name): Make non-virtual, call
6987 do_recognize_by_name.
6988 (Target_selector::supported_names): New function.
6989 (Target_selector::bfd_name): New function.
6990 (Target_selector::do_instantiate_target): New pure virtual
6992 (Target_selector::do_recognize): New virtual function.
6993 (Target_selector::do_recognize_by_name): New virtual function.
6994 (Target_selector::instantiate_target): New private function.
6995 (supported_target_names): Declare.
6996 * target-select.cc (Target_selector::Target_selector): Update for
6997 new parameter and fields.
6998 (select_target_by_name): Check that the name matches before
6999 calling recognize_by_name.
7000 (supported_target_names): New function.
7001 * i386.cc (class Target_selector_i386): Update Target_selector
7002 constructor call. Remove recognize and recognize_by_name. Add
7003 do_instantiate_target.
7004 * x86_64.cc (class Target_selector_x86_64): Likewise.
7005 * testsuite/testfile.cc (class Target_selector_test): Update for
7006 changes to Target_selector.
7008 * README: Rewrite, with some notes on unsupported features.
7010 2008-03-24 Cary Coutant <ccoutant@google.com>
7012 * i386.cc (Target_i386::Got_type): New enum declaration.
7013 (Target_i386::Scan::local): Updated callers of Output_data_got
7015 (Target_i386::Scan::global): Likewise.
7016 (Target_i386::Relocate::relocate): Likewise.
7017 (Target_i386::Relocate::relocate_tls): Likewise.
7018 * object.h (Got_offset_list): New class.
7019 (Sized_relobj::local_has_got_offset): Added got_type parameter.
7020 (Sized_relobj::local_got_offset): Likewise.
7021 (Sized_relobj::set_local_got_offset): Likewise.
7022 (Sized_relobj::local_has_tls_got_offset): Removed.
7023 (Sized_relobj::local_tls_got_offset): Removed.
7024 (Sized_relobj::set_local_tls_got_offset): Removed.
7025 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
7026 * output.cc (Output_data_got::add_global): Added got_type parameter.
7027 (Output_data_got::add_global_with_rel): Likewise.
7028 (Output_data_got::add_global_with_rela): Likewise.
7029 (Output_data_got::add_global_pair_with_rel): New function.
7030 (Output_data_got::add_global_pair_with_rela): New function.
7031 (Output_data_got::add_local): Added got_type parameter.
7032 (Output_data_got::add_local_with_rel): Likewise.
7033 (Output_data_got::add_local_with_rela): Likewise.
7034 (Output_data_got::add_local_pair_with_rel): New function.
7035 (Output_data_got::add_local_pair_with_rela): New function.
7036 (Output_data_got::add_global_tls): Removed.
7037 (Output_data_got::add_global_tls_with_rel): Removed.
7038 (Output_data_got::add_global_tls_with_rela): Removed.
7039 (Output_data_got::add_local_tls): Removed.
7040 (Output_data_got::add_local_tls_with_rel): Removed.
7041 (Output_data_got::add_local_tls_with_rela): Removed.
7042 * output.h (Output_data_got::add_global): Added got_type parameter.
7043 (Output_data_got::add_global_with_rel): Likewise.
7044 (Output_data_got::add_global_with_rela): Likewise.
7045 (Output_data_got::add_global_pair_with_rel): New function.
7046 (Output_data_got::add_global_pair_with_rela): New function.
7047 (Output_data_got::add_local): Added got_type parameter.
7048 (Output_data_got::add_local_with_rel): Likewise.
7049 (Output_data_got::add_local_with_rela): Likewise.
7050 (Output_data_got::add_local_pair_with_rel): New function.
7051 (Output_data_got::add_local_pair_with_rela): New function.
7052 (Output_data_got::add_global_tls): Removed.
7053 (Output_data_got::add_global_tls_with_rel): Removed.
7054 (Output_data_got::add_global_tls_with_rela): Removed.
7055 (Output_data_got::add_local_tls): Removed.
7056 (Output_data_got::add_local_tls_with_rel): Removed.
7057 (Output_data_got::add_local_tls_with_rela): Removed.
7058 * resolve.cc (Symbol::override_base_with_special): Removed
7059 reference to has_got_offset_ field.
7060 * symtab.cc (Symbol::init_fields): Replaced initialization
7061 of got_offset_ with got_offsets_. Removed initialization
7063 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
7064 (Symbol::got_offset): Likewise.
7065 (Symbol::set_got_offset): Likewise.
7066 (Symbol::has_tls_got_offset): Removed.
7067 (Symbol::tls_got_offset): Removed.
7068 (Symbol::set_tls_got_offset): Removed.
7069 (Symbol::got_offset_): Removed.
7070 (Symbol::tls_mod_got_offset_): Removed.
7071 (Symbol::tls_pair_got_offset_): Removed.
7072 (Symbol::got_offsets_): New field.
7073 (Symbol::has_got_offset): Removed.
7074 (Symbol::has_tls_mod_got_offset): Removed.
7075 (Symbol::has_tls_pair_got_offset): Removed.
7076 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
7077 (Target_x86_64::Scan::local): Updated callers of Output_data_got
7079 (Target_x86_64::Scan::global): Likewise.
7080 (Target_x86_64::Relocate::relocate): Likewise.
7081 (Target_x86_64::Relocate::relocate_tls): Likewise.
7083 2008-03-25 Ben Elliston <bje@au.ibm.com>
7085 * yyscript.y: Fix spelling error in comment.
7087 2008-03-24 Ian Lance Taylor <iant@google.com>
7089 * options.h (class General_options): Define build_id option.
7090 * layout.h (class Layout): Declare write_build_id, create_note,
7091 create_build_id. Add build_id_note_ member.
7092 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
7093 "libiberty.h", "md5.h", "sha1.h".
7094 (Layout::Layout): Initialize eh_frame_data_,
7095 eh_frame_hdr_section_, and build_id_note_.
7096 (Layout::finalize): Call create_build_id.
7097 (Layout::create_note): New function, broken out of
7098 Layout::create_gold_note.
7099 (Layout::create_gold_note): Call create_note.
7100 (Layout::create_build_id): New function.
7101 (Layout::write_build_id): New function.
7102 (Close_task_runner::run): Call write_build_id.
7104 * x86_64.cc: Correct license to GPLv3.
7106 2008-03-23 Ian Lance Taylor <iant@google.com>
7108 * options.cc: Include "demangle.h".
7109 (parse_optional_string): New function.
7110 (parse_long_option): Handle takes_optional_argument.
7111 (parse_short_option): Update dash_z initializer. Handle
7112 takes_optional_argument.
7113 (General_options::General_options): Initialize do_demangle_.
7114 (General_options::finalize): Set do_demangle_. Handle demangling
7116 * options.h (parse_optional_string): Declare.
7117 (struct One_option): Add optional_arg field. Update constructor.
7118 Update call constructor calls. Add takes_optional_argument
7120 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
7121 (DEFINE_optional_string): Define.
7122 (General_options::demangle): Change from DEFINE_bool to
7123 DEFINE_optional_string.
7124 (General_options::no_demangle): New function.
7125 (General_options::do_demangle): New function.
7126 (General_options::set_do_demangle): New function.
7127 (General_options::execstack_status_): Move definition to end of
7129 (General_options::static_): Likewise.
7130 (General_options::do_demangle_): New field.
7131 * object.cc (big_endian>::get_symbol_location_info): Call
7132 Options::do_demangle, not Options::demangle.
7133 * symtab.cc (demangle): Likewise.
7135 2008-03-22 Ian Lance Taylor <iant@google.com>
7137 * gold.h: Include <cstddef> and <sys/types.h>
7138 * options.h: Include <cstring>.
7140 2008-03-21 Ian Lance Taylor <iant@google.com>
7142 * Added source code to GNU binutils.