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