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