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