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