OSDN Git Service

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