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