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