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