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