24d3560774149cc06bed1817269e81d2f0b564c9
[external/binutils.git] / gold / ChangeLog
1 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
2
3         * output.cc (Relobj::initialize_input_to_output_map<size>):
4         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
5
6 2015-03-04  Cary Coutant  <ccoutant@google.com>
7
8         * parameters.cc (Parameters::set_target_once): Call
9         Target::select_as_default_target just once from here...
10         (set_parameters_target): ...instead of from here.
11
12 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
13
14         * ehframe.cc (Cie::set_output_offset): Pass in and use a
15         Output_section_data instead of a Merge_map.
16         (Eh_frame::Eh_frame): Don't initialize merge_map_.
17         (Eh_frame::read_cie): Use add_merge_mapping instead of
18         Merge_map::add_mapping.
19         (Eh_frame::read_fde): Ditto.
20         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
21         (Eh_frame::do_output_offset): Use merge_output_offset istead of
22         merge_map_->get_output_offset.
23         (Eh_frame::do_is_merge_section_for): Delete.
24         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
25         instead of a Merge_map.
26         (Cie::set_output_offset): Pass in a Output_section_data instead of a
27         Merge_map.
28         (Eh_frame::do_is_merge_section_for): Delete.
29         (Eh_frame::merge_map_): Delete.
30         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
31         and use a Output_section_data instead of a Merge_map.
32         (Object_merge_map::add_mapping): Ditto.
33         (Object_merge_map::get_output_offset): Remove the merge_map argument.
34         (Object_merge_map::is_merge_section_for): Pass in and use a
35         Output_section_data instead of a Merge_map.
36         (Merge_map): Delete.
37         (Output_merge_base::do_output_offset): Use merge_output_offset instead
38         of merge_map_.get_output_offset.
39         (Output_merge_base::do_is_merge_section_for): Delete.
40         (Output_merge_data::do_add_input_section): Use
41         object->add_merge_mapping instead of add_mapping.
42         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
43         * merge.h (Merge_map): Delete forward declaration.
44         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
45         instead of a Merge_map.
46         (Object_merge_map::get_output_offset): Remove the merge_map argument.
47         (Object_merge_map::is_merge_section_for): Pass in and use a
48         Output_section_data instead of a Merge_map.
49         (Input_merge_map::Object_merge_map::merge_map): Replace with
50         output_data.
51         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
52         Output_section_data instead of a Merge_map.
53         (Merge_map): Delete.
54         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
55         (Output_merge_base::do_is_merge_section_for): Delete.
56         (Output_merge_base::add_mapping): Delete.
57         (Output_merge_base::merge_map_): Delete.
58         * object.cc (Relobj::initialize_input_to_output_map): New.
59         (Relobj::initialize_input_to_output_map): New.
60         (Relobj::merge_output_offset): New.
61         (Relobj::is_merge_section_for): New.
62         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
63         bits.
64         * object.h (Relobj::merge_map): Delete.
65         (initialize_input_to_output_map): New.
66         (set_merge_map): Delete.
67         (add_merge_mapping): New.
68         (merge_output_offset): New.
69         (is_merge_section_for): New.
70         * output.cc (Output_section::Input_section::is_merge_section_for):
71         Use object->is_merge_section_for.
72         * output.h (Output_section_data::is_merge_section_for): Delete.
73         (Output_section_data::do_is_merge_section_for): Delete.
74         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
75         Use object->initialize_input_to_output_map.
76         (Merged_symbol_value<size>::value_from_output_section): Use
77         object->merge_output_offset.
78
79 2015-03-02  Peter Collingbourne  <pcc@google.com>
80             Cary Coutant  <ccoutant@google.com>
81
82         * output.cc (Output_section::add_merge_input_section): Do not
83         attempt to merge sections with an entsize of 0.
84
85 2015-03-02  Khem Raj  <raj.khem@gmail.com>
86
87         * attributes.h (class Output_attributes_section_data ): Add
88         do_print_to_mapfile function.
89
90 2015-02-24  Alan Modra  <amodra@gmail.com>
91
92         PR 18010
93         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
94         complain if value is not a multiple of four.
95         (Target_powerpc::Relocate::relocate): Correct handling of
96         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
97
98 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
99
100         * configure.ac (default_size): Set to 32 for x32.
101         * configure: Regenerated.
102
103 2015-02-18  Alan Modra  <amodra@gmail.com>
104
105         PR 17954
106         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
107         visibility.
108
109 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
110
111         * gc.h (Garbage_collection::add_reference): Don't use find.
112
113 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
114
115         * object.cc (write_local_symbols): avoid std::vector copy.
116
117 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
118
119         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
120
121 2015-02-09  Mark Wielaard  <mjw@redhat.com>
122
123         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
124         DW_LANG_Fortran03 and DW_LANG_Fortran08.
125
126 2015-02-16  Cary Coutant  <ccoutant@google.com>
127
128         PR gold/13577
129         PR gold/16992
130         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
131         DF_SYMBOLIC if --dynamic-list option is used.
132         * options.cc (General_options::finalize): --dynamic-list is not
133         mutually exclusive with -Bsymbolic.
134         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
135         listed in --dynamic-list.
136         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
137         -Bsymbolic-functions.
138         * testsuite/Makefile.in: Regenerate.
139
140 2015-02-16  Cary Coutant  <ccoutant@google.com>
141
142         PR gold/17971
143         * incremental.cc: Remove redundant include of "output.h".
144
145 2015-02-12  Jing Yu  <jingyu@google.com>
146
147         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
148         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
149         New relocation.
150         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
151         TLSLE_MOVW_* relocations.
152         (Target_aarch64::Scan::global): Likewise.
153         (Target_aarch64::Relocate::relocate): Likewise.
154         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
155         for new TLSLE_MOVW_* relocations.
156
157 2015-02-11  Will Newton  <will.newton@linaro.org>
158
159         PR gold/13321
160         * arm.cc (Target_arm::make_plt_section): Create an ARM
161         state mapping symbol at the start of the PLT.
162
163 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
164
165         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
166         Replace two_file_shared_2.so with two_file_shared_1.so.
167         * testsuite/Makefile.in: Regenerated.
168
169 2015-02-09  Alan Modra  <amodra@gmail.com>
170
171         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
172         plugin_test_thin.a and defsym_test.
173         * testsuite/Makefile.in: Regenerate.
174
175 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
176
177         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
178         body.
179
180 2015-02-04  Peter Collingbourne  <pcc@google.com>
181
182         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
183         forwarding symbols when computing symbol resolution info for plugins.
184         * plugin.h (Plugin_manager::symtab): New method.
185         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
186
187 2015-02-03  Cary Coutant  <ccoutant@google.com>
188             Peter Collingbourne  <pcc@google.com>
189
190         PR gold/15660
191         * archive.cc (Thin_archive_object_unlocker): New class.
192         (Archive::include_member): Unlock external members of thin archives.
193         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
194         (plugin_test_2): Likewise.
195         (plugin_test_3): Likewise.
196         (plugin_test_4): Likewise.
197         (plugin_test_5): Likewise.
198         (plugin_test_6): Likewise.
199         (plugin_test_7): Likewise.
200         (plugin_test_8): Likewise.
201         (plugin_test_9): Likewise.
202         (plugin_test_10): Likewise.
203         (plugin_test_11): New test case.
204         * testsuite/Makefile.in: Regenerate.
205         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
206         file to decide whether to claim file.
207         (all_symbols_read_hook): Likewise.
208         * testsuite/plugin_test_1.sh: Adjust expected output.
209         * testsuite/plugin_test_2.sh: Likewise.
210         * testsuite/plugin_test_3.sh: Likewise.
211         * testsuite/plugin_test_6.sh: Likewise.
212         * testsuite/plugin_test_tls.sh: Likewise.
213         * testsuite/plugin_test_11.sh: New testcase.
214
215 2015-02-03  Cary Coutant  <ccoutant@google.com>
216
217         * descriptors.cc (Descriptors::open): Set artificially-low limit for
218         file descriptors when debugging enabled. Add debug output.
219         (Descriptors::release): Add debug output.
220         (Descriptors::close_some_descriptor): Likewise.
221         (Descriptors::close_all): Likewise.
222         * fileread.cc (File_read::lock): Likewise.
223         (File_read::unlock): Likewise.
224
225 2015-02-02  Cary Coutant  <ccoutant@google.com>
226
227         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
228         executable output file.
229
230 2015-01-22  Han Shen  <shenhan@google.com>
231
232         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
233         (Target_arm::do_plt_address_for_global): New method.
234         (Target_arm::do_plt_address_for_local): New method.
235         (Target_arm::rel_irelative_section): New method.
236         (Target_arm::make_data_plt): Add more parameters for plt ctor.
237         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
238         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
239         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
240         (Target_arm::Scan::check_non_pic): Add ifunc support.
241         (Target_arm::Scan::local): Add ifunc support.
242         (Target_arm::Scan::global): Add ifunc support.
243         (Target_arm::make_plt_section): New method.
244         (Target_arm::make_plt_entry): Change to call to make_plt_section.
245         (Target_arm::make_local_ifunc_plt_entry): New method.
246         (Target_arm::got_irelative_): New member.
247         (Target_arm::rel_irelative_): New member.
248         (Target_arm::got_section): Add creation for got_irelative_.
249         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
250         (Target_arm::Relocate::relocate): Properly set local ifunc address.
251         (Target_arm::do_dynsym_value): Properly set global ifunc address.
252         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
253         (Output_data_plt_arm::IRelative_data): New type.
254         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
255         (Output_data_plt_arm::add_entry): Add more parameters.
256         (Output_data_plt_arm::add_relocation): New method.
257         (Output_data_plt_arm::add_local_ifunc_entry): New method.
258         (Output_data_plt_arm::rel_irelative): New method.
259         (Output_data_plt_arm::entry_count): Modified.
260         (Output_data_plt_arm::address_for_global): New method.
261         (Output_data_plt_arm::address_for_local): New method.
262 gold/
263         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
264         (Output_data_plt_arm::insert_irelative_data): New method.
265         (Output_data_plt_arm::irelative_rel_): New member.
266         (Output_data_plt_arm::got_): New member.
267         (Output_data_plt_arm::got_irelative_): New member.
268         (Output_data_plt_arm::irelative_count_): New member.
269         (Output_data_plt_arm::IRelative_data_vec): New typedef.
270         (Output_data_plt_arm::irelative_data_vec_): New member.
271         (Output_data_plt_arm::do_write): Write out irelative entries.
272         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
273         more parameters to ctor.
274         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
275         more parameters to ctor.
276         * output.h (Output_data_reloc::add_local_relative): New method.
277         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
278
279 2015-01-29  Alan Modra  <amodra@gmail.com>
280
281         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
282         and GOT_TLSGD to LE optimization.
283
284 2015-01-28  Cary Coutant  <ccoutant@google.com>
285
286         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
287         for undef TLS symbols.
288         (Target_x86_64::Relocate::relocate_tls): Likewise.
289         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
290
291 2015-01-25  Cary Coutant  <ccoutant@google.com>
292
293         * output.cc (Output_segment::set_section_addresses): Fix calculation
294         of size of relro segment.
295
296 2015-01-22  Alan Modra  <amodra@gmail.com>
297
298         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
299         condition for need of ifunc plt entry.
300         (Target_powerpc::Scan::global <got relocs>): Likewise.
301
302 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
303
304         * mips.cc (reloc_high): Add r_sym.
305         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
306         reloc_high constructor.
307         (Mips_relocate_functions::relgot16_local): Likewise.
308         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
309         r_type to decide whether LO16 matches HI16.
310         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
311         rello16 and relgot16_local.
312
313 2015-01-09  Cary Coutant  <ccoutant@google.com>
314
315         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
316         unless alignment is larger than page size.
317
318 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
319             Cary Coutant  <ccoutant@google.com>
320
321         PR gold/17729
322         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
323         (DEFAULT_TARGET_X32): Set for x32.
324         * x86_64.cc (cmp_insn_32): New.
325         (lea_r10_insn_32): Likewise.
326         (lea_r11_insn_32): Likewise.
327         (cmp_insn_64): Likewise.
328         (lea_r10_insn_64): Likewise.
329         (lea_r11_insn_64): Likewise.
330         (Target_x86_64<size>::do_calls_non_split): Handle x32.
331         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
332         (check_DATA): Add split_x32 files.
333         (split_x32_[1234n].o): New targets.
334         (split_x32_[124]): New targets.
335         (split_x32_[1234r].stdout): New targets.
336         * testsuite/split_x32.sh: New file.
337         * testsuite/split_x32_1.s: Likewise.
338         * testsuite/split_x32_2.s: Likewise.
339         * testsuite/split_x32_3.s: Likewise.
340         * testsuite/split_x32_4.s: Likewise.
341         * testsuite/split_x32_n.s: Likewise.
342         * configure: Regenerated.
343         * testsuite/Makefile.in: Likewise.
344
345 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
346
347         PR gold/17809
348         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
349         x32.
350
351 2015-01-02  Alan Modra  <amodra@gmail.com>
352
353         * version.cc (print_version): Just print current year.
354         * dwp.cc (print_version): Likewise.
355
356 2015-01-01  Alan Modra  <amodra@gmail.com>
357
358         Update year range in copyright notice of all files.
359
360 2014-12-25  Alan Modra  <amodra@gmail.com>
361
362         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
363         new enums.
364         (Target_arm::merge_object_attributes, ): Likewise.
365
366 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
367
368         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
369         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
370         AEABI_VFP_args_vfp to check that.
371         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
372         value and replace hardcoded values by enum values.
373
374 2014-12-22  Cary Coutant  <ccoutant@google.com>
375
376         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
377
378 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
379
380         PR gold/14608
381         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
382         to "return i * i * 3;".
383
384 2014-12-16  Cary Coutant  <ccoutant@google.com>
385
386         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
387         (Mapfile::print_output_data): Use current_data_size() to avoid
388         assert for sections requiring postprocessing; if address is not valid,
389         print 0.
390         (Mapfile::print_output_section): Use current_data_size(); print note
391         that addresses and sizes are before compression.
392
393 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
394
395         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
396         Cast current_group_size to unsigned long when reporting error.
397
398 2014-12-10  Jing Yu  <jingyu@google.com>
399
400         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
401         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
402         Update error message.
403         (Target_aarch64::do_relax): Use absolute value of option
404         stub_group_size. Replace local variable with class member
405         stub_group_size_.
406
407 2014-12-04  Alan Modra  <amodra@gmail.com>
408
409         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
410         addend of PLTREL24 reloc when not generating a plt stub.  Make
411         max_branch_offset an "Address".
412         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
413         (Target_powerpc::Relocate::relocate): Likewise.
414
415 2014-12-04  Alan Modra  <amodra@gmail.com>
416
417         PR 17670
418         * symtab.cc (Symbol::set_undefined): Remove assertion.
419         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
420         on symbols defined in discarded sections, instead return false.
421         Rearrange params, update all callers.
422         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
423         branches to syms in discarded sections.
424         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
425         undefined and flag as discarded.
426         (Target_powerpc::Relocate::relocate): Localize variable.
427
428 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
429
430         PR gold/17675
431         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
432         * testsuite/Makefile.in: Regenerated.
433
434 2014-12-03  Alan Modra  <amodra@gmail.com>
435
436         PR 17566
437         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
438         when adding dynamic relocations against section symbols.
439
440 2014-12-01  Dimitry Ivanov <dimitry@google.com>
441
442         * layout.cc (Layout::finish_dynamic_section): When '-z global'
443         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
444         * options.h (General_options): New -z option (global).
445
446 2014-12-01  Cary Coutant  <ccoutant@google.com>
447
448         PR gold/17578
449         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
450         is given.
451         (Layout::create_executable_stack_info): Warn when -z noexecstack is
452         given but some inputs require executable stack.
453
454 2014-11-26  Cary Coutant  <ccoutant@google.com>
455
456         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
457         .debug_str_offsets; strip .debug_gnu_pubnames and
458         .debug_gnu_pubtypes.
459         (lines_only_debug_sections): Strip all four new sections.
460
461 2014-11-26  Jing Yu  <jingyu@google.com>
462
463         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
464         register to be x0 when to relax TLSDESC_LD64_LO12.
465
466 2014-11-26  Alan Modra  <amodra@gmail.com>
467
468         * powerpc.cc (struct Stub_table_owner): New.
469         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
470         unsigned int vector.  Update all references.
471         (powerpc_relobj::set_stub_table): Take an unsigned int param
472         rather than a Stub_table.  Update callers.
473         (Powerpc_relobj::clear_stub_table): New function.
474         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
475         stub_group_size_ vars.
476         (Target_powerpc::new_stub_table): Delete.
477         (max_branch_delta): New function, extracted from..
478         (Target_powerpc::Relocate::relocate): ..here..
479         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
480         status on whether stub created successfully.
481         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
482         default sizing to..
483         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
484         reduce on relax failure.
485         (Target_powerpc::group_sections): Add "no_size_errors" param.
486         Use stub_group_size_.  Set up group info in a temp vector,
487         before building Stub_table vector.  Account for input sections
488         possibly already converted to relaxed sections.
489         (Stub_table::init): Delete.  Merge into..
490         (Stub_table::Stub_table): ..here.
491         (Stub_table::can_reach_stub): New function.
492         (Stub_table::add_plt_call_entry): Add "from" parameter and
493         return true iff stub could be reached.
494         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
495         param too.
496         (Stub_table::clear_stubs): Add "all" param.
497
498 2014-11-26  Alan Modra  <amodra@gmail.com>
499
500         * powerpc.cc (Stub_control::set_output_and_owner): New function.
501         (Target_powerpc::group_sections): Use it.
502
503 2014-11-25  Cary Coutant  <ccoutant@google.com>
504
505         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
506         (Binary_to_elf::write_symbol): Add st_size parameter.
507         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
508
509 2014-11-25  Cary Coutant  <ccoutant@google.com>
510
511         PR gold/17639
512         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
513         (Sized_relobj_file::do_layout): Handle deferred sections properly
514         during GC pass 1. Don't add reloc sections to deferred list twice.
515         * object.h (Sized_relobj_file::is_deferred_layout): New function.
516         (Sized_relobj_file::is_deferred_layout_): New data member.
517
518 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
519
520         PR gold/17619
521         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
522         Check PC-relative offset overflow in PLT entry.
523
524 2014-11-21  Alan Modra  <amodra@gmail.com>
525
526         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
527         for undefined weaks.
528
529 2014-11-20  Alan Modra  <amodra@gmail.com>
530
531         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
532         from --stub-group-size parameter divided by 1024.
533         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
534         template parameter.  Update all uses.
535         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
536         has_stub_value.  Set for long branches.  Don't report overflow for
537         branch to undefined weak symbols.  Print info message on
538         overflowing branch to stub.
539
540 2014-11-20  Alan Modra  <amodra@gmail.com>
541
542         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
543
544 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
545
546         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
547         entry for R_X86_64_GOTPLT64.
548         (Target_x86_64<size>::Relocate::relocate): Update comments for
549         R_X86_64_GOTPLT64.
550
551 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
552
553         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
554         * plugin.h: add lock definition
555
556 2014-10-29  Han Shen  <shenhan@google.com>
557             Jing Yu   <jingyu@google.com>
558
559         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
560         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
561         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
562         Symbol::TLS_REF.
563         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
564         method.
565         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
566         (Target_aarch64::tls_ld_to_le): New method.
567         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
568         for 64bit targets.
569         (Output_data_plt_aarch64::irelative_rel_): New data member.
570         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
571         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
572         (Output_data_plt_aarch64::add_relocation): New method.
573         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
574         offset. Add got_irelative size to got size.
575         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
576         type string with the new typename.
577         (AArch64_relocate_functions::update_adr): Replace parameter x with
578         immed.
579         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
580         (AArch64_relocate_functions::reloc_common): New method.
581         (AArch64_relocate_funcsions::rela_general): Extract common part out
582         into reloc_common method.
583         (AArch64_relocate_functions::rela_general): Likewise.
584         (AArch64_relocate_functions::pcrela_general): Likewise.
585         (AArch64_relocate_functions::adr): New method.
586         (AArch64_relocate_functions::adrp): Calculate immed before calling
587         update_adr.
588         (AArch64_relocate_functions::adrp): Likewise.
589         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
590         comparing x to 0. Calculate immed from ~x when x < 0.
591         (Target_aarch64::optimize_tls_reloc): Add new cases for
592         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
593         TLSLD_MOVW_DTPREL_G0_NC.
594         (Target_aarch64::possible_function_pointer_reloc): Implement this
595         method.
596         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
597         comment.
598         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
599         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
600         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
601         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
602         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
603         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
604         (Target_aarch64::make_plt_entry): Call add_entry with two more
605         parameters.
606         (Target_aarch64::make_local_ifunc_plt_entry): New method.
607         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
608         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
609         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
610         (Target_aarch64::Relocate::relocate_tls): Add cases for
611         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
612         TLSLD_MOVW_DTPREL_G0_NC.
613         * testsuite/icf_safe_so_test.cc: Correct test comment.
614         * testsuite/icf_safe_test.sh: Add AArch64 arch.
615
616 2014-10-22  Alan Modra  <amodra@gmail.com>
617
618         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
619         thread_starter.
620
621 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
622
623         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
624
625 2014-10-17  Cary Coutant  <ccoutant@google.com>
626
627         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
628         Add "typename" keyword.
629
630 2014-10-15  Han Shen  <shenhan@google.com>
631             Jing Yu   <jingyu@google.com>
632
633         Patch for gold aarch64 backend to support relaxation.
634         * aarch64-reloc.def: Change format.
635         * aarch64.cc (class Reloc_stub): New class.
636         (class Stub_table): New class.
637         (class AArch64_relobj): New class.
638         (class AArch64_input_section): New class.
639         (class AArch64_output_section): New class.
640         (Target_aarch64::new_stub_table): New method.
641         (Target_aarch64::new_aarch64_input_section): New method.
642         (Target_aarch64::find_aarch64_input_section): New method.
643         (Target_aarch64::scan_section_for_stubs): New method.
644         (Target_aarch64::scan_reloc_section_for_stubs): New method.
645         (Target_aarch64::relocate_stub): New method.
646         (Target_aarch64::current_target): New method.
647         (Target_aarch64::do_make_elf_object): New method.
648         (Target_aarch64::do_may_relax): New method.
649         (Target_aarch64::do_relax): New method.
650         (Target_aarch64::group_sections): New method.
651         (Target_aarch64::scan_reloc_for_stub): New method.
652         (Target_aarch64::do_make_output_section): New method.
653         (Target_aarch64::stub_tables_): New data member.
654         (Target_aarch64::aarch64_input_section_map_): New data member.
655         (AArch64_relocate_functions::maybe_apply_stub): New method.
656
657 2014-09-30  Cary Coutant  <ccoutant@google.com>
658
659         PR gold/17432
660         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
661
662 2014-09-30  Kito Cheng  <kito@0xlab.org>
663
664         PR gold/13597
665         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
666         hash table before sysv-style hash table.
667
668 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
669
670         * options.h (--pic-executable): Add negative to alias to -no-pie.
671
672 2014-09-26  Cary Coutant  <ccoutant@google.com>
673
674         PR gold/16773
675         * object.cc (Sized_relobj_file): Compute value of section symbols
676         for TLS sections the same as TLS symbols.
677
678 2014-09-25  Cary Coutant  <ccoutant@google.com>
679
680         PR gold/17432
681         * resolve.cc (Symbol_table::resolve): Override common placeholder
682         symbols, but adjust sizes.
683         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
684         symbols to common lists.
685
686 2014-09-24  Alan Modra  <amodra@gmail.com>
687
688         * po/POTFILES.in: Regenerate.
689
690 2014-09-23  Taiju Tsuiki  <tzik@google.com>
691             Cary Coutant  <ccoutant@google.com>
692
693         PR gold/14860
694         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
695         on input_sections_blocker.
696         * layout.cc (Write_sections_task::locks): Unblock
697         input_sections_blocker_.
698         * layout.h (Write_sections_task::Write_sections_task): Add
699         input_sections_blocker.
700         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
701         to DEPENDENCIES.
702         * testsuite/Makefile.in: Regenerate.
703
704 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
705
706         * testsuite/Makefile.am (plugin_test_10): New test.
707         * testsuite/Makefile.in: Regenerate
708         * testsuite/plugin_common_test_2.c (c1): Align to 8.
709         * testsuite/plugin_test_10.sh: New file.
710
711 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
712
713         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
714         * resolve.cc (Symbol_table::resolve): Don't override common symbols
715         during the replacement phase.
716
717 2014-09-17  Han Shen  <shenhan@google.com>
718             Jing Yu  <jingyu@google.com>
719
720         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
721         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
722         * aarch64.cc (Target_aarch64): Add data members
723         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
724         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
725         constructor.
726         (Target_aarch64::do_reloc_symbol_index): New method.
727         (Target_aarch64::do_reloc_addend): New method.
728         (Target_aarch64::add_tlsdesc_info): New method.
729         (Target_aarch64::do_dynsym_value): New method.
730         (Target_aarch64::do_make_data_plt): Add new parameters: got,
731         got_irelative. Pass them to Output_data_plt_aarch64_standard.
732         (Target_aarch64::make_data_plt): Add new parameters: got,
733         got_irelative. Pass them to do_make_data_plt.
734         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
735         (Target_aarch64::Relocate:tls_gd_to_le): New method.
736         (Target_aarch64::Relocate:tls_ie_to_le): New method.
737         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
738         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
739         (Target_aarch64::got_tlsdesc_section): New method.
740         (Target_aarch64::make_local_ifunc_plt_entry): New method.
741         (Target_aarch64::define_tls_base_symbol): New method.
742         (Target_aarch64::reserve_tlsdesc_entries): New method.
743         (Target_aarch64::got_mod_index_entry): New method.
744         (Target_aarch64::rela_tlsdesc_section): New method.
745         (Target_aarch64::rela_irelative_section): New method.
746         (Target_aarch64::Tlsdesc_info): New struct.
747         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
748         relocations and tlsdesc relocations.
749         (Target_aarch64::optimize_tls_reloc): Implement method.
750         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
751         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
752         in constructor.
753         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
754         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
755         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
756         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
757         (Output_data_plt_aarch64::rela_tlsdesc): New method.
758         (Output_data_plt_aarch64::rela_irelative): New method.
759         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
760         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
761         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
762         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
763         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
764         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
765         (Output_data_plt_aarch64_standard): New member variables:
766         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
767         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
768         New parameter: got, got_irelative.
769         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
770         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
771         (Output_data_plt_aarch64::do_write): Replace got_address with
772         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
773         (AArch64_relocate_functions::update_movnz): New method.
774         (AArch64_relocate_functions): Correct format.
775         (AArch64_relocate_functions::movnz): New method.
776         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
777         before the switch. Add new cases to switch.
778         Check ie_to_le relaxation on tlsie relocations. Add code handling
779         tlsgd tlsdesc cases.
780         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
781         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
782         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
783         Call reloc_name_in_error_message to print unsupported reloc.
784         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
785         make_data_plt.
786         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
787         relocs. Fill in some more dynamic tags.
788         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
789         Skip call tls_get_addr when tlsgd is relaxed.
790         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
791         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
792         tlsdesc->ie relaxation.
793
794 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
795
796         * mips.cc (Target_mips_nacl): New class.
797         (Target_selector_mips_nacl): New class.
798         (target_selector_mips32): Rename from target_selector_mips32be and use
799         Target_selector_mips_nacl instead of Target_selector_mips.
800         (target_selector_mips32el): Rename from target_selector_mips32 and use
801         Target_selector_mips_nacl instead of Target_selector_mips.
802         (target_selector_mips64): Rename from target_selector_mips64be and use
803         Target_selector_mips_nacl instead of Target_selector_mips.
804         (target_selector_mips64el): Rename from target_selector_mips64 and use
805         Target_selector_mips_nacl instead of Target_selector_mips.
806         (Target_mips::mips_info): Add const attribute.
807
808 2014-09-02  Cary Coutant  <ccoutant@google.com>
809
810         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
811         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
812         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
813         (Sized_incr_dynobj::do_section_name): Likewise.
814         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
815         (Sized_incr_dynobj::do_section_name): Likewise.
816         * object.h (Object::section_name): Likewise.
817         (Object::do_section_name): Likewise.
818         (Sized_relobj_file::do_section_name): Likewise.
819         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
820         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
821
822 2014-09-02  Cary Coutant  <ccoutant@google.com>
823
824         PR gold/17005
825         * ehframe.cc (Fde::write): Add output_offset parameter.
826         (Cie::write): Likewise.
827         (Eh_frame::set_final_data_size): Account for offset within output
828         section.
829         (Eh_frame::do_sized_write): Likewise.
830         * ehframe.h (Fde::write): Add output_offset parameter.
831         (Cie::write): Likewise.
832         * output.cc (Output_section::Input_section_sort_entry): Remove
833         section_has_name_; add output_section_name parameter. Use
834         output section name for non-input sections.
835         (Output_section::Input_section_sort_entry::section_has_name): Remove.
836         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
837         (Output_section::Input_section_sort_compare): Remove logic for
838         sections without names.
839         (Output_section::Input_section_sort_init_fini_compare): Likewise.
840         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
841         Likewise.
842         (Output_section::Input_section_sort_section_name_compare): Likewise.
843
844 2014-08-29 Han Shen <shenhan@google.com>
845            Jing Yu <jingyu@google.com>
846
847         * aarch64-reloc-property.cc
848         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
849         reference reloc property in the table.
850         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
851         3 other entries.
852         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
853         2 new overloaded methods.
854         (Output_data_got_aarch64::do_write): Add code to write out
855         static relocs.
856         (class Output_data_got_aarch64::Static_reloc): New class to wrap
857         static relocs.
858         (Output_data_got_aarch64::static_relocs): New vector to
859         hold static relocs.
860         (Target_aarch64::TCB_SIZE): New const static memeber.
861         (Target_aarch64::tcb_size): New method.
862         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
863         (Target_aarch64::Relocate::relocate_tls): New method.
864         (Target_aarch64::Scan::local): Add code handling new reloc types.
865         (Target_aarch64::Scan::global): Add code handling new reloc types.
866
867 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
868
869         * options.h (-no-pie): Add option.
870
871 2014-08-08  Jing Yu  <jingyu@google.com>
872             Han Shen  <shenhan@google.com>
873
874         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
875         (DEFFILES): add aarch64-reloc.def.
876         (TARGETSOURCES): Add aarch64-reloc-property.cc.
877         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
878         * Makefile.in: Regenerate.
879         * aarch64-reloc-property.cc: New file.
880         * aarch64-reloc-property.h: New file.
881         * aarch64-reloc.def: New file.
882         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
883         with tab to make the format consistent.
884         (Output_data_got_aarch64::symbol_table_): New method.
885         (Target_aarch64::do_plt_address_for_global): New method.
886         (Target_aarch64::do_plt_address_for_local): New method.
887         (Target_aarch64::do_select_as_default_target): New method.
888         (Target_aarch64::do_make_data_plt): New method.
889         (Target_aarch64::make_data_plt): New method.
890         (Output_data_plt_aarch64::has_irelative_section): New method.
891         (Output_data_plt_aarch64::address_for_global): New method.
892         (Output_data_plt_aarch64::address_for_local): New method.
893         (Output_data_plt_aarch64::irelative_rel_): New parameter.
894         (Output_data_plt_aarch64::add_entry): Implement contents.
895         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
896         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
897         the got_pov entry to plt0.
898         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
899         Implement contents.
900         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
901         (AArch64_howto): New struct.
902         (aarch64_howto[]): New static const array.
903         (AArch64_relocate_functions): New class.
904         (Target_aarch64::Scan::get_reference_flags): Remove method.
905         (Target_aarch64::Scan::local): Implement to support a few relocations.
906         (Target_aarch64::Scan::global): Implement to support a few relocations.
907         (Target_aarch64::make_plt_section): Implement contents.
908         (Target_aarch64::make_plt_entry): Implement contents.
909         (Target_aarch64::do_finalize_sections): Implement contents.
910         (Target_aarch64::Relocate::relocate): Implement a few relocations.
911         (Target_aarch64::relocate_section): Implement contents.
912
913 2014-08-06  Alan Modra  <amodra@gmail.com>
914
915         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
916
917 2014-08-06  Alan Modra  <amodra@gmail.com>
918
919         PR 13227
920         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
921
922 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
923
924         * object.cc (Relobj::is_section_name_included): Add
925         ".rodata.nptl_version" to not garbage collect this section.
926
927 2014-07-08  Cary Coutant  <ccoutant@google.com>
928
929         * expression.cc (struct Expression::Expression_eval_info): Add
930         new fields type_pointer, vis_pointer, and nonvis_pointer.
931         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
932         nonvis_pointer parameters. Adjust all calls.
933         (Symbol_expression::value): Update type, visibility, and nonvis bits
934         in caller.
935         * script.cc (Symbol_assignment::sized_finalize): Update type,
936         visibility, and remaining st_other bits for new symbol.
937         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
938         vis_pointer, and nonvis_pointer parameters.
939         * symtab.h (Symbol::set_type): New method.
940
941         * testsuite/Makefile.am (defsym_test): New test.
942         * testsuite/Makefile.in: Regenerate.
943         * testsuite/defsym_test.c: New file.
944         * testsuite/defsym_test.sh: New file.
945
946 2014-07-08  Cary Coutant  <ccoutant@google.com>
947
948         PR gold/15639
949         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
950         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
951         (Sized_dynobj::base_read_symbols): ...new method.
952         * object.h (Sized_relobj_file::base_read_symbols): New method.
953         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
954         (Sized_relobj_file::base_read_symbols): ...new method.
955         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
956         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
957         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
958
959 2014-07-04  Alan Modra  <amodra@gmail.com>
960
961         * po/POTFILES.in: Regenerate.
962
963 2014-07-02  Jing Yu  <jingyu@google.com>
964
965         * aarch64.cc: New file
966         * Makefile.am (TARGETSOURCES): Add aarch64.cc
967         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
968         * Makefile.in: Regenerate.
969         * configure.tgt: Add entries for aarch64*.
970         * configure.ac:  Likewise.
971         * configure: Likewise.
972
973 2014-06-27  Alan Modra  <amodra@gmail.com>
974
975         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
976
977 2014-06-24  Cary Coutant  <ccoutant@google.com>
978
979         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
980         sections.
981         (Dwo_file::sized_read_unit_index): Likewise.
982
983 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
984
985         * mips.cc: New file.
986         * Makefile.am (TARGETSOURCES): Add mips.cc
987         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
988         * configure.tgt: Add entries for mips*.
989         * configure.ac: Likewise.
990         * Makefile.in: Regenerate.
991         * configure: Likewise.
992
993 2014-06-09  Cary Coutant  <ccoutant@google.com>
994
995         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
996         unit_length is within section bounds.
997
998 2014-06-09  Cary Coutant  <ccoutant@google.com>
999
1000         PR gold/16980
1001         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1002         map.
1003
1004 2014-06-07  Alan Modra  <amodra@gmail.com>
1005
1006         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1007
1008 2014-06-06  Cary Coutant  <ccoutant@google.com>
1009
1010         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1011         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1012         (Dwarf_pubnames_table::read_header): Likewise.
1013         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1014         .debug_gnu_pubtypes.
1015
1016 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1017
1018         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1019         * Makefile.in, configure: Regenerate.
1020
1021 2014-06-03  Alan Modra  <amodra@gmail.com>
1022
1023         * powerpc.cc (addis_12_2): Define.
1024         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1025
1026 2014-06-03  Alan Modra  <amodra@gmail.com>
1027
1028         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1029         st_other output.
1030
1031 2014-06-02  Alan Modra  <amodra@gmail.com>
1032
1033         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1034         Only ignore relocs on ELFv1.
1035         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1036
1037 2014-05-30  Cary Coutant  <ccoutant@google.com>
1038
1039         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1040         * testsuite/Makefile.in: Regenerate.
1041         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1042
1043 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1044
1045         PR gold/16945
1046         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1047         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1048
1049 2014-05-15  Alan Modra  <amodra@gmail.com>
1050
1051         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1052         Compare FDE contents with DW_CFA_nop rather than 0.
1053
1054 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1055
1056         * symtab.h (may_need_copy_reloc): Remove check for position independent
1057         code.
1058         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1059         position independence before pc absolute may_need_copy_reloc call.
1060         Add check for executable output befor pc relative may_need_copy_reloc
1061         call.
1062         * i386.cc: Ditto.
1063         * arm.cc: Ditto.
1064         * sparc.cc: Ditto.
1065         * tilegx.cc: Ditto.
1066         * powerpc.cc: Add check for no position independence before
1067         may_need_copy_reloc calls.
1068         * testsuite/pie_copyrelocs_test.cc: New file.
1069         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1070         * Makefile.am (pie_copyrelocs_test): New test.
1071         * Makefile.in: Regenerate.
1072
1073 2014-05-08  Martin Liška  <mliska@suse.cz>
1074
1075         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1076
1077 2014-05-06  Cary Coutant  <ccoutant@google.com>
1078
1079         PR gold/16900
1080         * i386.cc (Output_data_got_plt_i386): New class.
1081         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1082         parameter. Change all callers.
1083         (Output_data_plt_i386::layout_): Remove.
1084         (Output_data_plt_i386::got_plt_): Change type.
1085         (Target_i386::got_plt_): Change type. Change all references.
1086         (Target_i386::got_section): Create instance of new class.
1087         (Output_data_got_plt_i386::do_write): New function.
1088         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1089         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1090         parameter. Change all callers.
1091         (Output_data_plt_x86_64::layout_): Remove.
1092         (Output_data_plt_x86_64::got_plt_): Change type.
1093         (Target_x86_64::got_plt_): Change type. Change all references.
1094         (Target_x86_64::got_section): Create instance of new class.
1095         (Output_data_got_plt_x86_64::do_write): New function.
1096         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1097         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1098         class.
1099
1100 2014-05-05  Cary Coutant  <ccoutant@google.com>
1101
1102         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1103         if we have pubnames/pubtypes.
1104
1105 2014-05-02  Cary Coutant  <ccoutant@google.com>
1106
1107         * defstd.cc (in_segment): Define __ehdr_start here...
1108         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1109         output segment when known.
1110         * resolve.cc (Symbol::override_base_with_special): Remember
1111         the original binding.
1112         * symtab.cc (Symbol::set_output_segment): New function.
1113         (Symbol::set_undefined): New function.
1114         * symtab.h (Symbol::is_weak_undefined): Check original undef
1115         binding.
1116         (Symbol::is_strong_undefined): New function.
1117         (Symbol::set_output_segment): New function.
1118         (Symbol::set_undefined): New function.
1119         * target-reloc.h (is_strong_undefined): Remove.
1120         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1121         Check for hidden undefs.
1122         (relocate_section): Call Symbol::is_strong_undefined.
1123
1124         * testsuite/Makefile.am (ehdr_start_test_1)
1125         (ehdr_start_test_2, ehdr_start_test_3)
1126         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1127         * testsuite/Makefile.in: Regenerate.
1128         * testsuite/ehdr_start_def.cc: New source file.
1129         * testsuite/ehdr_start_test.cc: New source file.
1130         * testsuite/ehdr_start_test.t: New linker script.
1131         * testsuite/ehdr_start_test_4.sh: New shell script.
1132
1133 2014-04-23  Cary Coutant  <ccoutant@google.com>
1134
1135         PR gold/16870
1136         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1137
1138 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1139
1140         * layout.cc (Layout::include_section): Allow a target to decide
1141         whether to include a section.
1142         * target.h (Target::should_include_section): New function.
1143         (Target::do_should_include_section): New function.
1144
1145 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1146
1147         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1148         inline into ...
1149         (Copy_relocs::emit): ... here.
1150         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1151         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1152         (Copy_reloc_entry::entries_): Change from private to protected.
1153
1154 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1155
1156         * icf.cc (get_section_contents): Replace copies of reloc
1157         vectors with const references.
1158
1159 2014-04-02  Cary Coutant  <ccoutant@google.com>
1160
1161         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1162         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1163         * configure: Regenerate.
1164         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1165         -fno-use-linker-plugin.
1166         (LINK1, CXXLINK1): Add it to the link command.
1167         * testsuite/Makefile.in: Regenerate.
1168
1169 2014-03-12  Alan Modra  <amodra@gmail.com>
1170
1171         * Makefile.in: Regenerate.
1172
1173 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1174
1175         * symtab.h (Symbol::set_nonvis): New function.
1176
1177 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1178
1179         * symtab.cc (Sized_symbol<32>::init_output_data):
1180         Instantiate the template.
1181         (Sized_symbol<64>::init_output_data): Likewise.
1182
1183 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1184
1185         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1186         adjust dynamic symbol value.
1187         * target.h (Target::adjust_dyn_symbol): New function.
1188         (Target::do_adjust_dyn_symbol): New function.
1189
1190 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1191
1192         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1193         Get the value of DYNAMIC_CUSTOM dynamic entry.
1194         * output.h (Output_data_dynamic::add_custom): New function.
1195         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1196         dynamic entry.
1197         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1198         * target.h (Target::dynamic_tag_custom_value): New function.
1199         (Target::do_dynamic_tag_custom_value): New function.
1200
1201 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1202
1203         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1204         dynsym indexes.
1205         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1206         (Target::do_has_custom_set_dynsym_indexes): New function.
1207         (Target::set_dynsym_indexes): New function.
1208         (Target::do_set_dynsym_indexes): New function.
1209
1210 2014-03-07  Alan Modra  <amodra@gmail.com>
1211
1212         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1213         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1214         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1215         (Powerpc_relocate_functions::has_overflow_bitfield,
1216         overflowed): Use the above.
1217         (Target_powerpc::Relocate::relocate): Correct overflow checking
1218         for a number of relocations.  Modify overflow test for 16-bit
1219         fields in instructions to signed/unsigned according to whether
1220         the field takes a signed or unsigned value.
1221
1222 2014-03-05  Alan Modra  <amodra@gmail.com>
1223
1224         Update copyright years.
1225
1226 2014-03-05  Alan Modra  <amodra@gmail.com>
1227
1228         * powerpc.cc (Target_powerpc::Scan::local, global): Support
1229         R_PPC64_ADDR64_LOCAL.
1230         (Target_powerpc::Relocate::relocate): Likewise.
1231
1232 2014-03-03  Alan Modra  <amodra@gmail.com>
1233
1234         * dwp.cc (print_version): Update copyright year to current.
1235
1236 2014-02-10  Alan Modra  <amodra@gmail.com>
1237
1238         * po/gold.pot: Regenerate.
1239
1240 2014-02-06  Cary Coutant  <ccoutant@google.com>
1241
1242         Fix problem where -u is ignored when a weak undef is seen.
1243
1244         * archive.cc (Library_base::should_include_member): Reorder
1245         code to check for -u option if a weak undef has already been seen.
1246         * testsuite/Makefile.am (weak_undef_test_2): New test case.
1247         * testsuite/Makefile.in: Regenerate.
1248         * testsuite/weak_undef_file3.cc: New file.
1249         * testsuite/weak_undef_file4.cc: New file.
1250         * testsuite/weak_undef_test_2.cc: New file.
1251
1252 2014-02-05  Cary Coutant  <ccoutant@google.com>
1253
1254         Fix issues with gold undefined symbol diagnostics.
1255
1256         PR binutils/15435
1257         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1258         check to here.
1259         * target-reloc.h (is_strong_undefined): New function.
1260         (relocate_section): Move undef vtable symbol check from here.
1261         Check for is_strong_undefined.
1262
1263 2014-02-05  Cary Coutant  <ccoutant@google.com>
1264
1265         Fix problems with the --dynamic-list option.
1266
1267         PR gold/13577
1268         * options.cc (General_options::parse_dynamic_list):
1269         Set have_dynamic_list_.
1270         (General_options::General_options): Initialize have_dynamic_list_.
1271         (General_options::finalize): Turn off -Bsymbolic and
1272         -Bsymbolic-functions if --dynamic-list provided.
1273         * options.h (General_options::have_dynamic_list): New function.
1274         (General_options::have_dynamic_list_): New data member.
1275         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1276         correctly.
1277
1278         PR gold/16530
1279         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1280         in --dynamic-list, mark it.
1281
1282         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1283         (dynamic_list_2): New test case.
1284         * testsuite/Makefile.in: Regenerate.
1285         * testsuite/dynamic_list_2.cc: New file.
1286         * testsuite/dynamic_list_2.t: New file.
1287         * testsuite/dynamic_list_lib1.cc: New file.
1288         * testsuite/dynamic_list_lib2.cc: New file.
1289         * testsuite/gc_dynamic_list_test.c: New file.
1290         * testsuite/gc_dynamic_list_test.sh: New file.
1291         * testsuite/gc_dynamic_list_test.t: New file.
1292
1293 2014-01-28  Cary Coutant  <ccoutant@google.com>
1294
1295         Add .gdb_index version 7 support.
1296
1297         * gold/dwarf_reader.cc: include <utility> (for make_pair).
1298         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1299         debug sections.
1300         (Dwarf_ranges_table::read_ranges_table): Likewise.
1301         (Dwarf_pubnames_table::read_section): Check for GNU-style
1302         sections, and for compressed debug sections.
1303         (Dwarf_pubnames_table::read_header): Compute end address of table.
1304         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
1305         for end of list by offset, not by offset == 0.
1306         (Dwarf_info_reader::do_read_string_table): Check for compressed
1307         debug sections.
1308         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1309         Initialize new data members.
1310         (Dwarf_pubnames_table::next_name): return flag_byte.
1311         (Dwarf_pubnames_table::end_of_table_): New data member.
1312         (Dwarf_pubnames_table::is_gnu_style_): New data member.
1313         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1314         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1315         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1316         read skeleton type unit DIEs.
1317         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1318         (Gdb_index::do_write): Write flag_byte.
1319         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1320         (Gdb_index::Cu_vector): Store flags along with cu indexes.
1321         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1322         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1323
1324 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
1325
1326         * version.cc (print_version): Update copyright year to 2014.
1327
1328 2013-12-19  Dimitry Andric  <dimitry@andric.com>
1329
1330         * stringpool.cc (Stringpool_template::reserve): Add
1331         HAVE_UNORDERED_MAP case.
1332         * stringpool.cc (Stringpool_template::print_stats): Likewise.
1333
1334 2013-12-18  Cary Coutant  <ccoutant@google.com>
1335
1336         * configure.ac: Check for <unordered_set> and <unordered_map>.
1337         * config.in: Regenerate.
1338         * configure: Regenerate.
1339         * system.h: Use <unordered_set> and <unordered_map> if available.
1340
1341 2013-12-10  Roland McGrath  <mcgrathr@google.com>
1342
1343         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1344         with $(INSTALL_PROGRAM_ENV).
1345         * Makefile.in: Regenerate.
1346
1347 2013-11-22  Cary Coutant  <ccoutant@google.com>
1348
1349         * configure.ac: Add check for which library is needed for
1350         dlopen.
1351         * configure: Regenerate.
1352
1353 2013-11-22  Cary Coutant  <ccoutant@google.com>
1354
1355         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1356         assembler.
1357         * testsuite/Makefile.in: Regenerate.
1358
1359 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
1360
1361         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1362         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1363         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1364         (Target_x86_64<size>::Scan::local): Likewise.
1365         (Target_x86_64<size>::Scan::global): Likewise.
1366         (Target_x86_64<size>::Relocate::relocate): Likewise.
1367         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1368         Likewise.
1369         (Target_x86_64<size>::Scan::check_non_pic(): Handle
1370         R_X86_64_PC32_BND.
1371
1372         * testsuite/Makefile.am (check_PROGRAMS): Add
1373         exception_x86_64_bnd_test.
1374         (exception_x86_64_bnd_test_SOURCES): New macro.
1375         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1376         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1377         (exception_x86_64_bnd_test_LDADD): Likewise.
1378         (exception_x86_64_bnd_1.o): New rule.
1379         (exception_x86_64_bnd_2.o): Likewise.
1380         * testsuite/Makefile.in: Regenerated.
1381
1382 2013-11-15  Alan Modra  <amodra@gmail.com>
1383
1384         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1385         accessor.
1386         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1387         Only call ppc64_local_entry_offset for 64-bit.  Restrict
1388         symval_for_branch lookup to ELFv1.
1389         (Stub_table::add_plt_call_entry): Use unsigned int off.
1390         (Output_data_glink::Address, invalid_address): New.
1391         (Output_data_glink::add_eh_frame): Move out of line.  Add
1392         support for ELFv2.
1393         (Output_data_glink::add_global_entry, find_global_entry,
1394         global_entry_address): New functions.
1395         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1396         ge_size): New variables.
1397         (Output_data_glink::set_final_data_size): Add global entry
1398         stub sizing.
1399         (Output_data_glink::do_write): Write global entry stubs.
1400         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1401         parameter.  Return true for ELFv2.  Adjust callers.
1402         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1403         ELFv1.  Similarly for ifunc and dynamic relocation processing
1404         specific to ELFv1.  Recognize that symbols are defined on
1405         their plt entries for ELFv2.
1406         (Target_powerpc::symval_for_branch): Assert if called for
1407         ELFv2 or ppc32.
1408         (Target_powerpc::Relocate::relocate): Use global entry plt
1409         stub for symbol value if such exists on ELFv2.
1410         (Target_powerpc::Relocate::relocate): Don't call
1411         symval_for_branch when ELFv2.  Do adjust for local entry
1412         offset when ELFv2.
1413         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1414         plt stub for ELFv2.
1415         (Target_powerpc::do_plt_address_for_global): Similarly.
1416
1417 2013-11-14  Cary Coutant  <ccoutant@google.com>
1418
1419         Revert patch -- this did not fix the problem, and there is
1420         no race there.
1421
1422         2013-11-14  Cary Coutant  <ccoutant@google.com>
1423
1424             PR gold/14860
1425             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1426             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1427             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1428             updating fde_offsets_.
1429             (Eh_frame_hdr::lock_): New data member.
1430
1431 2013-11-14  Cary Coutant  <ccoutant@google.com>
1432
1433         * dwp.cc (Dwo_file_entry): New type.
1434         (File_list): Use Dwo_file_entry.
1435         (Dwo_file::verify): New function.
1436         (Dwo_file::verify_dwo_list): New function.
1437         (Dwo_file::sized_verify_dwo_list): New function.
1438         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1439         list.
1440         (Dwp_options): New enum type.
1441         (dwp_options): Add --verify-only.
1442         (usage): Likewise.
1443         (main): Likewise.
1444         * dwp.h (gold_info): Add declaration.
1445
1446 2013-11-14  Cary Coutant  <ccoutant@google.com>
1447
1448         PR gold/14860
1449         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1450         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1451         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1452         updating fde_offsets_.
1453         (Eh_frame_hdr::lock_): New data member.
1454
1455 2013-11-06  Cary Coutant  <ccoutant@google.com>
1456
1457         PR gold/15758
1458         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1459         before reloc sections.
1460
1461 2013-11-04  Alan Modra  <amodra@gmail.com>
1462
1463         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1464         (Symbol::needs_dynamic_reloc): Test new flag.
1465         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1466         (Target_powerpc::Scan::get_reference_flags): Add target param.
1467         Return FUNC_DESC_ABI for 64-bit ELFv1.
1468         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1469         call.
1470         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1471         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1472
1473 2013-10-31  Cary Coutant  <ccoutant@google.com>
1474
1475         Restore support for dwp v2 DWARF package file format.
1476
1477         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1478         tu_length parameter.  Adjust all callers.
1479         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1480         * dwp.cc: Include dwarf.h.
1481         (Section_bounds): New struct type.
1482         (Unit_set): New struct type.
1483         (Dwo_file::Dwo_file): Initialize new data member.
1484         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1485         Combine and rename to...
1486         (Dwo_file::read_unit_index): ...this.
1487         (Dwo_file::sized_read_compunit_index)
1488         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1489         (Dwo_file::sized_read_unit_index): ...this.
1490         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1491         parameters; add section_id parameter.
1492         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1493         (Dwo_file::add_unit_set): ...this.
1494         (Dwo_file::shndx_map_): Remove.
1495         (Dwo_file::sect_offsets_): New data member.
1496         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1497         (Dwp_output_file::add_section): Rename to...
1498         (Dwp_output_file::add_contribution): ...this.
1499         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1500         (Dwp_output_file::add_tu_set): Likewise.
1501         (Dwp_output_file::Contribution): New type.
1502         (Dwp_output_file::Section::contributions): New data member.
1503         (Dwp_output_file::Cu_or_tu_set): Remove.
1504         (Dwp_output_file::Section::Section): New ctor.
1505         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1506         (Dwp_output_file::Dwp_index::Section_table): New type.
1507         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1508         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1509         parameter.
1510         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1511         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1512         (Dwp_output_file::Dwp_index::section_table): New member function.
1513         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1514         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1515         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1516         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1517         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1518         (Dwp_output_file::Dwp_index::section_table_): New data member.
1519         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1520         (Dwp_output_file::add_output_section): New member function.
1521         (Dwp_output_file::write_new_section): New member function.
1522         (Dwp_output_file::write_contributions): New member function.
1523         (Dwp_output_file::section_id_map_): New data member.
1524         (class Dwo_id_info_reader): Remove.
1525         (class Unit_reader): New class.
1526         (get_dwarf_section_name): New function.
1527         (Dwo_file::read_executable): Adjust initializations of class data.
1528         (Dwo_file::read): Add support for v2 package file format.
1529         (Dwo_file::read_unit_index): Likewise.
1530         (Dwo_file::sized_read_unit_index): Likewise.
1531         (Dwo_file::copy_section): Likewise.
1532         (Dwo_file::add_unit_set): Likewise.
1533         (Dwp_output_file::add_output_section): Likewise.
1534         (Dwp_output_file::add_contribution): Likewise.
1535         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1536         for empty slot.
1537         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1538         file format.
1539         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1540         slot.
1541         (Dwp_output_file::initialize): Remove unused function.
1542         (Dwp_output_file::finalize): Add support for v2 package file format.
1543         (Dwp_output_file::write_index): Likewise.
1544         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1545         function prototype.
1546
1547 2013-10-31  Cary Coutant  <ccoutant@google.com>
1548
1549         * configure.ac: Fix check for -fmerge-constants.
1550         * configure.ac: Regenerate.
1551
1552 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1553
1554         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1555         Correct 9-byte nop sequence to match what the assembler generates.
1556
1557 2013-10-30  Alan Modra  <amodra@gmail.com>
1558
1559         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1560         ppc64_local_entry_offset, ppc64_local_entry_offset,
1561         do_read_symbols): New functions.
1562         (Powerpc_relobj::e_flags_, st_other_): New vars.
1563         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1564         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1565         (Powerpc_relobj::e_flags_): New var.
1566         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1567         and adjust for ELFv2.
1568         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1569         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1570         (Powerpc_dynobj::do_find_special_sections): Likewise.
1571         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1572         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1573         to ELFv2 local entry.
1574         (Target_powerpc::do_relax): No thread safe barriers needed for
1575         ELFv2.
1576         (Output_data_plt_powerpc::initial_plt_entry_size_,
1577         plt_entry_size): Delete.  Replace all uses with
1578         first_plt_entry_offset() and plt_entry_size().
1579         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1580         reserved_size parm.  Update callers.
1581         (Output_data_plt_powerpc::entry_count): Update.
1582         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1583         and use Target_powerpc::first_plt_entry_offset().
1584         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1585         rename to plt_entry_size.
1586         (Output_data_plt_powerpc::add_ifunc_entry,
1587         add_local_ifunc_entry): Adjust reloc for ELFv2.
1588         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1589         (glink_eh_frame_fde_64v2): New.
1590         (Stub_table::plt_call_size): Support ELFv2 sizing.
1591         (Output_data_glink::add_eh_frame): Use the new FDE.
1592         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1593         (Stub_table::do_write): Write ELFv2 stubs and glink.
1594         (Target_powerpc::Relocate::relocate): Replaces nop after call
1595         with ld 2,24(1) and adjust local offset destination for ELFv2.
1596
1597 2013-10-30  Alan Modra  <amodra@gmail.com>
1598
1599         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1600         (Target_powerpc::Scan::global, local): Likewise.
1601         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1602         on all ppc64 @h and @ha relocs.
1603
1604 2013-10-14  Alan Modra  <amodra@gmail.com>
1605
1606         * output.h (Output_data_got::add_constant): Tidy.
1607         (Output_data_got::add_constant_pair): New function.
1608         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1609         methods used so as to first call reserve_ent().
1610
1611 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1612
1613         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1614         add_got_entry and add_got_entry_pair.
1615
1616         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1617         (HAVE_PUBNAMES): Likewise.
1618         * configure: Regenerate.
1619
1620         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1621         * testsuite/Makefile.in: Regenerate.
1622
1623         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1624         Remove const from declaration.
1625         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1626         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1627         * output.h (Output_file_header): Remove const from member target_
1628         and corresponding constructor argument.
1629         * output.cc (Output_file_header::Output_file_header): Update prototype.
1630         (Output_file_header::do_sized_write): Use this->target_ in place
1631         of parameters()->target().
1632
1633         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1634
1635         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1636         * configure: Regenerate.
1637         * Makefile.in: Regenerate.
1638         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1639         * testsuite/merge_string_literals_2.c: Likewise.
1640         * testsuite/Makefile.am
1641         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1642         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1643         literal -fmerge-constants.
1644         * testsuite/Makefile.in: Regenerate.
1645
1646         * i386.cc (Target_i386): Remove unused member dynbss_.
1647         * arm.cc (Target_arm): Likewise.
1648         * powerpc.cc (Target_powerpc): Likewise.
1649         * sparc.cc (Target_sparc): Likewise.
1650         * tilegx.cc (Target_tilegx): Likewise.
1651         * x86_64.cc (Target_x86_64): Likewise.
1652         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1653         type_signature_, type_offset_.
1654         * plugin.h (Plugin_hook): Remove unused member layout_.
1655         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1656         mapfile_.
1657         (Read_member): Remove unused members input_objects_, symtab_,
1658         mapfile_, layout_.
1659         (Check_library): Remove unused member symtab_.
1660         * archive.h (Lib_group): Remove unused member lib_.
1661         * archive.cc (Lib_group::Lib_group): Update initializer.
1662         * incremental.h (Incremental_binary): Remove unused member target_.
1663         (Incremental_script_entry): Removed unused member script_.
1664         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1665         * icf.h (Icf): Remove unused member num_tracked_relocs.
1666
1667         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1668         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1669         its only use.
1670         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1671
1672         * archive.h: Use struct rather than class for forward declaration
1673         of Read_symbols_data.
1674
1675 2013-10-07  Cary Coutant  <ccoutant@google.com>
1676
1677         PR gold/16010
1678         * testsuite/Makefile.am (icf_test): Fix dependencies.
1679         (icf_safe_test): Likewise.
1680         (icf_safe_so_test): Likewise.
1681         (large_symbol_alignment): Add empty _LDADD rule.
1682         * testsuite/Makefile.in: Regenerate.
1683
1684 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1685
1686         PR gold/15927
1687         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1688         relocation for R_X86_64_32 on x32.
1689
1690 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1691
1692         * output.cc (Output_segment::set_section_addresses): Take new
1693         Target* argument.  If target->isolate_execinstr() and the segment
1694         is executable and starts at a target->abi_pagesize() boundary,
1695         pad its end out to a target->abi_pagesize() boundary with code fill.
1696         * output.h (Output_segment::set_section_addresses): Update decl.
1697         * layout.h (Layout::check_output_data_for_reset_values): Take new
1698         argument RELAX_OUTPUTS.
1699         (Layout): New member relax_output_list_.
1700         (Layout::add_relax_output): New method.
1701         * layout.cc (Layout::Layout): Update constructor.
1702         (Layout::reset_relax_output): New method.
1703         (Layout::clean_up_after_relaxation): Call it.
1704         (Layout::prepare_for_relaxation): Update caller.
1705         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1706         Call reset_relax_output before re-processing segments for
1707         isolate_execinstr case.
1708         (Layout::write_data): Handle relax_output_list_.
1709         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1710         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1711
1712 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1713
1714         PR binutils/15834
1715         * object.h: Fix typos.
1716
1717 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1718
1719         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1720         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1721
1722 2013-08-07  Cary Coutant  <ccoutant@google.com>
1723
1724         Revert support for v2 DWP files:
1725
1726         2013-03-01  Cary Coutant  <ccoutant@google.com>
1727
1728             Add dwp support for v2 DWARF package file format.
1729             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1730             tu_length parameter.  Adjust all callers.
1731             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1732             * dwp.cc: Include dwarf.h.
1733             (Section_bounds): New struct type.
1734             (Unit_set): New struct type.
1735             (Dwo_file::Dwo_file): Initialize new data member.
1736             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1737             Combine and rename to...
1738             (Dwo_file::read_unit_index): ...this.
1739             (Dwo_file::sized_read_compunit_index)
1740             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1741             (Dwo_file::sized_read_unit_index): ...this.
1742             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1743             parameters; add section_id parameter.
1744             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1745             (Dwo_file::add_unit_set): ...this.
1746             (Dwo_file::shndx_map_): Remove.
1747             (Dwo_file::sect_offsets_): New data member.
1748             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1749             (Dwp_output_file::add_section): Rename to...
1750             (Dwp_output_file::add_contribution): ...this.
1751             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1752             (Dwp_output_file::add_tu_set): Likewise.
1753             (Dwp_output_file::Contribution): New type.
1754             (Dwp_output_file::Section::contributions): New data member.
1755             (Dwp_output_file::Cu_or_tu_set): Remove.
1756             (Dwp_output_file::Section::Section): New ctor.
1757             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1758             (Dwp_output_file::Dwp_index::Section_table): New type.
1759             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1760             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1761             parameter.
1762             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1763             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1764             (Dwp_output_file::Dwp_index::section_table): New member function.
1765             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1766             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1767             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1768             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1769             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1770             (Dwp_output_file::Dwp_index::section_table_): New data member.
1771             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1772             (Dwp_output_file::add_output_section): New member function.
1773             (Dwp_output_file::write_new_section): New member function.
1774             (Dwp_output_file::write_contributions): New member function.
1775             (Dwp_output_file::section_id_map_): New data member.
1776             (class Dwo_id_info_reader): Remove.
1777             (class Unit_reader): New class.
1778             (get_dwarf_section_name): New function.
1779             (Dwo_file::read_executable): Adjust initializations of class data.
1780             (Dwo_file::read): Add support for v2 package file format.
1781             (Dwo_file::read_unit_index): Likewise.
1782             (Dwo_file::sized_read_unit_index): Likewise.
1783             (Dwo_file::copy_section): Likewise.
1784             (Dwo_file::add_unit_set): Likewise.
1785             (Dwp_output_file::add_output_section): Likewise.
1786             (Dwp_output_file::add_contribution): Likewise.
1787             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1788             for empty slot.
1789             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1790             file format.
1791             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1792             slot.
1793             (Dwp_output_file::initialize): Remove unused function.
1794             (Dwp_output_file::finalize): Add support for v2 package file format.
1795             (Dwp_output_file::write_index): Likewise.
1796             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1797             function prototype.
1798
1799 2013-07-31  Cary Coutant  <ccoutant@google.com>
1800
1801         * object.cc (Sized_relobj::do_output_section_address): New function.
1802         (Sized_relobj): Instantiate explicitly.
1803         * object.h (Object::output_section_address): New function.
1804         (Object::do_output_section_address): New function.
1805         (Sized_relobj::do_output_section_address): New function.
1806         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1807
1808 2013-07-30  Cary Coutant  <ccoutant@google.com>
1809             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1810
1811         * parameters.cc (Parameters::entry): Return target-specific entry
1812         symbol name.
1813         * target.h (Target::entry_symbol_name): New function.
1814         (Target_info::entry_symbol_name): New data member.
1815
1816         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1817         * i386.cc (Target_i386::i386_info): Likewise.
1818         (Target_i386_nacl::i386_nacl_info): Likewise.
1819         * sparc.cc (Target_sparc::sparc_info): Likewise.
1820         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1821         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1822         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1823         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1824
1825 2013-07-22  Sterling Augustine  <saugustine@google.com>
1826
1827         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1828         Convert parameter shndx to local variable. Add parameters symtab
1829         and symtab_size.  Scan over section names.  Find relocation
1830         section corresponding to current section.  Create and initialize
1831         reloc_mapper_ and reloc_type_.
1832         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1833         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1834         cu_offset_.
1835         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1836         Initialize new fields unit_length_ and cu_offset_.
1837         (Dwarf_pubnames_table::read_section): Update prototype.
1838         (Dwarf_pubnames_table::cu_offset): New member function.
1839         (Dwarf_pubnames_table::subsection_size): Likewise.
1840         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1841         New fields.
1842         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1843         member functions public.
1844         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1845         Update comment.  Rework logic.  Move repeated parts to...
1846         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1847         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1848         pubtypes_table_, and stmt_list_offset.
1849         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1850         Gdb_index::find_pubtype_offset,
1851         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1852         (Gdb_index::pubnames_read): Update prototype and rework logic.
1853         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1854         Forward declare.
1855         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1856         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1857         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1858         Gdb_index::map_pubtable_to_dies):
1859         Declare functions.
1860         (Gdb_index::pubnames_read): Update declaration.
1861         (Gdb_index::Pubname_offset_map): New type.
1862         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1863         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1864         Gdb_index::stmt_list_offset): Declare.
1865         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1866         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1867         Gdb_index::pubtypes_offset_): Remove.
1868
1869 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1870
1871         * options.h (General_options): Add -Trodata-segment option.
1872         * parameters.cc (Parameters::check_rodata_segment): New function.
1873         (Parameters::set_target_once): Call it.
1874         * parameters.h (Parameters): Declare it (private member function).
1875         * layout.cc (load_seg_unusable_for_headers): New function, broken
1876         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1877         then validate rodata segment rather than text segment.
1878         (relaxation_loop_body): Call that.
1879         (is_text_segment): New function.  Don't admit a non-executable
1880         segment if TARGET->isolate_execinstr().
1881         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1882
1883 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1884
1885         PR gold/15070
1886         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1887         * nacl.h (Sniff_file::View::View): Request aligned view.
1888
1889 2013-07-11  Cary Coutant  <ccoutant@google.com>
1890
1891         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1892         correct BRLT entry size.
1893
1894 2013-07-03  Alan Modra  <amodra@gmail.com>
1895
1896         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1897         comment.
1898
1899 2013-07-01  Cary Coutant  <ccoutant@google.com>
1900
1901         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1902         reloc_type_.
1903         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1904         (Dwarf_ranges_table::lookup_reloc): New function.
1905         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1906         reloc_type_.
1907         (Dwarf_ranges_table::lookup_reloc): New function.
1908         (Dwarf_ranges_table::reloc_type_): New data member.
1909
1910 2013-06-27  Jing Yu  <jingyu@google.com>
1911
1912         PR gold/15662
1913         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1914         function.
1915         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1916         (Target_powerpc::do_relax): Call the above.
1917
1918 2013-06-27  Cary Coutant  <ccoutant@google.com>
1919
1920         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1921         on garbage collected .opd section.
1922
1923 2013-06-27  Alan Modra  <amodra@gmail.com>
1924
1925         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1926         is non-zero.
1927         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1928         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1929
1930 2013-06-14  Cary Coutant  <ccoutant@google.com>
1931
1932         * resolve.cc (Symbol::override_base): Don't override st_type
1933         from plugin placeholder symbols.
1934         (Symbol_table::resolve): Likewise.
1935         (Symbol_table::should_override): Don't complain about TLS mismatch
1936         if the TO symbol is a plugin placeholder.
1937         * testsuite/Makefile.am (plugin_test_tls): New test.
1938         * testsuite/Makefile.in: Regenerate.
1939         * testsuite/plugin_test_tls.sh: New test script.
1940         * testsuite/two_file_test_2_tls.cc: New test source.
1941         * testsuite/two_file_test_tls.cc: New test source.
1942
1943 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1944
1945         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1946         the maximum segment alignment is larger than the page size.
1947         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1948         correctly aligns the symbols with large alignemnt.
1949         * testsuite/Makefile.in: Regenerate.
1950         * testsuite/large_symbol_alignment.cc: New file.
1951
1952 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1953             Sriraman Tallam  <tmsriram@google.com>
1954
1955         * options.h (sort_section): New option.
1956         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1957         Rename from Input_section_sort_section_name_special_ordering_compare.
1958         (Input_section_sort_section_name_compare): New struct.
1959         * output.cc (Output_section::Input_section_sort_section_name_compare::
1960         operator()): New function.
1961         (Output_section::sort_attached_input_sections): Use new sort function
1962         for .text if --sort-section=name is specified.
1963         * layout.cc (Layout::make_output_section):
1964         Add sorting by name when --sort-section=name is specified.
1965         * testsuite/Makefile.am (text_section_grouping): Test option
1966         --sort-section=name.
1967         * testsuite/Makefile.in: Regenerate.
1968         * testsuite/section_sorting_name.cc: New file.
1969         * testsuite/section_sorting_name.sh: New file.
1970
1971 2013-05-21  Cary Coutant  <ccoutant@google.com>
1972
1973         * symtab.h (Symbol::is_cxx_vtable): New function.
1974         * target-reloc.h (relocate_section): Check for vtable symbol.
1975         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1976         * testsuite/Makefile.in: Regenerate.
1977         * testsuite/missing_key_func.cc: New test source.
1978         * testsuite/missing_key_func.sh: New test script.
1979
1980 2013-05-21  Cary Coutant  <ccoutant@google.com>
1981
1982         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1983         type of enclosing symbol.
1984         (Relocate_info::location): Check symbol type when describing symbol.
1985         * object.h (Symbol_location_info): Remove unused line_number;
1986         add enclosing_symbol_type.
1987         * testsuite/debug_msg.sh: Adjust expected output.
1988
1989 2013-05-13  Cary Coutant  <ccoutant@google.com>
1990
1991         * configure.ac: Export DEFAULT_TARGET.
1992         * configure: Regenerate.
1993         * Makefile.in: Regenerate.
1994         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1995         * testsuite/Makefile.in: Regenerate.
1996         * testsuite/debug_msg.sh: Delete duplicate tests.
1997         Don't check undef_int error message match for powerpc where the
1998         source file and line number aren't available.
1999
2000 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2001
2002         * options.h (General_options): Add --rosegment-gap option.
2003         * options.cc (finalize): --rosegment-gap implies --rosegment.
2004         * layout.cc (set_segment_offsets): Let user option override
2005         target->rosegment_gap().
2006
2007 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2008
2009         * options.h (General_options): Remove leading space from help
2010         messages for -nostdlib and --rosegment.
2011
2012 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2013
2014         PR ld/15365
2015         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2016
2017 2013-05-03  Alan Modra  <amodra@gmail.com>
2018
2019         * merge.cc (Output_merge_string::do_add_input_section): Correct
2020         scan for number of strings.  Rename vars to avoid shadowing.
2021         Include missing terminator in input_size_.
2022
2023 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2024
2025         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2026         Restore empty string handling.
2027
2028 2013-05-01  Cary Coutant  <ccoutant@google.com>
2029
2030         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2031         uninitialized warning.
2032
2033 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2034
2035         * output.cc (Output_section::add_merge_input_section): Allow
2036         to merge sections if the alignment is more than character size.
2037         * merge.h (Output_merge_string::Output_merge_string): Remove
2038         assert.
2039         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2040         only not-null strings. Check the alignment of strings.
2041         * stringpool.h
2042         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2043         alignment as the argument.
2044         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2045         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2046         Align non-zero length strings according to the addralign_.
2047         (Stringpool_template<Stringpool_char>::set_string_offsets):
2048         Updating offsets according to the given alignment.
2049         * testsuite/Makefile.am (text_section_grouping): Test if string
2050         literals are getting merged.
2051         * testsuite/Makefile.in: Regenerate.
2052         * testsuite/merge_string_literals_1.c: New file.
2053         * testsuite/merge_string_literals_2.c: Ditto.
2054         * testsuite/merge_string_literals.sh: Ditto.
2055
2056 2013-04-26  Ian Lance Taylor  <iant@google.com>
2057
2058         * target-reloc.h (relocate_section): If the reloc offset is out of
2059         range, pass VIEW as NULL to relocate.relocate.
2060         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2061         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2062         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2063         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2064         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2065         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2066
2067 2013-04-26  Geoff Pike  <gpike@chromium.org>
2068
2069         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2070         * layout.cc (Hash_task): New class.
2071         (Layout::queue_build_id_tasks): New function.
2072         (Layout::write_build_id): Handle single-thread portion of build ID
2073         computation.  (In some cases, all of it is single-threaded.)  Replace
2074         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2075         functionality in fewer lines of code.
2076         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2077         * options.h (General_options): make "--build-id" default to tree
2078         rather than sha1.  Add two new options related to --build-id=tree:
2079         --build-id-chunk-size-for-treehash and
2080         --build-id-min-file-size-for-treehash.
2081         * Makefile.am: add testing of --build-id=tree and related new options
2082         (these tests will be invoked by "make check").
2083         * Makefile.in: Regenerate.
2084
2085 2013-04-25  Alan Modra  <amodra@gmail.com>
2086
2087         * configure.tgt: Add powerpcle and powerpc64le.
2088
2089 2013-04-22  Alan Modra  <amodra@gmail.com>
2090
2091         PR gold/15355
2092         * layout.cc (Layout::segment_precedes): Allow more than one
2093         segment with the same type and flags.
2094
2095 2013-04-15  Cary Coutant  <ccoutant@google.com>
2096
2097         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2098         allocate space in file for BSS sections.
2099
2100 2013-04-15  Cary Coutant  <ccoutant@google.com>
2101
2102         * script-sections.cc (Orphan_output_section): Reset address
2103         to zero after each orphaned section for relocatable links.
2104
2105 2013-04-15  Cary Coutant  <ccoutant@google.com>
2106
2107         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2108         section starting address for relocatable link.
2109         * testsuite/Makefile.am (script_test_11): New test.
2110         * testsuite/Makefile.in: Regenerate.
2111         * testsuite/script_test_11.c: New source file.
2112         * testsuite/script_test_11.t: New linker script.
2113
2114 2013-04-13  Alan Modra  <amodra@gmail.com>
2115
2116         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2117         owner when sections are not adjacent and exceed group size.
2118         (Target_powerpc::group_sections): Handle corner case.
2119         (Target_powerpc::Branch_info::make_stub): Handle case where
2120         stub table doesn't exist due to branches in non-exec sections.
2121         (Target_powerpc::Relocate::relocate): Likewise.
2122
2123 2013-04-11  Alan Modra  <amodra@gmail.com>
2124
2125         PR gold/15354
2126         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2127         .branch_lt to match bfd ld.  Adjust comments throughout file.
2128
2129 2013-04-04  Ian Lance Taylor  <iant@google.com>
2130
2131         GCC PR c++/56840
2132         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2133         sections before checking whether they are included in the link.
2134
2135 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2136
2137         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2138         object before calling the plugin claim_file handler.  Pass the elf
2139         object of the archive to the plugin. Delete the elf object if the
2140         plugin claims the file.
2141
2142 2013-03-21  Alan Modra  <amodra@gmail.com>
2143
2144         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2145         segment when omagic.
2146
2147 2013-03-21  Alan Modra  <amodra@gmail.com>
2148
2149         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2150         comparison warning.
2151         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2152         uninitialized" warning.
2153
2154 2013-03-20  Alan Modra  <amodra@gmail.com>
2155
2156         * symtab.h (Symbol::clear_version): New function.
2157         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2158         is_needed by weak references.  Clear version for symbols defined
2159         in as-needed objects that are not needed.
2160
2161 2013-03-15  Alan Modra  <amodra@gmail.com>
2162
2163         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2164         static and public.  Add report_err param.  Return false for data refs.
2165         (Target_powerpc::rela_dyn_section): New overloaded function.
2166         (Target_powerpc::plt_, iplt_): Elucidate.
2167         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2168         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2169         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2170         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2171         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2172         push_branch and make_plt_entry for ifunc syms when
2173         reloc_needs_plt_for_ifunc.
2174         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2175         for ifunc unless reloc_needs_plt_for_ifunc.
2176
2177 2013-03-15  Alan Modra  <amodra@gmail.com>
2178
2179         * gc.h (gc_process_relocs): Don't look through function descriptors.
2180         * icf.cc (get_section_contents): Do so here instead.
2181
2182 2013-03-13  Alan Modra  <amodra@gmail.com>
2183
2184         * powerpc.cc (is_branch_reloc): Forward declare.
2185         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2186         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2187         false for 64-bit, true for 32-bit non-branch relocs.
2188         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2189         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2190         nm output.
2191         (icf_safe_test): Generate linker map file as well as nm output.
2192         (icf_safe_so_test): Likewise.
2193         * testsuite/Makefile.in: Regenerate.
2194         * testsuite/icf_test.sh: Parse linker map file to determine
2195         section folding.
2196         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2197         * testsuite/icf_safe_so_test.sh: Likewise.
2198         (X86_32_or_ARM_specific_safe_fold): Merge into..
2199         (arch_specific_safe_fold): ..this.
2200         (X86_64_specific_safe_fold): Delete unused function.
2201
2202 2013-03-12  Alan Modra  <amodra@gmail.com>
2203
2204         * gc.h (gc_process_relocs): Look through function descriptors
2205         to determine shndx, symvalue and addend used by ICF.  Tidy
2206         variable duplication.
2207
2208 2013-03-11  Alan Modra  <amodra@gmail.com>
2209
2210         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2211         * layout.cc (Layout_task_runner::run): ..to here.
2212         * symtab.h (struct Symbol_location): Extract from..
2213         (class Symbol_table): ..here.
2214         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2215         * target.h (class Target): Add function_location and
2216         do_function_location functions.
2217         (class Sized_target): Add do_function_location.
2218         * object.h (class Sized_relobj_file): Move find_shdr..
2219         (class Object): ..to here.
2220         * object.cc: Likewise.  Update to suit.  Instantiate.
2221         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2222         * powerpc.cc (class Powerpc_dynobj): New.
2223         (Target_powerpc::do_function_location): New function.
2224         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2225         (Powerpc_dynobj::do_read_symbols): New function.
2226         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2227
2228 2013-03-08  Ian Lance Taylor  <iant@google.com>
2229
2230         * options.cc (General_options::string_to_object_format): Accept
2231         "default".
2232
2233 2013-03-08  Alan Modra  <amodra@gmail.com>
2234
2235         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2236         pointer to Post_fde.
2237         (struct Post_fde): Move definition to here..
2238         * ehframe.cc (struct Post_fde): ..from here.
2239         (Cie::write): Don't alloc Post_fde.
2240         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
2241
2242 2013-03-07  Alan Modra  <amodra@gmail.com>
2243
2244         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2245         relocation referencing .LC0.
2246         * testsuite/discard_locals_test.sh: Remove FIXMEs.
2247
2248 2013-03-07  Alan Modra  <amodra@gmail.com>
2249
2250         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2251         always_inline.  Add assembly for powerpc to avoid GOT.
2252
2253 2013-03-07  Alan Modra  <amodra@gmail.com>
2254
2255         * testsuite/script_test_10.sh: Don't test .bss section
2256         header number.
2257
2258 2013-03-06  Alan Modra  <amodra@gmail.com>
2259
2260         * powerpc.cc (class Powerpc_relobj): Move some member functions.
2261         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
2262         all callers.  Handle folded sections.
2263         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2264         to Powerpc_relobj.
2265         (Global_symbol_visitor_opd::operator()): Likewise.
2266
2267 2013-03-04  Alan Modra  <amodra@gmail.com>
2268
2269         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2270         * testsuite/Makefile.in: Regenerate.
2271
2272 2013-03-01  Cary Coutant  <ccoutant@google.com>
2273
2274         Add dwp support for v2 DWARF package file format.
2275         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2276         tu_length parameter.  Adjust all callers.
2277         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2278         * dwp.cc: Include dwarf.h.
2279         (Section_bounds): New struct type.
2280         (Unit_set): New struct type.
2281         (Dwo_file::Dwo_file): Initialize new data member.
2282         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2283         Combine and rename to...
2284         (Dwo_file::read_unit_index): ...this.
2285         (Dwo_file::sized_read_compunit_index)
2286         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2287         (Dwo_file::sized_read_unit_index): ...this.
2288         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2289         parameters; add section_id parameter.
2290         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2291         (Dwo_file::add_unit_set): ...this.
2292         (Dwo_file::shndx_map_): Remove.
2293         (Dwo_file::sect_offsets_): New data member.
2294         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2295         (Dwp_output_file::add_section): Rename to...
2296         (Dwp_output_file::add_contribution): ...this.
2297         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2298         (Dwp_output_file::add_tu_set): Likewise.
2299         (Dwp_output_file::Contribution): New type.
2300         (Dwp_output_file::Section::contributions): New data member.
2301         (Dwp_output_file::Cu_or_tu_set): Remove.
2302         (Dwp_output_file::Section::Section): New ctor.
2303         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2304         (Dwp_output_file::Dwp_index::Section_table): New type.
2305         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2306         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2307         parameter.
2308         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2309         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2310         (Dwp_output_file::Dwp_index::section_table): New member function.
2311         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2312         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2313         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2314         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2315         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2316         (Dwp_output_file::Dwp_index::section_table_): New data member.
2317         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2318         (Dwp_output_file::add_output_section): New member function.
2319         (Dwp_output_file::write_new_section): New member function.
2320         (Dwp_output_file::write_contributions): New member function.
2321         (Dwp_output_file::section_id_map_): New data member.
2322         (class Dwo_id_info_reader): Remove.
2323         (class Unit_reader): New class.
2324         (get_dwarf_section_name): New function.
2325         (Dwo_file::read_executable): Adjust initializations of class data.
2326         (Dwo_file::read): Add support for v2 package file format.
2327         (Dwo_file::read_unit_index): Likewise.
2328         (Dwo_file::sized_read_unit_index): Likewise.
2329         (Dwo_file::copy_section): Likewise.
2330         (Dwo_file::add_unit_set): Likewise.
2331         (Dwp_output_file::add_output_section): Likewise.
2332         (Dwp_output_file::add_contribution): Likewise.
2333         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2334         for empty slot.
2335         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2336         file format.
2337         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2338         slot.
2339         (Dwp_output_file::initialize): Remove unused function.
2340         (Dwp_output_file::finalize): Add support for v2 package file format.
2341         (Dwp_output_file::write_index): Likewise.
2342         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2343         function prototype.
2344
2345 2013-03-01  Cary Coutant  <ccoutant@google.com>
2346
2347         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2348         function into class definition in header file.
2349         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2350         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2351         New function.
2352         (Dwarf_info_reader::check_buffer): Move here from .cc file.
2353
2354 2013-02-28  Alan Modra  <amodra@gmail.com>
2355
2356         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2357         * target.cc (Target::do_plt_fde_location): New function.
2358         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2359         accessor function, and constructor param.
2360         (struct Post_fde, Post_fdes): Declare.
2361         (Cie::write): Add post_fdes param.
2362         * ehframe.cc (Fde::write): Use plt_fde_location.
2363         (struct Post_fde): Define.
2364         (Cie::write): Stash FDEs added post merge mapping.
2365         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2366         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
2367         (Eh_frame::do_sized_write): Arrange to write post map FDES after
2368         other FDEs.
2369         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2370         (Target_powerpc::has_glink): New function.
2371         (Target_powerpc::do_relax): Add eh_frame info for stubs.
2372         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2373         glink_eh_frame_fde_32, default_fde): New data.
2374         (Stub_table::eh_frame_added_): New var.
2375         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2376         Make const.
2377         (Stub_table::add_eh_frame): New function.
2378         (Output_data_glink::add_eh_frame): New function.
2379         (Target_powerpc::make_glink_section): Call add_eh_frame.
2380
2381 2013-02-15  Ian Lance Taylor  <iant@google.com>
2382
2383         * options.h (DEFINE_uint64_alias): Define.
2384         (class General_options): Add -Ttext-segment as an alias for
2385         -Ttext.
2386
2387 2013-02-15  Alan Modra  <amodra@gmail.com>
2388
2389         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2390         (Stub_table::do_write): ..here, two places.
2391         (Stub_table::plt_call_size): Use it here too.
2392
2393 2013-02-11  Ian Lance Taylor  <iant@google.com>
2394
2395         * descriptors.cc (Descriptors::close_all): New function.
2396         * descriptors.h (class Descriptors): Declare close_all.
2397         (close_all_descriptors): New inline function.
2398         * plugin.cc: Include "descriptors.h".
2399         (Plugin_manager::cleanup): Call close_all_descriptors.
2400
2401 2013-02-06  Alan Modra  <amodra@gmail.com>
2402
2403         * README: Update coding style link.
2404
2405 2013-01-28  Cary Coutant  <ccoutant@google.com>
2406
2407         * dwp.cc (File_list): New typedef.
2408         (Dwo_name_info_reader): New class.
2409         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2410         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2411         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2412         (Dwo_file::read_executable): New function.
2413         (Dwo_file::read): Move common setup code to ...
2414         (Dwo_file::make_object): ... here.
2415         (dwp_options): Add --exec/-e.
2416         (usage): Likewise.
2417         (main): Likewise.
2418
2419 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2420
2421         * layout.cc (Layout::layout): Check for option text_reorder.
2422         (Layout::make_output_section): Ditto.
2423         * options.h (text_reorder): New option.
2424         * output.cc (Input_section_sort_compare): Remove special ordering
2425         of section names.
2426         (Output_section::
2427          Input_section_sort_section_name_special_ordering_compare::
2428          operator()): New function.
2429         (Output_section::sort_attached_input_sections): Use new sort function
2430         for .text.
2431         * output.h (Input_section_sort_section_name_special_ordering_compare):
2432         New struct.
2433         * testsuite/Makefile.am (text_section_grouping): Test option
2434         --no-text-reorder
2435         * testsuite/Makefile.in: Regenerate.
2436         * testsuite/text_section_grouping.sh: Check order of functions without
2437         default text reordering.
2438
2439 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2440
2441         * options.h (General_options): Change default to true for new_dtags.
2442
2443 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2444
2445         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2446         when enable_new_dtags is false.  Only add DT_RUNPATH when
2447         enable_new_dtags is true.
2448
2449 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2450
2451         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2452         used in declaration and definition consistent.
2453         (Target_powerpc::symval_for_branch): Ditto.
2454
2455 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2456
2457         * testsuite/plugin_final_layout.cc: Fix comment.
2458
2459 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2460
2461         * layout.cc (Layout::layout): Do not do default sorting for
2462         text sections when section ordering is specified.
2463         (make_output_section): Ditto.
2464         * testsuite/plugin_final_layout.cc: Name the function sections
2465         to catch reordering issues.
2466
2467 2013-01-15  Alan Modra  <amodra@gmail.com>
2468
2469         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2470         plt-thread-safe.
2471
2472 2013-01-15  Alan Modra  <amodra@gmail.com>
2473
2474         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2475         * testsuite/Makefile.in: Regenerate.
2476
2477 2013-01-14  Alan Modra  <amodra@gmail.com>
2478
2479         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2480         * testsuite/Makefile.in: Regenerate.
2481
2482 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2483
2484         PR bfd/14430
2485         Fix mingw gold build with plugins enabled
2486         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2487         * configure.ac: Export DLOPEN_LIBS and add headers check.
2488         * plugin.cc: Handle non-dlfcn case.
2489         * Makefile.in: Regenerate.
2490         * config.in: Regenerate.
2491         * configure: Regenerate.
2492         * testsuite/Makefile.in: Regenerate.
2493
2494 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2495
2496         * output.h (sort_attached_input_sections): Change to be public.
2497         * script-sections.cc
2498         (Output_section_definition::set_section_addresses): Sort
2499         attached input sections according to section order before linker
2500         script assigns section addresses.
2501         (Orphan_output_section::set_section_addresses): Sort
2502         attached input sections according to section order before linker
2503         script assigns section addresses.
2504         * Makefile.am (final_layout.sh): Use a simple linker script to
2505         check if section ordering still works.
2506         * Makefile.in: Regenerate.
2507
2508 2013-01-09  Ben Cheng  <bccheng@google.com>
2509
2510         * arm.cc (Target_arm::attributes_accept_div): New function.
2511         (Target_arm::attributes_forbid_div): New function.
2512         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2513         attribute using the same new functions as what bfd/elf32_arm.c
2514         does.
2515
2516 2013-01-07  Cary Coutant  <ccoutant@google.com>
2517
2518         PR gold/14993
2519         * output.cc (Output_section::add_input_section): For incremental
2520         updates, don't track input sections that are allocated from patch
2521         space.
2522
2523 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2524             Ian Lance Taylor  <iant@google.com>
2525
2526         PR gold/14897
2527         * configure.ac (--enable-ld): Removed.
2528         (install_as_default): Set to yes only for --enable-gold=default
2529         or --disable-ld.
2530         * configure: Regenerated.
2531
2532 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2533
2534         * options.h (General_options): Add -fuse-ld= for GCC linker
2535         option compatibility.
2536
2537 2013-01-04  Cary Coutant  <ccoutant@google.com>
2538
2539         * configure.ac: Fix typo restoring CXXFLAGS.
2540         * configure: Regenerate.
2541
2542 2013-01-04  Cary Coutant  <ccoutant@google.com>
2543
2544         * testsuite/Makefile.am (CXXLINK_S): New macro.
2545         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2546         * testsuite/Makefile.in: Regenerate.
2547
2548 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2549
2550         * version.cc (print_version): Update copyright year to 2013.
2551
2552 2012-12-20  Ian Lance Taylor  <iant@google.com>
2553
2554         * layout.cc (Layout::special_ordering_of_input_section): New
2555         function.
2556         (Layout::layout): If input section requires special ordering, must
2557         sort input sections.
2558         (Layout::make_output_section): May sort .text input sections.
2559         (Layout::is_section_name_prefix_grouped): Remove.
2560         * layout.h (class Layout): Declare
2561         special_ordering_of_input_section.  Don't declare
2562         is_section_name_prefix_grouped.
2563         * output.cc (Output_section::add_input_section): Revert last
2564         change.
2565         (Output_section::Input_section_sort::match_file_name): Don't crash
2566         if called on output section data.
2567         (Output_section::Input_section_sort_compare): Sort based on
2568         special ordering.
2569         (Output_section::Input_section_sort_section_order_index_compare):
2570         Revert last patch.
2571         (Output_section::sort_attached_input_sections): Likewise.
2572
2573 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2574
2575         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2576         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2577         * output.cc (Output_section::add_input_section): Check if section
2578         name contains special prefix.  Keep input sections to sort such
2579         sections.
2580         (Output_section::Input_section_sort_section_order_index_compare
2581          ::operator()): Group sections according to prefixes.
2582         (Output_section::sort_attached_input_sections): Add condition to
2583         Input_section_entry constructor call.
2584         * testsuite/Makefile.am (text_section_grouping): New test.
2585         * testsuite/Makefile.in: Regenerate.
2586         * testsuite/text_section_grouping.cc: New file.
2587         * testsuite/text_section_grouping.sh: New file.
2588
2589 2012-12-17  Nick Clifton  <nickc@redhat.com>
2590
2591         * Makefile.am: Add copyright notice.
2592         * NEWS: Likewise.
2593         * README: Likewise.
2594         * configure.ac: Likewise.
2595         * ftruncate.c: Likewise.
2596         * Makefile.in: Regenerate.
2597
2598 2012-12-14  Cary Coutant  <ccoutant@google.com>
2599
2600         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2601         --no-as-needed flag.
2602         (exception_separate_shared_12_test): Likewise.
2603         (incremental_copy_test): Likewise.
2604         * testsuite/Makefile.in: Regenerate.
2605
2606 2012-12-14  Cary Coutant  <ccoutant@google.com>
2607
2608         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2609         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2610
2611 2012-12-12  Alan Modra  <amodra@gmail.com>
2612
2613         * powerpc.cc (class Track_tls): New.
2614         (class Relocate, class Scan): Inherit Track_tls.
2615         (Target_powerpc::Scan::local, global): Track tls optimization
2616         and avoid creating plt entry for __tls_get_addr if all uses
2617         are optimized away.
2618         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2619
2620 2012-12-12  Alan Modra  <amodra@gmail.com>
2621
2622         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2623         Replace no_toc_optimize with toc_optimize.
2624         * output.h (Output_section::input_sections): Provide non-const variant.
2625         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2626         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2627         accessors.
2628         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2629         (class Sort_toc_sections): New.
2630         (Target_powerpc::do_finalize_sections): Sort toc sections.
2631         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2632
2633 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2634
2635         * testsuite/binary_unittest.cc (read_all): New function.
2636         (Sized_binary_test): Use it instead of ::read.
2637         * fileread.cc (do_read): Don't assume pread always reads the whole
2638         amount in a single call.
2639
2640 2012-12-10  Alan Modra  <amodra@gmail.com>
2641
2642         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2643         Set EM_PPC64 or EM_PPC here.
2644         (Target_selector_powerpc::do_recognize): Delete.
2645
2646 2012-12-10  Alan Modra  <amodra@gmail.com>
2647
2648         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2649         stub_table_.
2650         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2651
2652 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2653
2654         * testsuite/binary_unittest.cc (Sized_binary_test):
2655         Use open_descriptor rather than ::open.
2656
2657 2012-12-07  Alan Modra  <amodra@gmail.com>
2658
2659         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2660         typedef and invalid_address constant.
2661         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2662         instantiate constants.
2663
2664 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2665
2666         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2667         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2668         * aclocal.m4: Regenerate.
2669         * configure: Regenerate.
2670         * Makefile.in: Regenerate.
2671         * testsuite/Makefile.in: Regenerate.
2672
2673 2012-12-07  Alan Modra  <amodra@gmail.com>
2674
2675         * options.h (General_options): Add no_toc_optimize.
2676         * powerpc.cc (ok_lo_toc_insn): New function.
2677         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2678
2679 2012-12-06  Alan Modra  <amodra@gmail.com>
2680
2681         * options.h (General_options): Add plt_align, plt_static_chain,
2682         plt_thread_safe.  Update stub_group_size help text.
2683         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2684         for new plt_thread_safe_ var.
2685         (use_plt_offset): Correct comments.
2686         (Target_powerpc::do_relax): Look for thread creation symbols to
2687         determine default plt_thread_safe value.  Clear plt call stubs
2688         as well as branch stubs each iteration.
2689         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2690         insn constants.
2691         (l, hi, ha, write_insn): Move earlier.
2692         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2693         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2694         plt stubs too.
2695         (Stub_table::update_size): Adjust.
2696         (Stub_table::prev_size, set_prev_size): Delete.
2697         (Stub_table::stub_align): Let --plt-align affect result.
2698         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2699         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2700         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2701         (Stub_table::do_write): Support more stub variants.
2702
2703 2012-12-04  Alan Modra  <amodra@gmail.com>
2704
2705         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2706         (Target_powerpc::do_define_standard_symbols): New function.
2707
2708 2012-12-03  Alan Modra  <amodra@gmail.com>
2709
2710         * output.h: Formatting, whitespace.
2711
2712 2012-12-03  Alan Modra  <amodra@gmail.com>
2713
2714         * layout.h (Layout::get_executable_sections): Declare.
2715         * layout.cc (Layout::get_executable_sections): New function.
2716         * arm.cc (Target_arm::group_sections): Use it.
2717         (Arm_output_section::group_sections): Delete now redundant test.
2718         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2719         param to handle relative relocs.
2720         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2721         (Output_data_reloc::add_absolute): Adjust.
2722         (Output_data_reloc::add_relative): New function.
2723         (Output_data::reset_data_size): New function.
2724         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2725         (Output_section::set_addralign): New function.
2726         (Output_section::checkpoint_set_addralign): New function.
2727         (Output_section::clear_section_offsets_need_adjustment): New function.
2728         (Output_section::input_sections): Make public.
2729         * powerpc.cc (class Output_data_brlt_powerpc): New.
2730         (class Stub_table, class Stub_control): New.
2731         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2732         stub_table_, set_stub_table, stub_table): New vectors and accessor
2733         functions.
2734         (Target_powerpc::do_may_relax, do_relax, push_branch,
2735         new_stub_table, stub_tables, brlt_section, group_sections,
2736         add_branch_lookup_table, find_branch_lookup_table,
2737         write_branch_lookup_table, make_brlt_section): New functions.
2738         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2739         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2740         branch_info_): New vars.
2741         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2742         make call stubs here.
2743         (Output_data_glink): Remove all call stub handling from this class.
2744         (Target_powerpc::Scan::local, global): Save interesting branch
2745         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2746         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2747         functions on final link.
2748         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2749         Handle long branch destinations too.
2750         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2751         do_plt_address_for_local): Adjust lookup of plt call stubs.
2752
2753 2012-11-30  Alan Modra  <amodra@gmail.com>
2754
2755         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2756         relocs against protected symbols when building 32-bit shared libs.
2757
2758 2012-11-30  Alan Modra  <amodra@gmail.com>
2759
2760         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2761         param.  Call got_section() to make .got.  Update all callers
2762         and their callers and so on.
2763
2764 2012-11-30  Alan Modra  <amodra@gmail.com>
2765
2766         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2767         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2768         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2769         value if it already exists.
2770
2771 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2772
2773         PR gold/14858
2774         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2775
2776 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2777
2778         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2779         than bfc instruction for data sandboxing.
2780
2781 2012-11-08  Alan Modra  <amodra@gmail.com>
2782
2783         * po/POTFILES.in: Regenerate.
2784
2785 2012-11-05  Alan Modra  <amodra@gmail.com>
2786
2787         * configure.ac: Apply 2012-09-10 change to config.in here.
2788         * configure: Regenerate.
2789
2790 2012-11-05  Alan Modra  <amodra@gmail.com>
2791
2792         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2793         (struct Opd_ent): Use "Address" rather than "Offset".
2794         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2795         (Target_powerpc::got_section): Make public.
2796         (Target_powerpc::scan_relocs): Move code setting symbols..
2797         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2798         Create _SDA_BASE_ only when referenced.
2799
2800 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2801
2802         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2803         from last change.
2804
2805 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2806
2807         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2808         for offset_in_output_section parameter.
2809         (Sized_target::relocate_special_relocatable): Likewise.
2810         * arm.cc (Target_arm::relocate_relocs): Likewise.
2811         (Target_arm::relocate_special_relocatable): Likewise.
2812         * i386.cc (Target_i386::relocate_relocs): Likewise.
2813         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2814         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2815         * target-reloc.h (relocate_relocs): Likewise.
2816         * testsuite/testfile.cc (Target_test): Likewise.
2817         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2818         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2819
2820         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2821         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2822
2823         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2824         parameter, which is unused in the [!F_SETFD] case.
2825
2826         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2827         SYMNDX to off_t before comparing it to this->data_size().
2828         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2829         * incremental.cc (Output_section_incremental_inputs::do_write):
2830         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2831
2832         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2833
2834 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2835
2836         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2837         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2838         in EABI_VER5.
2839
2840 2012-10-29  Cary Coutant  <ccoutant@google.com>
2841
2842         * dwp.cc (usage): Add file and exit status parameters;
2843         add --help and --version options.
2844         (print_version): New function.
2845         (main): Add --help and --version options.
2846
2847 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2848
2849         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2850         final_layout_sequence.txt.
2851         * testsuite/Makefile.in: Regenerated.
2852
2853 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2854
2855         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2856         COMPILE generated by automake.
2857         (LINK1): Likewise.
2858         (CXXCOMPILE1): Likewise.
2859         (CXXLINK1): Likewise.
2860         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2861         (LINK): Likewise.
2862         (CXXCOMPILE): Likewise.
2863         (CXXLINK): Likewise.
2864         * testsuite/Makefile.in: Regenerated.
2865
2866 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2867
2868         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2869         on bad fwrite return.
2870
2871 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2872
2873         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2874         on val.
2875
2876 2012-10-23  Cary Coutant  <ccoutant@google.com>
2877
2878         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2879         * testsuite/Makefile.in: Regenerate.
2880         * testsuite/dwp_test.h: New source file.
2881         * testsuite/dwp_test_1.cc: New source file.
2882         * testsuite/dwp_test_1.s: New source file.
2883         * testsuite/dwp_test_1.sh: New source file.
2884         * testsuite/dwp_test_1b.cc: New source file.
2885         * testsuite/dwp_test_1b.s: New source file.
2886         * testsuite/dwp_test_2.cc: New source file.
2887         * testsuite/dwp_test_2.s: New source file.
2888         * testsuite/dwp_test_2.sh: New source file.
2889         * testsuite/dwp_test_main.cc: New source file.
2890         * testsuite/dwp_test_main.s: New source file.
2891
2892 2012-10-23  Cary Coutant  <ccoutant@google.com>
2893
2894         * dwp.h: New header file.
2895         * dwp.cc: New source file.
2896         * gold.h: Move shared declarations to system.h.
2897         * system.h: New header file.
2898         * Makefile.am: Add dwp.
2899         * Makefile.in: Regenerate.
2900
2901 2012-10-23  Cary Coutant  <ccoutant@google.com>
2902
2903         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2904         Dwarf_info_reader::read_from_pointer.
2905         (Dwarf_pubnames_table::read_header): Likewise.
2906         (Dwarf_pubnames_table::next_name): Likewise.
2907         (Dwarf_die::read_attributes): Likewise.
2908         (Dwarf_die::skip_attributes): Likewise.
2909         (Dwarf_info_reader::read_from_pointer): New function template.
2910         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2911         (Dwarf_pubnames_table): Likewise.
2912         (Dwarf_info_reader::read_from_pointer): New function template.
2913         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2914         Dwarf_pubnames_table ctor.
2915
2916 2012-10-23  Cary Coutant  <ccoutant@google.com>
2917
2918         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2919         abbrev_shndx.
2920         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2921         abbrev_shndx_.
2922         (Dwarf_info_reader::set_abbrev_shndx): New method.
2923         (Dwarf_info_reader::abbrev_shndx_): New data member.
2924
2925 2012-10-23  Cary Coutant  <ccoutant@google.com>
2926
2927         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2928         from object, not parameters.
2929         (Dwarf_info_reader::parse): Likewise.
2930         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2931         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2932         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2933         methods.
2934
2935 2012-10-23  Cary Coutant  <ccoutant@google.com>
2936
2937         * fileread.cc (Input_file::Input_file): New constructor.
2938         * fileread.h (class Input_file): Add new constructor.
2939
2940 2012-10-18  Alan Modra  <amodra@gmail.com>
2941
2942         PR gold/14727
2943         * object.cc (Relobj::is_section_name_included): Also match
2944         .sdata personality section.
2945
2946 2012-10-18  Alan Modra  <amodra@gmail.com>
2947
2948         * target-reloc.h (class Default_comdat_behavior): New, package up..
2949         (get_comdat_behaviour): ..this.
2950         (relocate_section): Add Relocate_comdat_behavior template arg,
2951         adjust code to suit.
2952         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2953         (Target_arm::scan_reloc_section): Likewise.
2954         * i386.cc (Target_i386::relocate_section): Likewise.
2955         * sparc.cc (Target_sparc::relocate_section): Likewise.
2956         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2957         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2958         * powerpc.cc (class Relocate_comdat_behavior): New.
2959         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2960         gold::relocate_section with new template arg.
2961
2962 2012-10-18  Alan Modra  <amodra@gmail.com>
2963
2964         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2965         dynamic relocs for GOT_TPREL got entries, without symbol if
2966         resolving locally.
2967         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2968         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2969         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2970
2971 2012-10-17  Alan Modra  <amodra@gmail.com>
2972
2973         PR gold/14726
2974         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2975
2976 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2977
2978         * layout.cc (Layout::include_section): Keep sections marked
2979         SHF_EXCLUDE when doing relocatable links.
2980
2981 2012-10-16  Alan Modra  <amodra@gmail.com>
2982
2983         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2984         (Target_powerpc::do_finalize_sections): Call it.
2985         (Output_data_save_res): New class and supporting functions.
2986         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2987         normal symbols defined in object files.
2988
2989 2012-10-12  Alan Modra  <amodra@gmail.com>
2990
2991         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2992         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2993         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2994         section if scan_opd_relocs not yet called.
2995         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2996
2997 2012-10-12  Alan Modra  <amodra@gmail.com>
2998
2999         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3000         add_local_ifunc_entry): Revert last change.
3001         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3002
3003 2012-10-05  Alan Modra  <amodra@gmail.com>
3004
3005         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3006         do_plt_address_for_global): New functions.
3007         (Output_data_got_powerpc::do_write): Don't segfault when linking
3008         statically.
3009         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3010         add_local_ifunc_entry): Return true on adding entry..
3011         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3012         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3013         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3014         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3015         set up symbols here.
3016         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3017         syms here.  Do so even when no .iplt.  Don't segfault when linking
3018         statically.
3019         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3020         new variants without reloc param.
3021         (Glink_sym_ent::Glink_sym_ent): Likewise.
3022         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3023         reloc when refs will resolve to plt call stub.
3024         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3025         R_PPC_PLTREL24 to resolve locally.
3026         (Target_powerpc::Scan::global): Correct ifunc handling.
3027         (Target_powerpc::Relocate::relocate): Correct local sym glink
3028         lookup.  Don't destroy "value" when we have a plt call stub,
3029         and when checking plt call validity.
3030         (Target_powerpc::do_dynsym_value): Simplify.
3031
3032 2012-10-05  Alan Modra  <amodra@gmail.com>
3033
3034         * i386.cc (Output_data_plt_i386::address_for_global,
3035         address_for_local): Add plt offset to returned value.  Adjust uses.
3036         * sparc.cc (Output_data_plt_sparc::address_for_global,
3037         address_for_local): Likewise.
3038         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3039         address_for_local): Likewise.
3040         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3041         address_for_local): Likewise.
3042         * target.h (Target::plt_address_for_global, plt_address_for_local):
3043         Update comment.
3044         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3045         (Output_data_got::Got_entry::write): Nor here.
3046         * output.h: Comment fix.
3047
3048 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3049
3050         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3051         global_offset_table_ value for larget got.
3052         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3053
3054 2012-09-29  Alan Modra  <amodra@gmail.com>
3055
3056         * powerpc.cc (Target_powerpc::iplt_): New output section.
3057         (Target_powerpc::iplt_section, make_iplt_section,
3058         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3059         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3060         Target_powerpc::plt_entry_count): Count iplt entries too.
3061         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3062         reloc section in constructor.  New params.
3063         (Target_powerpc::make_plt_section): Create reloc section here instead.
3064         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3065         functions.
3066         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3067         (Output_data_glink::add_entry, find_entry): New functions to
3068         deal with local syms.
3069         (Glink_sym_ent): Add support for local syms.
3070         (Output_data_glink::do_write): Handle ifunc plt entries.
3071         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3072         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3073         (Target_powerpc::Relocate::relocate): Likewise.
3074         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3075
3076 2012-09-25  Alan Modra  <amodra@gmail.com>
3077
3078         * object.h (Sized_relobj_file::adjust_local_symbol,
3079         do_adjust_local_symbol): New functions.
3080         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3081         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3082         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3083         and irregular opd entry spacing.
3084         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3085         (Global_symbol_visitor_opd): New functor.
3086         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3087         on deleted opd entries.
3088
3089 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3090
3091         * tilegx.cc: New file.
3092         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3093         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3094         * configure.tgt: Add entries for tilegx*.
3095         * configure.ac: Likewise.
3096         * Makefile.in: Rebuild.
3097         * configure: Likewise.
3098         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3099         tilegx.
3100
3101 2012-09-13  Alan Modra  <amodra@gmail.com>
3102
3103         * target-reloc.h (scan_relocs): Call scan.local for relocs
3104         against symbols in discarded sections.  Pass is_discarded
3105         param.
3106         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3107         Add is_discarded param.
3108         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3109         is_discarded to flag opd entry as discarded.  Don't emit dyn
3110         relocs on such entries.
3111         (Target_powerpc::Scan::global): Similarly detect and handle
3112         such opd entries.
3113         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3114         opd_ent_.  Update all uses.
3115         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3116         (Target_powerpc::relocate_section): Zero out discarded opd
3117         entry relocs.
3118
3119 2012-09-12  Ian Lance Taylor  <iant@google.com>
3120
3121         PR gold/14570
3122         * output.cc: Rename Output_data_got template parameter from size
3123         to got_size for all functions.  Compile all variants of
3124         Output_data_got.
3125         (Output_data_got::Got_entry::write): Correct use of size for
3126         symbol value.  Use local_is_tls rather than casting to
3127         Sized_relobj_file.
3128         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3129         (class Sized_relobj_file): Add do_local_is_tls.
3130         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3131
3132 2012-09-11  Alan Modra  <amodra@gmail.com>
3133
3134         PR gold/14566
3135         * layout.cc (Layout::set_segment_offsets): When using
3136         common-page-size alignment, ensure we are on a new max-page-size
3137         page.
3138         * output.cc (Output_segment::set_section_addresses): Use
3139         abi_pagesize, not common_pagesize for relro boundary.
3140         (Output_segment::set_offset): Likewise.
3141
3142 2012-09-11  Alan Modra  <amodra@gmail.com>
3143
3144         * output.h (Output_data_got::add_global_tls, add_local_tls,
3145         add_local_tls_pair): New functions.
3146         (Output_data_got::add_local_pair_with_rel): Remove second
3147         reloc param.  Expand comment.
3148         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3149         use_plt_or_tls_offset_, similarly for constructor param.
3150         (Output_data_got::Got_entry::write): Add got_index param.
3151         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3152         add_local_tls_pair): New functions.
3153         (Output_data_got::Got_entry::write): Handle tls symbols
3154         with use_plt_or_tls_offset_ set specially.
3155         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3156         (Output_data_got::do_write): Replace iterator with index, pass
3157         index to entry write function.
3158         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3159         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3160         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3161         call.
3162         * i386.cc (Target_i386::Scan::local): Likewise.
3163         * sparc.cc (Target_sparc::Scan::local): Likewise.
3164         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3165         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3166         do_tls_offset_for_global): New functions.
3167         (Target_powerpc::Scan::local): Correct TLS relocations and got
3168         entry values.
3169         (Target_powerpc::Scan::global): Don't emit unnecessary
3170         dynamic relocations on TLS GOT entries.
3171
3172 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3173
3174         * config.in: Disable sanity check for kfreebsd.
3175
3176 2012-09-10  Sterling Augustine  <saugustine@google.com>
3177
3178         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3179         (Gdb_index::pubtypes_read): New parameter.
3180         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3181         to calls.
3182         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3183         pubtypes_object_.
3184
3185 2012-09-09  Alan Modra  <amodra@gmail.com>
3186
3187         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3188         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3189         * gc.h (gc_process_relocs): Call target gc_add_reference.
3190         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3191         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3192         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3193         unnecessary cast.
3194         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3195         to cater for when we don't need code offset.  Update use.
3196         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3197         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3198         set_opd_valid): New functions.
3199         (Target_powerpc::do_gc_add_reference): New function.
3200         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3201         stashed refs.
3202         (Target_powerpc::do_gc_mark_symbol): New function.
3203
3204 2012-09-06  Cary Coutant  <ccoutant@google.com>
3205
3206         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3207         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3208         (Dwarf_die::skip_attributes): Likewise.
3209         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3210         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3211         (main): Call it.
3212         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3213
3214 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3215
3216         * testsuite/script_test_3.t: Add .got.plt output section
3217         statement.
3218         * testsuite/script_test_4.t: Likewise.
3219
3220 2012-09-05  Alan Modra  <amodra@gmail.com>
3221
3222         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3223         update all uses and lose "enum" when using type.
3224
3225 2012-09-05  Alan Modra  <amodra@gmail.com>
3226
3227         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3228         * configure: Regenerate.
3229         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3230         (plugin_final_layout.stdout): Likewise.
3231         (memory_test): Set page sizes to 0x1000.
3232         * testsuite/Makefile.in: Regenerate.
3233         * testsuite/discard_locals_test.sh: Add FIXME comment.
3234         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3235         * testsuite/pr14265.t: Add .got output section statement.
3236         * testsuite/script_test_2.t: Likewise.
3237         * testsuite/script_test_3.t: Likewise.
3238         * testsuite/script_test_4.t: Likewise.
3239         * testsuite/script_test_5.t: Likewise.
3240         * testsuite/script_test_6.t: Likewise.
3241         * testsuite/script_test_7.t: Likewise.
3242         * testsuite/script_test_9.t: Likewise.
3243
3244 2012-09-05  Alan Modra  <amodra@gmail.com>
3245
3246         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3247         (Powerpc_relocate_functions::Status): New typedef.
3248         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3249         (Target_powerpc::Scan::local): Handle REL64.
3250         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3251         for REL32 and REL64.
3252         (Target_powerpc::symval_for_branch): New function, extracted from..
3253         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
3254         checks.  Report overflow errors.
3255
3256 2012-09-05  Alan Modra  <amodra@gmail.com>
3257
3258         * object.h (Sized_relobj_file::emit_relocs): Delete.
3259         (Sized_relobj_file::emit_relocs_reltype): Delete.
3260         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3261         relocate_relocs for --emit-relocs.
3262         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3263         * output.h: Update comment.
3264         (Output_segment::first_section): New function.
3265         (Output_segment::first_section_load_address): Use first_section.
3266         * output.cc (Output_segment::first_section): New function extracted..
3267         (Output_segment::first_section_load_address): ..from here.  Delete.
3268         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3269         * target.h (Sized_target::relocate_for_relocatable): Likewise.
3270         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3271         adjust call to target.h function.
3272         * i386.cc (Target_i386): Likewise.
3273         * sparc.cc (Target_sparc): Likewise.
3274         * x86_64.cc (Target_x86_64): Likewise.
3275         * powerpc.cc (Target_powerpc): Likewise.
3276         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
3277         first tls section has section symbol for optimised local dynamic
3278         output relocs.
3279         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3280         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3281         optimised tls code.
3282         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3283         Rename to relocate_relocs.  Update error message.
3284
3285 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
3286
3287         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3288         --just-symbols.
3289
3290 2012-08-31  Alan Modra  <amodra@gmail.com>
3291
3292         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3293         (Powerpc_relobj::toc_base_offset): New stub function.
3294         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
3295         got_mod_index_offset to tlsld_got_offset.  Update all refs.
3296         (Target_powerpc::Relocate::enum skip_tls): New.
3297         (Target_powerpc::call_tls_get_addr_): New var.
3298         (Target_powerpc::is_branch_reloc): Move to file scope.
3299         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3300         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3301         New functions.
3302         (Target_powerpc::enum Got_type): Delete old values, add new ones.
3303         (powerpc_info): Correct common_pagesize for ppc64.
3304         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3305         (Powerpc_relocate_functions): Add overflow check enums and functions.
3306         Add non-shift version of rela, rela_ua.  Delete all rel public
3307         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
3308         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3309         addr16_ha3, addr14 functions.
3310         (Output_data_got_powerpc::add_constant_pair): New function.
3311         (Output_data_got_powerpc::got_base_offset): Likewise.
3312         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3313         (instruction constants): Sort, add some more.
3314         (Output_data_glink::do_write): Add and use Address typedef.  Use
3315         object->toc_base_offset() stub for 64-bit.
3316         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3317         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3318         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3319         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
3320         Always treat .opd relocs as against locally defined symbol.
3321         Correct condition for RELATIVE relocs.
3322         (Target_powerpc::do_finalize_sections): Test for NULL sections.
3323         (Target_powerpc::Relocate::relocate): Use plt call stub as value
3324         for 32-bit syms with a plt entry.  Correct ppc64 toc base
3325         calculations.  Handle TLS relocs, and more.  Add overflow
3326         checking and adjust for Powerpc_relocate_functions changes.
3327         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3328         Reinstate --emit-relocs code with FIXME.
3329
3330 2012-08-30  Alan Modra  <amodra@gmail.com>
3331
3332         * layout.cc (Layout::set_segment_offsets): Set p_align to
3333         abi_pagesize, not common_pagesize.
3334         (Layout::relaxation_loop_body): Similarly use abi_pagesize
3335         to determine whether file header can go in segment.
3336
3337 2012-08-30  Alan Modra  <amodra@gmail.com>
3338
3339         * output.h (Output_reloc::Output_reloc <output section>): Add
3340         is_relative param.  Adjust calls.
3341         (Output_reloc::add_output_section_relative): New functions.
3342         * output.cc (Output_reloc::Output_reloc <output section>): Handle
3343         is_relative.
3344         (Output_reloc::symbol_value): Handle SECTION_CODE.
3345
3346 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
3347
3348         * gold.cc (queue_middle_tasks): Call layout again when unique
3349         segments for sections is desired.
3350         * layout.cc (Layout::Layout): Initialize new members.
3351         (Layout::get_output_section_flags): New function.
3352         (Layout::choose_output_section): Call get_output_section_flags.
3353         (Layout::layout): Make output section for mapping to a unique segment.
3354         (Layout::insert_section_segment_map): New function.
3355         (Layout::attach_allocated_section_to_segment): Make unique segment for
3356         output sections marked so.
3357         (Layout::segment_precedes): Check for unique segments when sorting.
3358         * layout.h (Layout::Unique_segment_info): New struct.
3359         (Layout::Section_segment_map): New typedef.
3360         (Layout::insert_section_segment_map): New function.
3361         (Layout::get_output_section_flags): New function.
3362         (Layout::is_unique_segment_for_sections_specified): New function.
3363         (Layout::set_unique_segment_for_sections_specified): New function.
3364         (Layout::unique_segment_for_sections_specified_): New member.
3365         (Layout::section_segment_map_): New member.
3366         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3367         Rename is_gc_pass_one to is_pass_one.
3368         Rename is_gc_pass_two to is_pass_two.
3369         Rename is_gc_or_icf to is_two_pass.
3370         Check for which pass based on whether symbols data is present.
3371         Make it two pass when unique segments for sections is desired.
3372         * output.cc (Output_section::Output_section): Initialize new
3373         members.
3374         * output.h (Output_section::is_unique_segment): New function.
3375         (Output_section::set_is_unique_segment): New function.
3376         (Output_section::is_unique_segment_): New member.
3377         (Output_section::extra_segment_flags): New function.
3378         (Output_section::set_extra_segment_flags): New function.
3379         (Output_section::extra_segment_flags_): New member.
3380         (Output_section::segment_alignment): New function.
3381         (Output_section::set_segment_alignment): New function.
3382         (Output_section::segment_alignment_): New member.
3383         (Output_segment::Output_segment): Initialize is_unique_segment_.
3384         (Output_segment::is_unique_segment): New function.
3385         (Output_segment::set_is_unique_segment): New function.
3386         (Output_segment::is_unique_segment_): New member.
3387         * plugin.cc (allow_unique_segment_for_sections): New function.
3388         (unique_segment_for_sections): New function.
3389         (Plugin::load): Add new functions to transfer vector.
3390         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3391         * Makefile.in: Regenerate.
3392         * testsuite/plugin_final_layout.sh: Check if unique segment
3393         functionality works.
3394         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3395         are available.
3396         (allow_unique_segment_for_sections): New global.
3397         (unique_segment_for_sections): New global.
3398         (claim_file_hook): Call allow_unique_segment_for_sections.
3399         (all_symbols_read_hook): Call unique_segment_for_sections.
3400
3401 2012-08-22  Cary Coutant  <ccoutant@google.com>
3402
3403         * layout.cc (Layout::include_section): Don't assert on GROUP
3404         sections with --emit-relocs.
3405
3406 2012-08-21  Cary Coutant  <ccoutant@google.com>
3407
3408         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3409         if --export-dynamic-symbol names an undef symbol.
3410
3411 2012-08-18  Alan Modra  <amodra@gmail.com>
3412
3413         * powerpc.cc: Formatting and white space.
3414         (Powerpc_relobj): Rename got2_section_ to special_.
3415         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3416         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3417         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3418         (Target_powerpc): Add Address typedef and invalid_address.  Use
3419         throughout.
3420         (Target_powerpc::is_branch_reloc): New function.
3421         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3422         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3423         for dst_mask, value and addend.
3424         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3425         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3426         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3427         uint16_t for 24-bit offset.  Use get_output_section_offset and
3428         check return.
3429         (Target_powerpc::Scan::local): Handle more relocs.
3430         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3431         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3432         Plug in toc restoring insn after plt calls.  Translate branches
3433         to function descriptor symbols to corresponding entry point.
3434         (Target_powerpc::relocate_for_relocatable): Check return from
3435         get_output_section_offset.
3436         * symtab.h: Comment typo.
3437
3438 2012-08-14  Ian Lance Taylor  <iant@google.com>
3439
3440         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3441         unsupported_relocal_local to call unsupported_reloc_global.
3442
3443 2012-08-14  Nick Clifton  <nickc@redhat.com>
3444
3445         PR ld/14265
3446         * script-sections.cc (Sections_element::output_section_name): Add
3447         keep return parameter.
3448         (Output_section_element::match_name): Add keep return parameter.
3449         Return the value of the keep_ member.
3450         * script-sections.h (class Output_section): Update
3451         output_section_name prototype.
3452         * layout.cc (Layout::keep_input_section): New public member
3453         function.
3454         (Layout::choose_output_section): Pass keep parameter to
3455         output_section_name.
3456         * layout.h (class Layout): Add keep_input_section.
3457         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3458         sections.
3459         * testsuite/Makefile.am: Add a test.
3460         * testsuite/Makefile.in: Regenerate.
3461         * testsuite/pr14265.c: Source file for the test.
3462         * testsuite/pr14265.t: Linker script for the test.
3463         * testsuite/pr14265.sh: Shell script for the test.
3464
3465 2012-08-14  Alan Modra  <amodra@gmail.com>
3466
3467         * target.h (Target::output_section_name): New function.
3468         (Target::do_output_section_name): New function.
3469         * layout.cc (Layout::choose_output_section): Call the above.
3470         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3471
3472 2012-08-14  Alan Modra  <amodra@gmail.com>
3473
3474         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3475         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3476         for replace_constant call.
3477         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3478         (Output_data_glink::do_print_to_mapfile): New function.
3479         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3480         (Target_powerpc::Relocate::relocate): Likewise.
3481
3482 2012-08-14  Alan Modra  <amodra@gmail.com>
3483
3484         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3485         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3486         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3487         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3488         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3489         here.
3490         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3491         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3492         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3493         here.
3494         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3495         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3496
3497 2012-08-12  Alan Modra  <amodra@gmail.com>
3498
3499         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3500         (glink insn constants): Use uint32_t.
3501         (Output_data_glink::add_entry): Use insert, not [] operator.
3502
3503 2012-08-11  Alan Modra  <amodra@gmail.com>
3504
3505         * object.h (Sized_relobj_file::find_shdr): New function.
3506         (Sized_relobj_file::find_special_sections): New function.
3507         * object.cc (Sized_relobj_file::find_shdr): New function.
3508         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3509         (Sized_relobj_file::find_special_sections): New function, split out..
3510         (Sized_relobj_file::do_read_symbols): ..from here.
3511         * output.h (Output_data_got::replace_constant): New function.
3512         (Output_data_got::num_entries): New function.
3513         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3514         (Output_data_got::got_offset): Protected rather than private.
3515         (Output_data_got::replace_got_entry): New function.
3516         * output.cc (Output_data_got::replace_got_entry): New function.
3517         * powerpc.cc (class Powerpc_relobj): New.
3518         (class Powerpc_relocate_functions): Delete all psymval variants or
3519         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3520         Implement _ha functions using corresponding _hi function.
3521         (Powerpc_relobj::find_special_sections): New function.
3522         (Target_powerpc::do_make_elf_object): New function.
3523         (class Output_data_got_powerpc): New.
3524         (class Output_data_glink): New.
3525         (class Powerpc_scan_relocatable_reloc): New.
3526         Many more changes througout file.
3527
3528 2012-08-09  Nick Clifton  <nickc@redhat.com>
3529
3530         * po/vi.po: Updated Vietnamese translation.
3531
3532 2012-08-07  Ian Lance Taylor  <iant@google.com>
3533
3534         * layout.cc (Layout::add_target_dynamic_tags): If
3535         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3536         plt_rel.
3537
3538 2012-07-30  Nick Clifton  <nickc@redhat.com>
3539
3540         * po/gold.pot: Updated template.
3541         * po/es.po: Updated Spanish translation.
3542
3543 2012-07-18  Cary Coutant  <ccoutant@google.com>
3544
3545         PR gold/14344
3546         * configure.ac: Add check for -gpubnames support.
3547         * configure: Regenerate.
3548         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3549         support; force -gno-pubnames.
3550         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3551         support.
3552         (gdb_index_test_4): New test.
3553         * testsuite/Makefile.in: Regenerate.
3554         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3555         * testsuite/gdb_index_test_2.sh: Likewise.
3556         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3557         * testsuite/gdb_index_test_4.sh: New script.
3558         * testsuite/gdb_index_test_comm.sh: New script with common code;
3559         don't look for space after colon.
3560
3561 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3562
3563         * gold.cc (queue_middle_tasks): Update function order only after
3564         deferred objects due to plugins are processed.
3565
3566 2012-07-11  Ian Lance Taylor  <iant@google.com>
3567
3568         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3569         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3570         (Target_arm::scan_reloc_for_stub): Likewise.
3571         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3572         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3573         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3574         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3575         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3576
3577 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3578             Ian Lance Taylor  <iant@google.com>
3579
3580         PR gold/14309
3581         * configure.ac: Test whether std::tr1::hash<off_t> works.
3582         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3583         needed.
3584         * output.h (class Output_fill): Add virtual destructor.
3585         * configure, config.in: Rebuild.
3586
3587 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3588
3589         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3590
3591 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3592
3593         * plugin.cc (Plugin::load): Handle position independent executables.
3594
3595 2012-06-06  Cary Coutant  <ccoutant@google.com>
3596
3597         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3598         add .debug_macro.
3599         (lines_only_debug_sections): Likewise.
3600         (gdb_fast_lookup_sections): New static array.
3601         (is_gdb_debug_section): Rename formal parameter.
3602         (is_lines_only_debug_section): Likewise.
3603         (is_gdb_fast_lookup_section): New function.
3604         (Layout::include_section): Check for ".zdebug_" prefix; pass
3605         section name suffix to is_gdb_debug_section, et al.; check for
3606         fast-lookup sections when building .gdb_index.
3607         * options.h (--strip-debug-gdb): Update GDB version number.
3608
3609 2012-06-06  Cary Coutant  <ccoutant@google.com>
3610
3611         * configure.ac: Add check for fallocate.
3612         * configure: Regenerate.
3613         * config.in: Regenerate.
3614
3615         * options.h (class General_options): Add --mmap-output-file and
3616         --posix-fallocate options.
3617         * output.cc: (posix_fallocate): Remove; replace with...
3618         (gold_fallocate): New function.
3619         (Output_file::map_no_anonymous): Call gold_fallocate.
3620         (Output_file::map): Check --mmap-output-file option.
3621
3622 2012-06-05  Jing Yu  <jingyu@google.com>
3623
3624         * gold.h (textdomain): Add do {} to empty while(0).
3625         (bindtextdomain): Likewise.
3626
3627 2012-06-04  Cary Coutant  <ccoutant@google.com>
3628
3629         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3630         has_dynsym_index.
3631
3632 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3633
3634         * symtab.cc (Symbol_table::define_special_symbol):
3635         Initialize *poldsym to prevent uninitialized variable errors.
3636
3637 2012-05-23  Cary Coutant  <ccoutant@google.com>
3638
3639         * layout.cc (Layout::section_name_mapping): Add rules to handle
3640         exact match on .data.rel.ro.local or .data.rel.ro.
3641         (Layout::output_section_name): Check for exact matches.
3642
3643 2012-05-23  Cary Coutant  <ccoutant@google.com>
3644
3645         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3646         more carefully.
3647
3648 2012-05-22  Cary Coutant  <ccoutant@google.com>
3649
3650         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3651         object before exporting symbol.
3652
3653 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3654
3655         * testsuite/tls_test.cc: Include "config.h" first.
3656         * testsuite/tls_test_c.c: Likewise.
3657
3658 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3659             Nick Clifton  <nickc@redhat.com>
3660
3661         PR 14072
3662         * configure.in: Add check that sysdep.h has been included before
3663         any system header files.
3664         * configure: Regenerate.
3665         * config.in: Regenerate.
3666
3667 2012-05-14  Cary Coutant  <ccoutant@google.com>
3668
3669         * layout.cc (Layout::make_output_section): Mark .tdata section
3670         as RELRO.
3671         * testsuite/relro_test.cc: Add a TLS variable.
3672
3673 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3674
3675         PR gold/14091
3676         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3677         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3678         R_X86_64_64.
3679
3680 2012-05-08  Cary Coutant  <ccoutant@google.com>
3681
3682         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3683         (lines_only_debug_sections): Likewise.
3684
3685 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3686
3687         * nacl.cc: New file.
3688         * nacl.h: New file.
3689         * Makefile.am (CCFILES, HFILES): Add them.
3690         * Makefile.in: Regenerate.
3691         * i386.cc (Output_data_plt_i386_nacl): New class.
3692         (Output_data_plt_i386_nacl_exec): New class.
3693         (Output_data_plt_i386_nacl_dyn): New class.
3694         (Target_i386_nacl): New class.
3695         (Target_selector_i386_nacl): New class.
3696         (target_selector_i386): Use it instead of Target_selector_i386.
3697         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3698         (Target_x86_64_nacl): New class.
3699         (Target_selector_x86_64_nacl): New class.
3700         (target_selector_x86_64, target_selector_x32): Use it instead of
3701         Target_selector_x86_64.
3702         * arm.cc (Output_data_plt_arm_nacl): New class.
3703         (Target_arm_nacl): New class.
3704         (Target_selector_arm_nacl): New class.
3705         (target_selector_arm, target_selector_armbe): Use it instead of
3706         Target_selector_arm.
3707
3708         * target-select.cc (select_target): Take new Input_file* and off_t
3709         arguments, pass them on to recognize method of selector.
3710         * object.cc (make_elf_sized_object): Update caller.
3711         * parameters.cc (parameters_force_valid_target): Likewise.
3712         * incremental.cc (make_sized_incremental_binary): Likewise.
3713         * target-select.h: Update decl.
3714         (Target_selector::recognize): Take new Input_file* argument,
3715         pass it on to do_recognize.
3716         (Target_selector::do_recognize): Take new Input_file* argument.
3717         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3718         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3719         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3720         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3721
3722         * target.h (Target::Target_info): New members isolate_execinstr
3723         and rosegment_gap.
3724         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3725         * arm.cc (Target_arm::arm_info): Update initializer.
3726         * i386.cc (Target_i386::i386_info): Likewise.
3727         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3728         * sparc.cc (Target_sparc::sparc_info): Likewise.
3729         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3730         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3731         * layout.cc (Layout::attach_allocated_section_to_segment):
3732         Take new const Target* argument.  If target->isolate_execinstr(), act
3733         like --rosegment.
3734         (Layout::find_first_load_seg): Take new const Target* argument;
3735         if target->isolate_execinstr(), reject PF_X segments.
3736         (Layout::relaxation_loop_body): Update caller.
3737         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3738         reset file offset to zero when we hit LOAD_SEG, and then do a second
3739         loop over the segments before LOAD_SEG to reassign offsets after
3740         addresses have been determined.  Handle target->rosegment_gap().
3741         (Layout::attach_section_to_segment): Take new const Target* argument;
3742         pass it to attach_allocated_section_to_segment.
3743         (Layout::make_output_section): Update caller.
3744         (Layout::attach_sections_to_segments): Take new const Target* argument;
3745         pass it to attach_section_to_segment.
3746         * gold.cc (queue_middle_tasks): Update caller.
3747         * layout.h (Layout): Update method decls with new arguments.
3748
3749         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3750         Target_info pointer to use.
3751         (Target_arm::do_make_data_plt): New virtual method.
3752         (Target_arm::make_data_plt): New method that calls it.
3753         (Target_arm::make_plt_entry): Use it.
3754         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3755         for the section alignment.
3756         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3757         method.
3758         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3759         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3760         method.
3761         (Output_data_plt_arm::get_plt_entry_size): Call it.
3762         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3763         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3764         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3765         method.
3766         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3767         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3768         method instead of sizeof(plt_entry).
3769         (Output_data_plt_arm::add_entry): Likewise.
3770         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3771         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3772         than static method.
3773         (Target_arm::plt_entry_size): Likewise.
3774         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3775         Move to ...
3776         (Output_data_plt_arm_standard): ... here, new class.
3777         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3778         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3779         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3780
3781         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3782         Take additional argument for the PLT entry size.
3783         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3784         Use get_plt_entry_size method rather than plt_entry_size variable.
3785         (Output_data_plt_x86_64::reserve_slot): Likewise.
3786         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3787         (Output_data_plt_x86_64::add_entry): Likewise.
3788         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3789         (Output_data_plt_x86_64::address_for_global): Likewise.
3790         (Output_data_plt_x86_64::address_for_local): Likewise.
3791         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3792         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3793         Make method non-static.
3794         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3795         method.
3796         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3797         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3798         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3799         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3800         virtual method.
3801         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3802         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3803         virtual method.
3804         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3805         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3806         virtual method.
3807         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3808         (Output_data_plt_x86_64::plt_entry_size)
3809         (Output_data_plt_x86_64::first_plt_entry)
3810         (Output_data_plt_x86_64::plt_entry)
3811         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3812         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3813         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3814         (Output_data_plt_x86_64_standard): ... here, new class.
3815         (Target_x86_64::Target_x86_64): Take optional argument for the
3816         Target_info pointer to use.
3817         (Target_x86_64::do_make_data_plt): New virtual method.
3818         (Target_x86_64::make_data_plt): New method to call it.
3819         (Target_x86_64::init_got_plt_for_update): Use that.
3820         Call this->plt_->add_eh_frame method here.
3821         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3822         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3823         rather than static method.
3824         (Target_x86_64::plt_entry_size): Likewise.
3825         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3826         rather than plt_entry_size variable.  Move guts of PLT filling to...
3827         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3828         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3829         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3830
3831         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3832         additional argument for the section alignment.
3833         Don't do add_eh_frame_for_plt here.
3834         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3835         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3836         variable.
3837         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3838         method.
3839         (Output_data_plt_i386::get_plt_entry_size): Call it.
3840         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3841         (Output_data_plt_i386::add_eh_frame): New method to call it.
3842         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3843         method.
3844         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3845         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3846         method.
3847         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3848         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3849         method instead of plt_entry_size.
3850         (Output_data_plt_i386::plt_entry_size)
3851         (Output_data_plt_i386::plt_eh_frame_fde_size)
3852         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3853         (Output_data_plt_i386_standard): ... here, new class.
3854         (Output_data_plt_i386_exec): New class.
3855         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3856         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3857         (Output_data_plt_i386::exec_plt_entry): Move to ...
3858         (Output_data_plt_i386_exec::plt_entry): ... here.
3859         (Output_data_plt_i386_dyn): New class.
3860         (Output_data_plt_i386::first_plt_entry): Move to ...
3861         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3862         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3863         (Output_data_plt_i386_dyn::plt_entry): ... here.
3864         (Target_i386::Target_i386): Take optional argument for the Target_info
3865         pointer to use.
3866         (Target_i386::do_make_data_plt): New virtual method.
3867         (Target_i386::make_data_plt): New method to call it.
3868         (Target_i386::make_plt_section): Use that.
3869         Call this->plt_->add_eh_frame method here.
3870         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3871         rather than plt_entry_size variable.
3872         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3873         (Output_data_plt_i386::address_for_local): Likewise.
3874         (Output_data_plt_i386::do_write): Likewise.
3875         Move guts of PLT filling to...
3876         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3877         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3878         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3879         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3880
3881 2012-05-01  Cary Coutant  <ccoutant@google.com>
3882
3883         * dwarf_reader.cc (Dwarf_die::read_attributes)
3884         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3885         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3886         * reduced_debug_output.cc
3887         (Output_reduced_debug_info_section::get_die_end): Remove
3888         DW_FORM_GNU_ref_index.  Add default case.
3889
3890 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3891
3892         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3893         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3894         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3895         DW_AT_high_pc as offset from DW_AT_low_pc.
3896
3897         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3898         * testsuite/Makefile.in: Regenerate.
3899         * testsuite/gdb_index_test_3.c: New test source file.
3900         * testsuite/gdb_index_test_3.sh: New test source file.
3901
3902 2012-04-25  Ian Lance Taylor  <iant@google.com>
3903
3904         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3905         pointer.
3906         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3907         as a class, not a struct.
3908         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3909         (Target_arm::apply_cortex_a8_workaround): Likewise.
3910         * gc.h: Declare Reloc_types as a struct, not a class.
3911         * object.h: Declare Symbols_data as a struct.
3912         * reloc.h: Declare Read_relocs_data as a struct.
3913         * target.h: Declare Relocate_info as a struct.
3914
3915 2012-04-24  David S. Miller  <davem@davemloft.net>
3916
3917         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3918         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3919         and R_SPARC_WPLT30.
3920
3921 2012-04-24  Cary Coutant  <ccoutant@google.com>
3922
3923         * incremental-dump.cc (find_input_containing_global): Replace
3924         magic number with symbolic constant.
3925         (dump_incremental_inputs): Update version number.
3926         * incremental.cc (Output_section_incremental_inputs): Update version
3927         number; import symbolic constants from Incremental_inputs_reader.
3928         (Incremental_inputs::create_data_sections): Align relocations
3929         section correctly for 64-bit targets.
3930         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3931         constants; add padding.
3932         (Output_section_incremental_inputs::write_header): Add assert for
3933         header_size.
3934         (Output_section_incremental_inputs::write_input_files): Add assert
3935         for input_entry_size.
3936         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3937         add assert for object_info_size, input_section_entry_size,
3938         global_sym_entry_size.
3939         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3940         for data structure sizes; use them.
3941         (Incremental_input_entry_reader): Import symbolic constants from
3942         Incremental_inputs_reader; use them.
3943
3944 2012-04-23  David S. Miller  <davem@davemloft.net>
3945
3946         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3947         and elf_flags_set_.
3948         (Target_sparc::Target_sparc): Initialize new fields.
3949         (Target_sparc::do_make_elf_object): New function.
3950         (Target_sparc::do_adjust_elf_header): New function.
3951
3952 2012-04-23  Cary Coutant  <ccoutant@google.com>
3953
3954         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3955         CU range table of gdb index.
3956
3957 2012-04-20  David S. Miller  <davem@davemloft.net>
3958
3959         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3960         instead of false.
3961
3962 2012-04-16  David S. Miller  <davem@davemloft.net>
3963
3964         * sparc.cc (Target_sparc::got_address): New function.
3965         (Sparc_relocate_functions::gdop_hix22): New function.
3966         (Sparc_relocate_functions::gdop_lox10): New function.
3967         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3968         relocs.
3969         (Target_sparc::Scan::local): Likewise if the global symbol is not
3970         preemptible and is not IFUNC.
3971         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3972         transformations for local and non-preemptible non-IFUNC global
3973         symbols.
3974
3975         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3976         writing out 64-bit part of ranges.
3977
3978         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3979         -fpic and -fpie respectively.
3980         * Makefile.in: Regenerate.
3981
3982         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3983         (Target_sparc::Target_sparc): Initialize new field.
3984         (Target_sparc::do_plt_section_for_global): New function.
3985         (Target_sparc::do_plt_section_for_local): New function.
3986         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3987         (Target_sparc::make_plt_section): New function, broken out of
3988         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3989         (Target_sparc::make_plt_entry): Call make_plt_section.
3990         (Target_sparc::make_local_ifunc_plt_entry): New function.
3991         (Target_sparc::rela_ifunc_section): New function.
3992         (Target_sparc::plt_section): Remove const.
3993         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3994         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3995         and ifunc_count_ fields.
3996         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3997         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3998         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3999         (Output_data_plt_sparc::rela_ifunc): New function.
4000         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4001         (Output_data_plt_sparc::has_ifunc_section): New function.
4002         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4003         (Output_data_plt_sparc::address_for_global): New function.
4004         (Output_data_plt_sparc::address_for_local): New function.
4005         (Output_data_plt_sparc::plt_index_to_offset): New function.
4006         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4007         and entry_count.
4008         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4009         entry_count.
4010         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4011         R_SPARC_JMP_IREL to switch.
4012         (Target_sparc::Scan::check_non_pic): Likewise.
4013         (Target_sparc::Scan::local): Handle IFUNC symbols.
4014         (Target_sparc::Scan::local): Likewise.
4015         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4016         and plt_address_for_local.
4017         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4018         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4019
4020         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4021         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4022         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4023         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4024         global relocs too.
4025         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4026         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4027         calls.
4028         * sparc.cc (Target_sparc::Scan::global): Likewise.
4029         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4030
4031 2012-04-16  Cary Coutant  <ccoutant@google.com>
4032
4033         * archive.cc (Library_base::should_include_member): Check for
4034         --export-dynamic-symbol.
4035         * options.h (class General_options): Add --export-dynamic-symbol.
4036         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4037         --export-dynamic-symbol.
4038         (Symbol_table::gc_mark_undef_symbols): Likewise.
4039         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4040
4041 2012-04-12  David S. Miller  <davem@davemloft.net>
4042
4043         * sparc.cc (Reloc::wdisp10): New relocation method.
4044         (Reloc::h34): Likewise.
4045         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4046         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4047         R_SPARC_WDISP10.
4048         (Target_sparc::Scan::local): Likewise.
4049         (Target_sparc::Scan::global): Likewise.
4050         (Target_sparc::Relocate::relocate): Likewise.
4051
4052 2012-04-09  Cary Coutant  <ccoutant@google.com>
4053
4054         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4055         low_pc == 0.
4056
4057 2012-04-06  Ian Lance Taylor  <iant@google.com>
4058
4059         * timer.cc: #include <unistd.h>.
4060
4061 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4062
4063         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4064         * config.in: Regenerate.
4065         * configure: Regenerate.
4066
4067 2012-04-05  Nick Clifton  <nickc@redhat.com>
4068
4069         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4070         (AM_LC_MESSAGES): Add.
4071         * aclocal.m4: Regenerate.
4072         * config.in: Regenerate.
4073         * configure: Regenerate.
4074
4075 2012-03-21  Cary Coutant  <ccoutant@google.com>
4076
4077         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4078         * Makefile.in: Regenerate.
4079         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4080         (Sized_elf_reloc_mapper::symbol_section): New function.
4081         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4082         (make_elf_reloc_mapper): New function.
4083         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4084         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4085         (Dwarf_abbrev_table::do_get_abbrev): New function.
4086         (Dwarf_ranges_table::read_ranges_table): New function.
4087         (Dwarf_ranges_table::read_range_list): New function.
4088         (Dwarf_pubnames_table::read_section): New function.
4089         (Dwarf_pubnames_table::read_header): New function.
4090         (Dwarf_pubnames_table::next_name): New function.
4091         (Dwarf_die::Dwarf_die): New function.
4092         (Dwarf_die::read_attributes): New function.
4093         (Dwarf_die::skip_attributes): New function.
4094         (Dwarf_die::set_name): New function.
4095         (Dwarf_die::set_linkage_name): New function.
4096         (Dwarf_die::attribute): New function.
4097         (Dwarf_die::string_attribute): New function.
4098         (Dwarf_die::int_attribute): New function.
4099         (Dwarf_die::uint_attribute): New function.
4100         (Dwarf_die::ref_attribute): New function.
4101         (Dwarf_die::child_offset): New function.
4102         (Dwarf_die::sibling_offset): New function.
4103         (Dwarf_info_reader::check_buffer): New function.
4104         (Dwarf_info_reader::parse): New function.
4105         (Dwarf_info_reader::do_parse): New function.
4106         (Dwarf_info_reader::do_read_string_table): New function.
4107         (Dwarf_info_reader::lookup_reloc): New function.
4108         (Dwarf_info_reader::get_string): New function.
4109         (Dwarf_info_reader::visit_compilation_unit): New function.
4110         (Dwarf_info_reader::visit_type_unit): New function.
4111         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4112         Sized_elf_reloc_mapper.
4113         (Sized_dwarf_line_info::symbol_section): Remove function.
4114         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4115         (Sized_dwarf_line_info::read_line_mappings): Remove object
4116         parameter, adjust callers.
4117         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4118         * dwarf_reader.h: Include <sys/types.h>.
4119         (class Track_relocs): Remove forward declaration.
4120         (class Elf_reloc_mapper): New class.
4121         (class Sized_elf_reloc_mapper): New class.
4122         (class Dwarf_abbrev_table): New class.
4123         (class Dwarf_range_list): New class.
4124         (class Dwarf_ranges_table): New class.
4125         (class Dwarf_pubnames_table): New class.
4126         (class Dwarf_die): New class.
4127         (class Dwarf_info_reader): New class.
4128         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4129         (Sized_dwarf_line_info::symbol_section): Remove member function.
4130         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4131         base class.
4132         * gdb-index.cc: New source file.
4133         * gdb-index.h: New source file.
4134         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4135         and .debug_types sections, call Layout::add_to_gdb_index.
4136         (Sized_relobj_incr::do_section_name): Implement.
4137         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4138         return type; Implement.
4139         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4140         return type.
4141         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4142         parameter list and return type.
4143         (Sized_incr_dynobj::do_section_contents): Likewise.
4144         * layout.cc: Include gdb-index.h.
4145         (Layout::Layout): Initialize gdb_index_data_.
4146         (Layout::init_fixed_output_section): Check for .gdb_index section.
4147         (Layout::add_to_gdb_index): New function. Instantiate.
4148         * layout.h: Add forward declaration for class Gdb_index.
4149         (Layout::add_to_gdb_index): New member function.
4150         (Layout::gdb_index_data_): New data member.
4151         * main.cc: Include gdb-index.h.
4152         (main): Print statistics for gdb index.
4153         * object.cc (Object::section_contents): Move code into
4154         do_section_contents.
4155         (need_decompressed_section): Check for sections needed when building
4156         gdb index.
4157         (build_compressed_section_map): Likewise.
4158         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4159         gdb index.
4160         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4161         sections; call Layout::add_to_gdb_index.
4162         (Sized_relobj_file::do_decompressed_section_contents): Call
4163         do_section_contents directly.
4164         * object.h (Object::do_section_contents): Adjust parameter list and
4165         return type.
4166         (Object::do_decompressed_section_contents): Call do_section_contents
4167         directly.
4168         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4169         return type.
4170         * options.h (class General_options): Add --gdb-index option.
4171         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4172         list and return type.
4173         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4174         * reloc.h (Track_relocs::checkpoint): New function.
4175         (Track_relocs::reset): New function.
4176
4177         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4178         New test cases.
4179         * testsuite/Makefile.in: Regenerate.
4180         * testsuite/gdb_index_test.cc: New test source file.
4181         * testsuite/gdb_index_test_1.sh: New test source file.
4182         * testsuite/gdb_index_test_2.sh: New test source file.
4183
4184 2012-03-19  Doug Kwan  <dougkwan@google.com>
4185
4186         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4187         (Target_arm::do_finalize_sections): Remove code which defines
4188         __exidx_start and __exidx_end.  Make symbol table parameter
4189         anonymous as it is not used.
4190         * gold.cc (queue_middle_tasks): Call target hook to define any
4191         target-specific symbols.
4192         * target.h (Target::define_standard_symbols): New method.
4193         (Target::do_define_standard_symbols): Same.
4194         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4195         * testsuite/Makefile.in: Regenerate.
4196         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4197         and __exidx_end.
4198         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4199         relocations are generated for __exidx_start and __exidx_end.
4200
4201 2012-03-16  Doug Kwan  <dougkwan@google.com>
4202
4203         * testsuite/Makefile.am: Disable test initpri3b.
4204         * testsuite/Makefile.in: Regenerate.
4205
4206 2012-03-15  Doug Kwan  <dougkwan@google.com>
4207
4208         * arm.cc (Target_arm::got_section): Make .got section read-only
4209         if -z now is given.
4210
4211 2012-03-15  Ian Lance Taylor  <iant@google.com>
4212
4213         PR gold/13850
4214         * layout.cc (Layout::make_output_section): Correctly mark
4215         SHT_INIT_ARRAY, et. al., as relro.
4216
4217 2012-03-14  Doug Kwan  <dougkwan@google.com>
4218
4219         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4220         dynamic relocations for protected symbols in shared objects.
4221
4222 2012-03-13  Ian Lance Taylor  <iant@google.com>
4223
4224         * resolve.cc (Symbol_table::resolve): When merging common symbols,
4225         keep the larger alignment.
4226
4227 2012-03-12  Cary Coutant  <ccoutant@google.com>
4228
4229         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4230         handling of DW_LNE_define_file.
4231
4232 2012-03-12  Cary Coutant  <ccoutant@google.com>
4233
4234         * reduced_debug_output.cc
4235         (Output_reduced_debug_info_section::get_die_end): Add new FORM
4236         codes to switch.
4237
4238 2012-02-29  Cary Coutant  <ccoutant@google.com>
4239
4240         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4241
4242 2012-02-29  Cary Coutant  <ccoutant@google.com>
4243
4244         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4245         Call Object::decompressed_section_contents.
4246         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4247         New dtor.
4248         (Sized_dwarf_line_info::buffer_start_): New data member.
4249         * merge.cc (Output_merge_data::do_add_input_section): Call
4250         Object::decompressed_section_contents.
4251         (Output_merge_string::do_add_input_section): Likewise.
4252         * object.cc (need_decompressed_section): New function.
4253         (build_compressed_section_map): Decompress sections needed later.
4254         (Sized_relobj_file::do_decompressed_section_contents): New function.
4255         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4256         * object.h (Object::decompressed_section_contents): New function.
4257         (Object::discard_decompressed_sections): New function.
4258         (Object::do_decompressed_section_contents): New function.
4259         (Object::do_discard_decompressed_sections): New function.
4260         (Compressed_section_info): New type.
4261         (Compressed_section_map): Include decompressed section contents.
4262         (Sized_relobj_file::do_decompressed_section_contents): New function.
4263         (Sized_relobj_file::do_discard_decompressed_sections): New function.
4264
4265 2012-02-16  Cary Coutant  <ccoutant@google.com>
4266
4267         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4268         * testsuite/Makefile.in: Regenerate.
4269
4270 2012-02-14  Cary Coutant  <ccoutant@google.com>
4271
4272         * options.cc (General_options::finalize): Disallow -pie and -static.
4273
4274 2012-02-03  Doug Kwan  <dougkwan@google.com>
4275
4276         * arm.cc (Arm_relocate_functions::abs8,
4277         Arm_relocate_functions::abs16): Use
4278         Bits::has_signed_unsigned_overflow32.
4279         (Arm_relocate_functions::thm_abs8): Correct range of
4280         overflow check.
4281         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4282         in assertions.
4283
4284 2012-02-02  Doug Kwan  <dougkwan@google.com>
4285
4286         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4287         position independent outputs, not just shared objects.
4288
4289 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
4290
4291         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4292         * configure: Regenerated.
4293
4294 2012-01-27  Ian Lance Taylor  <iant@google.com>
4295
4296         * reloc.h (Bits): New class with static functions, copied from
4297         namespace utils in arm.cc.
4298         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
4299         instead.
4300
4301 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4302
4303         * incremental.cc (write_info_blocks): Correct relocation offset.
4304
4305 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4306
4307         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4308         (Relocate::tls_gd_to_le): Likewise.
4309
4310 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4311
4312         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4313
4314 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
4315
4316         * configure.ac: Check if -mcmodel=medium works.
4317         * configure: Regenerated.
4318
4319 2012-01-24  Cary Coutant  <ccoutant@google.com>
4320
4321         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4322         definition and ...
4323         (read_unsigned_LEB_128_x): ... this new function.
4324         (read_signed_LEB_128): Replaced with inline definition and ...
4325         (read_signed_LEB_128_x): ... this new function.
4326         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
4327         (read_unsigned_LEB_128): Add inline definition.
4328         (read_signed_LEB_128_x): New function.
4329         (read_signed_LEB_128): Add inline definition.
4330         * testsuite/Makefile.am (leb128_unittest): New unit test.
4331         * testsuite/Makefile.in: Regenerate.
4332         * testsuite/leb128_unittest.cc: New unit test.
4333
4334 2012-01-23  Ian Lance Taylor  <iant@google.com>
4335
4336         PR gold/13617
4337         * i386.cc (Target_i386::do_code_fill): When using a jmp
4338         instruction, pad with nop instructions.
4339         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4340
4341 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
4342
4343         * x86_64.cc (gc_process_relocs): Add typename on types used in
4344         template.
4345         (scan_relocs): Likewise.
4346         (relocate_section): Likewise.
4347         (apply_relocation): Likewise.
4348
4349 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4350
4351         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4352         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4353         under x32.
4354
4355 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
4356
4357         * x86_64.cc: Initial support for x32.
4358
4359 2012-01-03  Cary Coutant  <ccoutant@google.com>
4360
4361         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4362         Use abstract base class for GOT.
4363         * gold/output.h (class Output_data_got_base): New abstract base class.
4364         (class Output_data_got): Derive from new base class, adjust ctors.
4365         (Output_data_got::reserve_slot): Make virtual; rename to
4366         do_reserve_slot; Adjust callers.
4367         * gold/target.h (Sized_target::init_got_plt_for_update): Return
4368         pointer to abstract base class.
4369         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4370
4371 2011-12-18  Ian Lance Taylor  <iant@google.com>
4372
4373         * object.h (Relobj::local_symbol_value): New function.
4374         (Relobj::local_plt_offset): New function.
4375         (Relobj::local_has_got_offset): New function.
4376         (Relobj::local_got_offset): New function.
4377         (Relobj::set_local_got_offset): New function.
4378         (Relobj::do_local_symbol_value): New pure virtual function.
4379         (Relobj::do_local_plt_offset): Likewise.
4380         (Relobj::do_local_has_got_offset): Likewise.
4381         (Relobj::do_local_got_offset): Likewise.
4382         (Relobj::do_set_local_got_offset): Likewise.
4383         (Sized_relobj::do_local_has_got_offset): Rename from
4384         local_has_got_offset.
4385         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4386         (Sized_relobj::do_set_local_got_offset): Rename from
4387         set_local_got_offset.
4388         (Sized_relobj_file::do_local_plt_offset): Rename from
4389         local_plt_offset.
4390         (Sized_relobj_file::do_local_symbol_value): New function.
4391         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4392         local_plt_offset.
4393         * output.cc (Output_data_got::Got_entry::write): Change object to
4394         Relobj.  Use local_symbol_value.
4395         (Output_data_got::add_global_with_rel): Change rel_dyn to
4396         Output_data_reloc_generic*.  Use add_global_generic.
4397         (Output_data_got::add_global_with_rela): Remove.  Change all
4398         callers to use add_global_with_rel.
4399         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4400         Output_data_reloc_generic*.  Use add_global_generic.
4401         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4402         callers to use add_global_pair_with_rel.
4403         (Output_data_got::add_local): Change object to Relobj*.
4404         (Output_data_got::add_local_plt): Likewise.
4405         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4406         change rel_dyn to Output_data_reloc_generic*.  Use
4407         add_local_generic.
4408         (Output_data_got::add_local_with_rela): Remove.  Change all
4409         callers to use all_local_with_rel.
4410         (Output_data_got::add_local_pair_with_rel): Change object to
4411         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4412         add_output_section_generic.
4413         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4414         callers to use add_local_pair_with_rel.
4415         (Output_data_got::reserve_local): Change object to Relobj*.
4416         * output.h: (class Output_data_reloc_generic): Add pure virtual
4417         declarations for add_global_generic, add_local_generic,
4418         add_output_section_generic.
4419         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4420         functions for Output_data_reloc_generic.  Update declarations for
4421         changes listed in output.cc.
4422         (class Output_data_got): Change template parameter to got_size.
4423         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4424         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4425         function.
4426         (Sized_relobj_incr::do_local_plt_offset): New function.
4427         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4428         add_global_generic.
4429
4430 2011-12-17  Cary Coutant  <ccoutant@google.com>
4431
4432         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4433         * resolve.cc (Symbol_table::resolve): Likewise.
4434         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4435         arrays.
4436         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4437
4438 2011-12-16  Ian Lance Taylor  <iant@google.com>
4439
4440         * output.h (Output_data_reloc_generic::add): Only call
4441         add_dynamic_reloc if this is a dynamic reloc section.
4442
4443 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4444
4445         PR gold/13505
4446         * target-reloc.h (apply_relocation): Replace <64, false> with
4447         <size, big_endian>.
4448
4449 2011-11-25  Nick Clifton  <nickc@redhat.com>
4450
4451         * po/it.po: New Italian translation.
4452
4453 2011-11-17  Sterling Augustine  <saugustine@google.com>
4454
4455         * script.cc (script_include_directive): Implement.
4456         (read_script_file): New local variables name and search_path. Update
4457         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4458         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4459         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4460
4461 2011-11-11  Sterling Augustine  <saugustine@google.com>
4462
4463         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4464         (file_or_sections_cmd): Likewise.
4465
4466 2011-11-11  Doug Kwan  <dougkwan@google.com>
4467
4468         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4469         if --just-symbols is given.
4470
4471 2011-11-10  Doug Kwan  <dougkwan@google.com>
4472
4473         PR gold/13362
4474         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4475         when processing data relocs.
4476         * reloc.h (Relocate_functions::rel_unaligned): New method.
4477         (Relocate_functions::pcrel_unaligned): Ditto.
4478         (Relocate_functions::rel32_unaligned): Ditto.
4479         (Relocate_functions::pcrel32_unaligned): Ditto.
4480
4481 2011-11-09  Doug Kwan  <dougkwan@google.com>
4482
4483         PR gold/13362
4484         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4485         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4486         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4487         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4488         (Relocate_functions::rel_unaligned): New.
4489         (Relocate_functions::rel32_unaligned): New.
4490         * target-reloc.h (relocate_for_relocatable): Add code to handle
4491         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4492         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4493         arm_unaligned_reloc_r): New targets.
4494         * testsuite/Makefile.in: Regenerate.
4495         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4496         linking.
4497
4498 2011-11-02  Ian Lance Taylor  <iant@google.com>
4499
4500         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4501         NATIVE_LINKER.
4502         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4503         * options.cc (General_options::finalize): Use library search path
4504         from configure script if specified.  If not native and no sysroot,
4505         only search TOOLLIBDIR.
4506         * options.h (Search_directory::Search_directory): Change name to
4507         const std::string&.
4508         (General_options::add_to_library_path_with_sysroot): Change arg to
4509         const std::string&.
4510         * configure, Makefile.in, config.in: Rebuild.
4511
4512 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4513
4514         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4515         we are working around the ARM1176 Erratum.
4516         * options.h (General_options::fix_arm1176): Add option.
4517         * testsuite/Makefile.am: Add testcases, and keep current ones
4518         working.
4519         * testsuite/Makefile.in: Regenerate.
4520         * testsuite/arm_fix_1176.s: New file.
4521         * testsuite/arm_fix_1176.sh: Likewise.
4522
4523 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4524
4525         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4526         may_use_blx_.
4527         (Target_arm::may_use_blx): Remove method.
4528         (Target_arm::set_may_use_blx): Likewise.
4529         (Target_arm::may_use_v4t_interworking): New method.
4530         (Target_arm::may_use_v5t_interworking): Likewise.
4531         (Target_arm::may_use_blx_): Remove member variable.
4532         (Arm_relocate_functions::arm_branch_common): Check for v5T
4533         interworking.
4534         (Arm_relocate_functions::thumb_branch_common): Likewise.
4535         (Reloc_stub::stub_type_for_reloc): Likewise.
4536         (Target_arm::do_finalize_sections): Correct interworking checks.
4537         * testsuite/Makefile.am: Add new tests.
4538         * testsuite/Makefile.in: Regenerate.
4539         * testsuite/arm_farcall_arm_arm.s: New test.
4540         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4541         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4542         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4543         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4544         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4545         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4546         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4547
4548 2011-10-31  Cary Coutant  <ccoutant@google.com>
4549
4550         PR gold/13023
4551         * expression.cc (Expression::eval_with_dot): Add
4552         is_section_dot_assignment parameter.
4553         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4554         absolute and assigning to dot within a section.
4555         * script-sections.cc
4556         (Output_section_element_assignment::set_section_addresses): Pass
4557         dot_section to set_if_absolute.
4558         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4559         as is_section_dot_assignment flag to eval_with_dot.
4560         (Output_section_element_dot_assignment::set_section_addresses):
4561         Likewise.
4562         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4563         parameter.  Also set value if relative to dot_section; set the
4564         symbol's output_section.
4565         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4566         parameter.  Adjust all callers.
4567         (Expression::eval_maybe_dot): Likewise.
4568         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4569         Adjust all callers.
4570         * testsuite/script_test_2.t: Test assignment of an absolute value
4571         to dot within an output section element.
4572
4573 2011-10-31  Cary Coutant  <ccoutant@google.com>
4574
4575         * options.h (class General_options): Add --[no-]gnu-unique options.
4576         * symtab.cc (Symbol_table::sized_write_globals): Convert
4577         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4578
4579 2011-10-31  Cary Coutant  <ccoutant@google.com>
4580
4581         PR gold/13359
4582         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4583         unnecessary assertion.
4584         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4585
4586 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4587
4588         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4589         gc_mark_symbol.
4590         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4591         gc_mark_symbol.
4592         Change to just keep the section associated with symbol.
4593         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4594         they are externally visible and --export-dynamic is turned on.
4595         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4596
4597 2011-10-19  Ian Lance Taylor  <iant@google.com>
4598
4599         PR gold/13163
4600         * script-sections.cc
4601         (Output_section_element_dot_assignment::needs_output_section): New
4602         function.
4603
4604 2011-10-19  Ian Lance Taylor  <iant@google.com>
4605
4606         PR gold/13204
4607         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4608         --section-start option was seen.
4609         * options.h (General_options::any_section_start): New function.
4610
4611 2011-10-18  David S. Miller  <davem@davemloft.net>
4612
4613         PR binutils/13301
4614         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4615         member to track relocation locations that have moved during TLS
4616         reloc optimizations.
4617         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4618         (Target_sparc::Relocate::relocate): Adjust view down by 4
4619         bytes if it matches reloc_adjust_addr_.
4620         (Target_sparc::Relocate::relocate_tls): Always move the
4621         __tls_get_addr call delay slot instruction forward 4 bytes when
4622         performing relaxation.
4623
4624 2011-10-18  Cary Coutant  <ccoutant@google.com>
4625
4626         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4627         (Output_file::map_no_anonymous): Check for non-zero
4628         return code from posix_fallocate.
4629
4630 2011-10-17  Cary Coutant  <ccoutant@google.com>
4631
4632         PR gold/13245
4633         * plugin.cc (is_visible_from_outside): Check for symbols
4634         referenced from dynamic objects.
4635         * resolve.cc (Symbol_table::resolve): Don't count references
4636         from dynamic objects as references from real ELF files.
4637         * testsuite/plugin_test_2.sh: Adjust expected result.
4638
4639 2011-10-17  Cary Coutant  <ccoutant@google.com>
4640
4641         * gold.cc: Include timer.h.
4642         (queue_middle_tasks): Stamp time.
4643         (queue_final_tasks): Likewise.
4644         * main.cc (main): Store timer in parameters.  Print timers
4645         for each pass.
4646         * parameters.cc (Parameters::Parameters): Initialize timer_.
4647         (Parameters::set_timer): New function.
4648         (set_parameters_timer): New function.
4649         * parameters.h (Parameters::set_timer): New function.
4650         (Parameters::timer): New function.
4651         (Parameters::timer_): New data member.
4652         (set_parameters_timer): New function.
4653         * timer.cc (Timer::stamp): New function.
4654         (Timer::get_pass_time): New function.
4655         * timer.h (Timer::stamp): New function.
4656         (Timer::get_pass_time): New function.
4657         (Timer::pass_times_): New data member.
4658
4659 2011-10-17  Cary Coutant  <ccoutant@google.com>
4660
4661         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4662         task for members of lib groups.
4663
4664 2011-10-17  Cary Coutant  <ccoutant@google.com>
4665
4666         PR gold/13288
4667         * fileread.cc (File_read::find_view): Add assert.
4668         (File_read::make_view): Move bounds check (replace with assert)...
4669         (File_read::find_or_make_view): ... to here.
4670
4671 2011-10-12  Cary Coutant  <ccoutant@google.com>
4672
4673         * output.cc (Output_file::open_base_file): Handle case where
4674         ::read returns less than requested size.
4675
4676 2011-10-10  Cary Coutant  <ccoutant@google.com>
4677
4678         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4679         Initialize defined_count_.
4680         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4681         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4682         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4683         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4684         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4685         * incremental.h (Sized_relobj_incr::defined_count_): New data
4686         member.
4687         (Sized_incr_dynobj::defined_count_): New data member.
4688         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4689         Return zeroes instead of internal error.
4690
4691 2011-10-10  Cary Coutant  <ccoutant@google.com>
4692
4693         PR gold/13249
4694         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4695         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4696         * output.h (class Output_reloc): Add use_plt_offset flag.
4697         (Output_reloc::type_): Adjust size of bit field.
4698         (Output_reloc::use_plt_offset_): New bit field.
4699         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4700         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4701         flag.  Adjust all callers.
4702         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4703         creating RELATIVE relocations.
4704
4705 2011-10-10  Nick Clifton  <nickc@redhat.com>
4706
4707         * po/es.po: Updated Spanish translation.
4708         * po/fi.po: Updated Finnish translation.
4709
4710 2011-10-03   Diego Novillo  <dnovillo@google.com>
4711
4712         * options.cc (parse_uint): Fix dereference of RETVAL.
4713
4714 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4715
4716         * layout.h (section_order_map_): New member.
4717         (get_section_order_map): New member function.
4718         * output.cc (Output_section::add_input_section): Check for patterns
4719         only when --section-ordering-file is specified.
4720         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4721         output_sections have been formed.
4722         * layout.cc (Layout_Layout): Initialize section_order_map_.
4723         * plugin.cc (update_section_order): Store order in order_map. Do not
4724         update the order.
4725         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4726         * testsuite/Makefile.in: Regenerate.
4727         * testsuite/plugin_section_order.c: New file.
4728         * testsuite/plugin_final_layout.cc: New file.
4729         * testsuite/plugin_final_layout.sh: New file.
4730
4731 2011-09-29  Cary Coutant  <ccoutant@google.com>
4732
4733         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4734         Check for NULL.
4735         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4736         symbols during incremental update.
4737         (Symbol_table::add_from_dynobj): Likewise.
4738
4739 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4740             Ian Lance Taylor  <iant@google.com>
4741
4742         * symtab.cc (Symbol_table::define_special_symbol): Always
4743         canonicalize version string.
4744
4745 2011-09-26  Cary Coutant  <ccoutant@google.com>
4746
4747         * gold.cc (queue_initial_tasks): Move option checks ...
4748         * options.cc (General_options::finalize): ... to here. Disable
4749         some options; make others fatal.
4750
4751 2011-09-26  Cary Coutant  <ccoutant@google.com>
4752
4753         gcc PR lto/47247
4754         * plugin.cc (get_symbols_v2): New function.
4755         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4756         (is_referenced_from_outside): New function.
4757         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4758         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4759         (get_symbols): Pass version parameter.
4760         (get_symbols_v2): New function.
4761         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4762         parameter.
4763         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4764         (onload): Add LDPT_GET_SYMBOLS_V2.
4765         (all_symbols_read_hook): Use get_symbols_v2; check for
4766         LDPR_PREVAILING_DEF_IRONLY_EXP.
4767         * testsuite/plugin_test_3.sh: Update expected results.
4768
4769 2011-09-23  Simon Baldwin  <simonb@google.com>
4770
4771         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4772         configuration options.
4773         * configure: Regenerate.
4774         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4775         * Makefile.in: Regenerate.
4776         * testsuite/Makefile.in: Regenerate.
4777
4778 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4779
4780         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4781
4782 2011-09-19  Cary Coutant  <ccoutant@google.com>
4783
4784         * incremental.cc (can_incremental_update): Fix typo in comment.
4785         * incremental.h (can_incremental_update): Likewise.
4786
4787 2011-09-18  Cary Coutant  <ccoutant@google.com>
4788
4789         * incremental.cc (can_incremental_update): New function.
4790         * incremental.h (can_incremental_update): New function.
4791         * layout.cc (Layout::init_fixed_output_section): Call it.
4792         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4793         * object.cc (Sized_relobj_file::do_layout): Call
4794         can_incremental_update.
4795
4796 2011-09-13  Cary Coutant  <ccoutant@google.com>
4797
4798         * configure.ac: Check for glibc support for gnu_indirect_function
4799         support with static linking, setting automake conditional
4800         IFUNC_STATIC.
4801         * Makefile.in: Regenerate.
4802         * configure: Regenerate.
4803
4804         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4805         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4806         for IFUNC_STATIC.
4807         * testsuite/Makefile.in: Regenerate.
4808
4809 2011-09-13  Cary Coutant  <ccoutant@google.com>
4810
4811         * incremental.cc (Sized_relobj_incr::do_layout): Call
4812         report_comdat_group for kept comdat sections.
4813         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4814         * testsuite/Makefile.in: Regenerate.
4815         * testsuite/incr_comdat_test_1.cc: New source file.
4816         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4817         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4818         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4819
4820 2011-09-13  Ian Lance Taylor  <iant@google.com>
4821
4822         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4823         variable external_symbols_offset.
4824
4825 2011-09-12  Ian Lance Taylor  <iant@google.com>
4826
4827         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4828         triggered if object has no symbols.
4829
4830 2011-09-09  David S. Miller  <davem@davemloft.net>
4831
4832         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4833         (Output_fill_debug_line::do_write): Likewise.
4834
4835 2011-08-29  Cary Coutant  <ccoutant@google.com>
4836
4837         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4838         casts to match formatting specs.
4839         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4840
4841 2011-08-26  Cary Coutant  <ccoutant@google.com>
4842
4843         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4844         remaining hole size when allocating.
4845         (Layout::make_output_section): Set fill methods for debug sections.
4846         * layout.h (Free_list::Free_list_node): Move from private to
4847         public.
4848         (Free_list::set_min_hole_size): New function.
4849         (Free_list::begin, Free_list::end): New functions.
4850         (Free_list::min_hole_): New data member.
4851         * output.cc: Include dwarf.h.
4852         (Output_fill_debug_info::do_minimum_hole_size): New function.
4853         (Output_fill_debug_info::do_write): New function.
4854         (Output_fill_debug_line::do_minimum_hole_size): New function.
4855         (Output_fill_debug_line::do_write): New function.
4856         (Output_section::Output_section): Initialize new data member.
4857         (Output_section::set_final_data_size): Ensure patch space is larger
4858         than minimum hole size.
4859         (Output_section::do_write): Fill holes in debug sections.
4860         * output.h (Output_fill): New class.
4861         (Output_fill_debug_info): New class.
4862         (Output_fill_debug_line): New class.
4863         (Output_section::set_free_space_fill): New function.
4864         (Output_section::free_space_fill_): New data member.
4865         * testsuite/Makefile.am (incremental_test_3): Add
4866         --incremental-patch option.
4867         (incremental_test_4): Likewise.
4868         (incremental_test_5): Likewise.
4869         (incremental_test_6): Likewise.
4870         (incremental_copy_test): Likewise.
4871         (incremental_common_test_1): Likewise.
4872         * testsuite/Makefile.in: Regenerate.
4873
4874 2011-08-26  Nick Clifton  <nickc@redhat.com>
4875
4876         * po/es.po: Updated Spanish translation.
4877
4878 2011-08-01  Cary Coutant  <ccoutant@google.com>
4879
4880         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4881         * gold/testsuite/Makefile.in: Regenerate.
4882         * gold/testsuite/justsyms_exec.c: New source file.
4883         * gold/testsuite/justsyms_lib.c: New source file.
4884
4885 2011-08-01  Cary Coutant  <ccoutant@google.com>
4886
4887         * layout.cc (Layout::set_segment_offsets): Don't realign text
4888         segment if -Ttext was specified.
4889         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4890         file type.
4891         * object.h (Sized_relobj_file::e_type): New function.
4892         (Sized_relobj_file::e_type_): New data member.
4893         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4894         base address for ET_EXEC files.
4895         * target.cc (Target::do_make_elf_object_implementation): Allow
4896         ET_EXEC files with --just-symbols option.
4897
4898 2011-07-28  Cary Coutant  <ccoutant@google.com>
4899
4900         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4901         Add thread_number parameter.
4902         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4903         * workqueue-threads.cc
4904         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4905         current thread if its thread number is greater than desired thread
4906         count.
4907         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4908         Add thread_number parameter.
4909         (Workqueue::should_cancel_thread): Likewise.
4910         (Workqueue::find_runnable_or_wait): Pass thread_number to
4911         should_cancel_thread.
4912         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4913         parameter.
4914
4915 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4916
4917         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4918         only after checking if it cannot be forced local.
4919         * symtab.h (is_externally_visible): Check if the symbol is not forced
4920         local.
4921
4922 2011-07-15  Ian Lance Taylor  <iant@google.com>
4923
4924         * options.h (class General_options): Add --print-output-format.
4925         Move -EL next to -EB, for  better --help output.
4926         * target-select.cc: Include <cstdio>, "options.h", and
4927         "parameters.h".
4928         (Target_selector::do_target_bfd_name): New function.
4929         (print_output_format): New function.
4930         * target-select.h (class Target_selector): Update declarations.
4931         (Target_selector::target_bfd_name): New function.
4932         (print_output_format): Declare.
4933         * main.cc: Include "target-select.h".
4934         (main): Handle --print-output-format.
4935         * gold.cc: Include "target-select.h".
4936         (queue_initial_tasks): Handle --print-output-format when there are
4937         no input files.
4938         * parameters.cc (parameters_force_valid_target): Give a better
4939         error message if -EB/-EL does not match target.
4940         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4941         function.
4942
4943 2011-07-15  Ian Lance Taylor  <iant@google.com>
4944
4945         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4946         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4947         (Output_data_plt_i386::do_write): Write address of .dynamic
4948         section to first entry in .got.plt section.
4949         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4950         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4951         Initialize layout_.
4952         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4953         section to first entry in .got.plt section.
4954         * layout.h (Layout::dynamic_section): New function.
4955
4956 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4957
4958         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4959         to claim_file call.
4960         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4961         input_section_position_, and input_section_glob_.
4962         (read_layout_from_file): Call function section_ordering_specified.
4963         * layout.h (is_section_ordering_specified): New function.
4964         (section_ordering_specified): New function.
4965         (section_ordering_specified_): New boolean member.
4966         * main.cc(main): Call load_plugins after layout object is defined.
4967         * output.cc (Output_section::add_input_section): Use
4968         function section_ordering_specified to check if section ordering is
4969         needed.
4970         * output.cc (Output_section::add_relaxed_input_section): Use
4971         function section_ordering_specified to check if section ordering is
4972         needed.
4973         (Output_section::update_section_layout): New function.
4974         (Output_section::sort_attached_input_sections): Check if input section
4975         must be reordered.
4976         * output.h (Output_section::update_section_layout): New function.
4977         * plugin.cc (get_section_count): New function.
4978         (get_section_type): New function.
4979         (get_section_name): New function.
4980         (get_section_contents): New function.
4981         (update_section_order): New function.
4982         (allow_section_ordering): New function.
4983         (Plugin::load): Add the new interfaces to the transfer vector.
4984         (Plugin_manager::load_plugins): New parameter.
4985         (Plugin_manager::all_symbols_read): New parameter.
4986         (Plugin_manager::claim_file): New parameter. Save the elf object for
4987         unclaimed objects.
4988         (Plugin_manager::get_elf_object): New function.
4989         (Plugin_manager::get_view): Change to directly use the bool to check
4990         if get_view is called from claim_file_hook.
4991         * plugin.h (input_objects): New function
4992         (Plugin__manager::load_plugins): New parameter.
4993         (Plugin_manager::claim_file): New parameter.
4994         (Plugin_manager::get_elf_object): New function.
4995         (Plugin_manager::in_claim_file_handler): New function.
4996         (Plugin_manager::in_claim_file_handler_): New member.
4997         (layout): New function.
4998         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4999         handler with an extra parameter. Make the elf object before calling
5000         claim_file handler.
5001         * testsuite/plugin_test.c (get_section_count): New function pointer.
5002         (get_section_type): New function pointer.
5003         (get_section_name): New function pointer.
5004         (get_section_contents): New function pointer.
5005         (update_section_order): New function pointer.
5006         (allow_section_ordering): New function pointer.
5007         (onload): Check if the new interfaces exist.
5008
5009 2011-07-13  Ian Lance Taylor  <iant@google.com>
5010
5011         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5012         relro section.
5013         * x86_64.cc (Target_x86_64::got_section): Likewise.
5014         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5015         (relro_now_test_SOURCES): New variable.
5016         (relro_now_test_DEPENDENCIES): New variable.
5017         (relro_now_test_LDFLAGS): New variable.
5018         (relro_now_test_LDADD): New variable.
5019         (relro_now_test.so): New target.
5020         * testsuite/Makefile.in: Rebuild.
5021
5022 2011-07-12  Ian Lance Taylor  <iant@google.com>
5023
5024         PR gold/12980
5025         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5026         GLOB_DAT relocation rather than a RELATIVE relocation for a
5027         protected symbol when creating a shared library.
5028         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5029         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5030         * testsuite/protected_main_1.cc (main): Test that protected
5031         function has same address.
5032
5033 2011-07-11  Ian Lance Taylor  <iant@google.com>
5034
5035         PR gold/12979
5036         * options.h (class General_options): Add -Bgroup.
5037         * options.cc (General_options::finalize): If -Bgroup is set,
5038         default to --unresolved-symbols=report-all.
5039         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5040         * target-reloc.h (issue_undefined_symbol_error): Handle
5041         --unresolved-symbols=report-all.
5042
5043 2011-07-08  Ian Lance Taylor  <iant@google.com>
5044
5045         PR gold/11985
5046         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5047         if linker script discards key sections.
5048         (Layout::create_dynamic_symtab): Likewise.
5049         (Layout::assign_local_dynsym_offsets): Likewise.
5050         (Layout::sized_create_version_sections): Likewise.
5051         (Layout::create_interp): Likewise.
5052         (Layout::finish_dynamic_section): Likewise.
5053         (Layout::set_dynamic_symbol_size): Likewise.
5054
5055 2011-07-08  Ian Lance Taylor  <iant@google.com>
5056
5057         PR gold/12386
5058         * options.h (class General_options): Add --unresolved-symbols.
5059         * target-reloc.h (issue_undefined_symbol_error): Check
5060         --unresolved-symbols.  Add comments.
5061
5062 2011-07-08  Ian Lance Taylor  <iant@google.com>
5063
5064         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5065         expression more complex.
5066
5067 2011-07-08  Ian Lance Taylor  <iant@google.com>
5068
5069         PR gold/11317
5070         * target-reloc.h (issue_undefined_symbol_error): New inline
5071         function, broken out of relocate_section.
5072         (relocate_section): Call issue_undefined_symbol_error.
5073         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5074         there is no TLS segment if we are about to issue an undefined
5075         symbol error.
5076         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5077
5078 2011-07-08  Ian Lance Taylor  <iant@google.com>
5079
5080         PR gold/12279
5081         * resolve.cc (Symbol_table::should_override): Add fromtype
5082         parameter.  Change all callers.  Give error when linking together
5083         TLS and non-TLS symbol.
5084         (Symbol_table::should_override_with_special): Add fromtype
5085         parameter.  Change all callers.
5086         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5087         there is no TLS segment if we have reported some errors.
5088         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5089
5090 2011-07-08  Ian Lance Taylor  <iant@google.com>
5091
5092         PR gold/12372
5093         * target.h (Target::plt_address_for_global): New function.
5094         (Target::plt_address_for_local): New function.
5095         (Target::plt_section_for_global): Remove.
5096         (Target::plt_section_for_local): Remove.
5097         (Target::do_plt_address_for_global): New virtual function.
5098         (Target::do_plt_address_for_local): New virtual function.
5099         (Target::do_plt_section_for_global): Remove.
5100         (Target::do_plt_section_for_local): Remove.
5101         (Target::register_global_plt_entry): Add Symbol_table and Layout
5102         parameters.
5103         * output.cc (Output_data_got::Got_entry::write): Use
5104         plt_address_for_global and plt_address_for_local.
5105         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5106         address of output section.
5107         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5108         got_irelative_, and irelative_count_ fields.  Update
5109         declarations.
5110         (Output_data_plt_i386::has_irelative_section): New function.
5111         (Output_data_plt_i386::entry_count): Add irelative_count_.
5112         (Output_data_plt_i386::set_final_data_size): Likewise.
5113         (class Target_i386): Add got_irelative_ and rel_irelative_
5114         fields.  Update declarations.
5115         (Target_i386::Target_i386): Initialize new fields.
5116         (Target_i386::do_plt_address_for_global): New function replacing
5117         do_plt_section_for_global.
5118         (Target_i386::do_plt_address_for_local): New function replacing
5119         do_plt_section_for_local.
5120         (Target_i386::got_section): Create got_irelative_.
5121         (Target_i386::rel_irelative_section): New function.
5122         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5123         fields.  Don't define __rel_iplt_{start,end}.
5124         (Output_data_plt_i386::add_entry): Add symtab and layout
5125         parameters.  Change all callers.  Use different PLT and GOT for
5126         IFUNC symbols.
5127         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5128         layout parameters.  Change all callers.  Use different PLT and
5129         GOT.
5130         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5131         (Output_data_plt_i386::rel_irelative): New function.
5132         (Output_data_plt_i386::address_for_global): New function.
5133         (Output_data_plt_i386::address_for_local): New function.
5134         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5135         IRELATIVE GOT when changing IFUNC GOT entries.
5136         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5137         reloc.
5138         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5139         if we didn't create an IRELATIVE GOT.
5140         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5141         plt_address_for_local.
5142         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5143         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5144         got_irelative_, and irelative_count_ fields.  Update
5145         declarations.
5146         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5147         Initialize new fields.  Remove symtab parameter.  Change all
5148         callers.
5149         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5150         irelative_count_.
5151         (Output_data_plt_x86_64::has_irelative_section): New function.
5152         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5153         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5154         fields.  Update declarations.
5155         (Target_x86_64::Target_x86_64): Initialize new fields.
5156         (Target_x86_64::do_plt_address_for_global): New function replacing
5157         do_plt_section_for_global.
5158         (Target_x86_64::do_plt_address_for_local): New function replacing
5159         do_plt_section_for_local.
5160         (Target_x86_64::got_section): Create got_irelative_.
5161         (Target_x86_64::rela_irelative_section): New function.
5162         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5163         all callers.  Don't create __rel_iplt_{start,end}.
5164         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5165         parameters.  Change all callers.  Use different PLT and GOT for
5166         IFUNC symbols.
5167         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5168         layout parameters.  Change all callers.  Use different PLT and
5169         GOT.
5170         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5171         parameters.  Change all callers.  Use different PLT and GOT for
5172         IFUNC symbols.
5173         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5174         (Output_data_plt_x86_64::rela_irelative): New function.
5175         (Output_data_plt_x86_64::address_for_global): New function.
5176         (Output_data_plt_x86_64::address_for_local): New function.
5177         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5178         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5179         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5180         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5181         parameters.
5182         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5183         reloc.
5184         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5185         symbols if we didn't create an IRELATIVE GOT.
5186         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5187         plt_address_for_local.
5188         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5189         * testsuite/ifuncvar1.c: New test file.
5190         * testsuite/ifuncvar2.c: New test file.
5191         * testsuite/ifuncvar3.c: New test file.
5192         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5193         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5194         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5195         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5196         * testsuite/Makefile.in: Rebuild.
5197
5198 2011-07-07  Cary Coutant  <ccoutant@google.com>
5199
5200         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5201         (two_file_test_1_ndebug.o): Likewise.
5202         (two_file_test_1b_ndebug.o): Likewise.
5203         (two_file_test_2_ndebug.o): Likewise.
5204         (two_file_test_main_ndebug.o): Likewise.
5205         (incremental_test_2): Link with no-debug versions.
5206
5207 2011-07-06  Cary Coutant  <ccoutant@google.com>
5208
5209         * gold/incremental.cc
5210         (Output_section_incremental_inputs::write_info_blocks): Check for
5211         hidden and internal symbols.
5212
5213 2011-07-06  Cary Coutant  <ccoutant@google.com>
5214
5215         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5216         Check disposition for startup file.
5217         (Incremental_inputs::report_command_line): Ignore
5218         --incremental-startup-unchanged option.
5219         * options.cc (General_options::parse_incremental_startup_unchanged):
5220         New function.
5221         (General_options::General_options): Initialize new data member.
5222         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5223         (General_options): Add --incremental-startup-unchanged option.
5224         (General_options::incremental_startup_disposition): New function.
5225         (General_options::incremental_startup_disposition_): New data member.
5226
5227 2011-07-06  Cary Coutant  <ccoutant@google.com>
5228
5229         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5230         input file index to Script_info ctor.
5231         (Sized_incremental_binary::do_file_has_changed): Find the
5232         command-line argument for files named in scripts.
5233         * incremental.h (Script_info::Script_info): New ctor
5234         with input file index.
5235         (Script_info::input_file_index): New function.
5236         (Script_info::input_file_index_): New data member.
5237         (Incremental_binary::get_library): Add const.
5238         (Incremental_binary::get_script_info): Add const.
5239         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5240         * testsuite/Makefile.am (incremental_test_5): New test case.
5241         (incremental_test_6): New test case.
5242         * testsuite/Makefile.in: Regenerate.
5243
5244 2011-07-06  Cary Coutant  <ccoutant@google.com>
5245
5246         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5247         debug output when command lines differ.
5248
5249 2011-07-06  Cary Coutant  <ccoutant@google.com>
5250
5251         * incremental.cc (Incremental_inputs::report_command_line): Ignore
5252         --incremental-patch option.
5253         * layout.cc (Free_list::allocate): Extend allocation beyond original
5254         end if enabled.
5255         (Layout::make_output_section): Mark sections that should get
5256         patch space.
5257         * options.cc (parse_percent): New function.
5258         * options.h (parse_percent): New function.
5259         (DEFINE_percent): New macro.
5260         (General_options): Add --incremental-patch option.
5261         * output.cc (Output_section::Output_section): Initialize new data
5262         members.
5263         (Output_section::add_input_section): Print section name when out
5264         of patch space.
5265         (Output_section::add_output_section_data): Likewise.
5266         (Output_section::set_final_data_size): Add patch space when
5267         doing --incremental-full.
5268         (Output_section::do_reset_address_and_file_offset): Remove patch
5269         space.
5270         (Output_segment::set_section_list_addresses): Print debug output
5271         only if --incremental-update.
5272         * output.h (Output_section::set_is_patch_space_allowed): New function.
5273         (Output_section::is_patch_space_allowed_): New data member.
5274         (Output_section::patch_space_): New data member.
5275         * parameters.cc (Parameters::incremental_full): New function.
5276         * parameters.h (Parameters::incremental_full): New function
5277         * testsuite/Makefile.am (incremental_test_2): Add test for
5278         --incremental-patch option.
5279         * testsuite/Makefile.in: Regenerate.
5280         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5281         (t18): Remove function body.
5282
5283 2011-07-05  Doug Kwan  <dougkwan@google.com>
5284
5285         PR gold/12771
5286         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5287         Arm_Address type for relocation result.
5288         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
5289         overflow check.
5290         (Arm_relocate_functions::abs32): Use unaligned access.
5291         (Arm_relocate_functions::rel32): Ditto.
5292         (Arm_relocate_functions::prel31): Ditto.
5293         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5294         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5295         static data relocations.
5296         * testsuite/Makefile.in: Regnerate.
5297         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5298
5299 2011-07-05  Ian Lance Taylor  <iant@google.com>
5300
5301         PR gold/12392
5302         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5303         symbols if necessary.
5304         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5305
5306 2011-07-05  Ian Lance Taylor  <iant@google.com>
5307
5308         PR gold/12952
5309         * resolve.cc (Symbol::override_base_with_special): Simply override
5310         version with special symbol version, ignoring previous version.
5311
5312 2011-07-05  Ian Lance Taylor  <iant@google.com>
5313
5314         * object.cc (Sized_relobj_file::include_section_group): Add
5315         information to comment about signature location.
5316
5317 2011-07-02  Ian Lance Taylor  <iant@google.com>
5318
5319         PR gold/12957
5320         * options.h (class General_options): Add -f and -F.
5321         * options.cc (General_options::finalize): Fatal error if -f/-F
5322         are used without -shared.
5323         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5324
5325 2011-07-02  Ian Lance Taylor  <iant@google.com>
5326
5327         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5328
5329 2011-07-01  Ian Lance Taylor  <iant@google.com>
5330
5331         PR gold/12525
5332         PR gold/12952
5333         * resolve.cc (Symbol::override_base_with_special): Don't override
5334         the version if the overriding symbol has a different name.
5335         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
5336         all callers.  If we give an error about an undefined version,
5337         define the base version if necessary.
5338         * dynobj.h (class Versions): Update declaration.
5339         * testsuite/weak_alias_test_5.cc: New file.
5340         * testsuite/weak_alias_test.script: New file.
5341         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5342         and versioned_alias have the right value, and call t2.
5343         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5344         weak_alias_test_5.so.
5345         (weak_alias_test_LDADD): Likewise.
5346         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5347         * testsuite/Makefile.in: Rebuild.
5348
5349 2011-07-01  Ian Lance Taylor  <iant@google.com>
5350
5351         PR gold/12525
5352         * options.h (class General_options): Support -z notext.
5353         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5354         -Wl,-z,notext.
5355         (two_file_shared_nonpic.so): Likewise.
5356         (two_file_shared_mixed.so): Likewise.
5357         (two_file_shared_mixed_1.so): Likewise.
5358         (weak_undef_lib_nonpic.so): Likewise.
5359         (alt/weak_undef_lib_nonpic.so): Likewise.
5360         (tls_test_shared_nonpic.so): Likewise.
5361         * testsuite/Makefile.in: Rebuild.
5362
5363 2011-07-01  Ian Lance Taylor  <iant@google.com>
5364
5365         PR gold/12525
5366         * configure.ac: Test whether static linking works, setting
5367         the automake conditional HAVE_STATIC.
5368         * testsuite/Makefile.am: Disable tests using -static if
5369         HAVE_STATIC is not true.
5370         * configure, testsuite/Makefile.in: Rebuild.
5371
5372 2011-07-01  Ian Lance Taylor  <iant@google.com>
5373
5374         PR gold/12525
5375         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5376         Assert if we see DW_EH_PE_indirect.
5377         * target.h (Target::ehframe_datarel_base): New function.
5378         (Target::do_ehframe_datarel_base): New target function.
5379         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5380         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5381         function.
5382
5383 2011-07-01  Ian Lance Taylor  <iant@google.com>
5384
5385         PR gold/12571
5386         * options.h (class General_options): Add
5387         --ld-generated-unwind-info.
5388         * ehframe.cc (Fde::write): Add address parameter.  Change all
5389         callers.  If associated with PLT, fill in address and size.
5390         (Cie::set_output_offset): Only add merge mapping if there is an
5391         object.
5392         (Cie::write): Add address parameter.  Change all callers.
5393         (Eh_frame::add_ehframe_for_plt): New function.
5394         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5395         input_offset_ fields into union u_, with new plt field.
5396         (Fde::Fde): Adjust for new union field.
5397         (Fde::Fde) [Output_data version]: New constructor.
5398         (Fde::add_mapping): Only add merge mapping if there is an object.
5399         (class Cie): Update declarations.
5400         (class Eh_frame): Declare add_ehframe_for_plt.
5401         * layout.cc (Layout::layout_eh_frame): Break out code into
5402         make_eh_frame_section, and call it.
5403         (Layout::make_eh_frame_section): New function.
5404         (Layout::add_eh_frame_for_plt): New function.
5405         * layout.h (class Layout): Update declarations.
5406         * merge.cc (Merge_map::add_mapping): Add assertion.
5407         * i386.cc: Include "dwarf.h".
5408         (class Output_data_plt_i386): Make first_plt_entry,
5409         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5410         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5411         and plt_eh_frame_fde.
5412         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5413         boundary.  Call add_eh_frame_for_plt if appropriate.
5414         * x86_64.cc: Include "dwarf.h".
5415         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5416         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5417         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5418         and plt_eh_frame_fde.
5419         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5420         appropriate.
5421
5422 2011-06-29  Ian Lance Taylor  <iant@google.com>
5423
5424         PR gold/12629
5425         * object.cc (Sized_relobj_file::layout_section): Change shdr
5426         parameter to be const.
5427         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5428         out of do_layout.
5429         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5430         appropriate.  Call layout_eh_frame_section.
5431         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5432         sections.
5433         * object.h (class Sized_relobj_file): Update declarations.
5434
5435 2011-06-29  Ian Lance Taylor  <iant@google.com>
5436
5437         PR gold/12652
5438         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5439         modifier.
5440         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5441
5442 2011-06-29  Ian Lance Taylor  <iant@google.com>
5443
5444         PR gold/12675
5445         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5446         SHT_X86_64_UNWIND.
5447         * layout.cc (Layout::layout_eh_frame): Likewise.
5448
5449 2011-06-29  Ian Lance Taylor  <iant@google.com>
5450
5451         PR gold/12695
5452         * layout.cc (Layout::symtab_section_shndx): New function.
5453         * layout.h (class Layout): Declare symtab_section_shndx.
5454         * output.cc (Output_section::write_header): Call it.
5455
5456 2011-06-29  Ian Lance Taylor  <iant@google.com>
5457
5458         PR gold/12818
5459         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5460         symbols which are not used in a relocation.
5461
5462 2011-06-28  Ian Lance Taylor  <iant@google.com>
5463
5464         PR gold/12898
5465         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5466         script create indistinguishable segments.
5467         (Layout::set_segment_offsets): Use stable_sort when sorting
5468         segments.  Pass this to Compare_segments constructor.
5469         * layout.h (class Layout): Make segment_precedes non-static.
5470         (class Compare_segments): Change from struct to class.  Add
5471         layout_ field.  Add constructor.
5472         * script-sections.cc
5473         (Script_sections::attach_sections_using_phdrs_clause): Rename
5474         local orphan to is_orphan.  Don't report failure to put empty
5475         section in segment.  On attachment failure, report name of
5476         section, and attach to first PT_LOAD segment.
5477
5478 2011-06-28  Ian Lance Taylor  <iant@google.com>
5479
5480         PR gold/12934
5481         * target-select.cc (Target_selector::Target_selector): Add
5482         emulation parameter.  Change all callers.
5483         (select_target_by_bfd_name): Rename from select_target_by_name.
5484         Change all callers.
5485         (select_target_by_emulation): New function.
5486         (supported_emulation_names): New function.
5487         * target-select.h (class Target_selector): Add emulation_ field.
5488         Update declarations.
5489         (Target_selector::recognize_by_bfd_name): Rename from
5490         recognize_by_name.  Change all callers.
5491         (Target_selector::supported_bfd_names): Rename from
5492         supported_names.  Change all callers.
5493         (Target_selector::recognize_by_emulation): New function.
5494         (Target_selector::supported_emulations): New function.
5495         (Target_selector::emulation): New function.
5496         (Target_selector::do_recognize_by_bfd_name): Rename from
5497         do_recognize_by_name.  Change all callers.
5498         (Target_selector::do_supported_bfd_names): Rename from
5499         do_supported_names.  Change all callers.
5500         (Target_selector::do_recognize_by_emulation): New function.
5501         (Target_selector::do_supported_emulations): New function.
5502         (select_target_by_bfd_name): Change name in declaration.
5503         (select_target_by_emulation): Declare.
5504         (supported_emulation_names): Declare.
5505         * parameters.cc (parameters_force_valid_target): Try to find
5506         target based on emulation from -m option.
5507         * options.h (class General_options): Change doc string for -m.
5508         * options.cc (help): Print emulations.
5509         (General_options::parse_V): Likewise.
5510         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5511         Add emulation parameter.  Change all callers.
5512
5513 2011-06-28  Ian Lance Taylor  <iant@google.com>
5514
5515         * target.h (class Target): Add osabi_ field.
5516         (Target::osabi): New function.
5517         (Target::set_osabi): New function.
5518         (Target::Target): Initialize osabi_.
5519         (Target::do_adjust_elf_header): Make pure virtual.
5520         (Sized_target::do_adjust_elf_header): Declare.
5521         * target.cc (Sized_target::do_adjust_elf_header): New function.
5522         (class Sized_target): Instantiate all versions.
5523         * freebsd.h (class Target_freebsd): Remove.
5524         (Target_selector_freebsd::do_recognize): Call set_osabi on
5525         Target.
5526         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5527         (Target_selector_freebsd::set_osabi): Remove.
5528         * i386.cc (class Target_i386): Inherit from Sized_target rather
5529         than Target_freebsd.
5530         * x86_64.cc (class Target_x86_64): Likewise.
5531
5532 2011-06-28  Ian Lance Taylor  <iant@google.com>
5533
5534         * target.h (Target::can_check_for_function_pointers): Rewrite.
5535         Make non-virtual.
5536         (Target::can_icf_inline_merge_sections): Likewise.
5537         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5538         (Target::Target_info): Add can_icf_inline_merge_sections field.
5539         (Target::do_can_check_for_function_pointers): New virtual
5540         function.
5541         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5542         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5543         from can_check_for_function_pointers, move in file.
5544         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5545         section_may_have_icf_unsafe_poineters, move in file.
5546         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5547         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5548         Rename from can_check_for_function_pointers, move in file.
5549         (Target_i386::can_icf_inline_merge_sections): Remove.
5550         (Target_i386::i386_info): Initialize
5551         can_icf_inline_merge_sections.
5552         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5553         Initialize can_icf_inline_merge_sections.
5554         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5555         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5556         Rename from can_check_for_function_pointers, move in file.
5557         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5558         (Target_x86_64::x86_64_info): Initialize
5559         can_icf_inline_merge_sections.
5560         * testsuite/testfile.cc (Target_test::test_target_info):
5561         Likewise.
5562         * icf.cc (get_section_contents): Correct formatting.
5563
5564 2011-06-27  Ian Lance Taylor  <iant@google.com>
5565
5566         * symtab.cc (Symbol::versioned_name): New function.
5567         (Symbol_table::add_to_final_symtab): Use versioned_name when
5568         appropriate.
5569         (Symbol_table::sized_write_symbol): Likewise.
5570         * symtab.h (class Symbol): Declare versioned_name.
5571         * stringpool.h (class Stringpool_template): Add variant of add
5572         which takes a std::basic_string.
5573         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5574         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5575         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5576         (ver_test_12.o): New target.
5577         * testsuite/Makefile.in: Rebuild.
5578
5579 2011-06-27  Doug Kwan  <dougkwan@google.com>
5580
5581         * arm.cc (Arm_relocate_functions::thm_jump8,
5582         Arm_relocate_functions::thm_jump11): Use a wider signed
5583         type to compute offset.
5584         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5585         arm_thm_jump8.
5586         * testsuite/Makefile.in: Regenerate.
5587         * testsuite/arm_branch_in_range.sh: Check test results of
5588         arm_thm_jump11 and arm_thm_jump8.
5589         * testsuite/arm_thm_jump11.s: New test source file.
5590         * testsuite/arm_thm_jump11.t: New linker script.
5591         * testsuite/arm_thm_jump8.s: New test source file.
5592         * testsuite/arm_thm_jump8.t: New linker script.
5593
5594 2011-06-24  Ian Lance Taylor  <iant@google.com>
5595
5596         * layout.cc: Include "object.h".
5597         (ctors_sections_in_init_array): New static variable.
5598         (Layout::is_ctors_in_init_array): New function.
5599         (Layout::layout): Add entry to ctors_sections_in_init_array if
5600         appropriate.
5601         * layout.h (class Layout): Declare is_ctors_in_init_array.
5602         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5603         is_ctors_reverse_view is set.
5604         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5605         all callers.  Set is_ctors_reverse_view field of View_size.
5606         (Sized_relobj_file::reverse_words): New function.
5607         * object.h (Sized_relobj_file::View_size): Add
5608         is_ctors_reverse_view field.
5609         (class Sized_relobj_file): Update declarations.
5610         * testsuite/initpri3.c: New test.
5611         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5612         initpri3b.
5613         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5614         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5615         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5616         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5617         * testsuite/Makefile.in: Rebuild.
5618
5619 2011-06-24  Cary Coutant  <ccoutant@google.com>
5620
5621         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5622         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5623         (debug_msg_cdebug.err): New targets.
5624         * testsuite/Makefile.in: Regenerate.
5625         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5626         Fix checks for link with shared library.
5627
5628 2011-06-24  Doug Kwan  <dougkwan@google.com>
5629
5630         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5631         skip empty text sections.
5632         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5633
5634 2011-06-22  Ian Lance Taylor  <iant@google.com>
5635
5636         PR gold/12910
5637         * options.h (class General_options): Add --ctors-in-init-array.
5638         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5639         friends as SHT_PROGBITS for merging sections.
5640         (Layout::layout): Remove special handling of .init_array and
5641         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5642         and .dtors if ctors_in_init_array.
5643         (Layout::make_output_section): Force correct section types for
5644         .init_array and friends.  Don't sort if doing relocatable link,
5645         Don't sort .ctors and .dtors if ctors_in_init_array.
5646         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5647         (Layout::output_section_name): Add relobj parameter.  Change all
5648         callers.  Handle .ctors. and .dtors. in code rather than table.
5649         Handle .ctors and .dtors if ctors_in_init_array.
5650         (Layout::match_file_name): New function, moved from output.cc.
5651         * layout.h (class Layout): Update declarations.
5652         * output.cc: Include "layout.h".
5653         (Input_section_sort_entry::get_priority): New function.
5654         (Input_section_sort_entry::match_file_name): Just call
5655         Layout::match_file_name.
5656         (Output_section::Input_section_sort_init_fini_compare::operator()):
5657         Handle .ctors and .dtors.  Sort by explicit priority rather than
5658         by name.
5659         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5660         * testsuite/initpri2.c: New test.
5661         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5662         (check_PROGRAMS): Add initpri2.
5663         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5664         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5665         * configure, testsuite/Makefile.in: Rebuild.
5666
5667 2011-06-19  Ian Lance Taylor  <iant@google.com>
5668
5669         PR gold/12880
5670         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5671         .interp section to a PT_INTERP segment even if we have seen a
5672         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5673         clause in a linker script.
5674         (Layout::finalize): Don't create a .interp section if we've
5675         already create a PT_INTERP segment.
5676         (Layout::create_interp): Always call choose_output_section (revert
5677         patch of 2011-06-17).  Don't create PT_INTERP segment.
5678         * script-sections.cc
5679         (Script_sections::create_note_and_tls_segments): Add a .interp
5680         section to a PT_INTERP segment even if we have seen a
5681         --dynamic-linker option.
5682
5683 2011-06-18  Ian Lance Taylor  <iant@google.com>
5684
5685         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5686         merely because a non-PT_LOAD segment has a dynamic reloc.
5687
5688 2011-06-18  Ian Lance Taylor  <iant@google.com>
5689
5690         * layout.cc (Layout::finish_dynamic_section): Don't create
5691         DT_FLAGS entry if not needed.
5692
5693 2011-06-18  Ian Lance Taylor  <iant@google.com>
5694
5695         PR gold/12745
5696         * layout.cc (Layout::layout_eh_frame): Correct handling of
5697         writable .eh_frame section.
5698
5699 2011-06-17  Ian Lance Taylor  <iant@google.com>
5700
5701         PR gold/12893
5702         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5703         symbol is redefined with the exact same object and value.
5704
5705 2011-06-17  Ian Lance Taylor  <iant@google.com>
5706
5707         PR gold/12880
5708         * layout.h (class Layout): Add interp_segment_ field.
5709         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5710         (Layout::attach_allocated_section_to_segment): If making shared
5711         library, put .interp section in PT_INTERP segment.
5712         (Layout::finalize): Also call create_interp if -dynamic-linker
5713         option was used.
5714         (Layout::create_interp): Assert that there is no PT_INTERP
5715         segment.  If not using a SECTIONS clause, use make_output_section.
5716         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5717         * script-sections.cc
5718         (Script_sections::create_note_and_tls_segments): If making shared
5719         library, put .interp section in PT_INTERP segment.
5720
5721 2011-06-17  Ian Lance Taylor  <iant@google.com>
5722
5723         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5724         when making a shared library.
5725
5726 2011-06-17  Ian Lance Taylor  <iant@google.com>
5727
5728         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5729         parameter.  Change all callers.  Don't issue warning about PC32
5730         against locally defined symbol.
5731
5732 2011-06-16  Ian Lance Taylor  <iant@google.com>
5733
5734         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5735         occurs in same object.
5736
5737 2011-06-14  Alan Modra  <amodra@gmail.com>
5738
5739         * po/POTFILES.in: Regenerate.
5740
5741 2011-06-09  Ian Lance Taylor  <iant@google.com>
5742
5743         * script-sections.cc
5744         (Orphan_output_section::set_section_addresses): For a relocatable
5745         link set address to 0.
5746
5747 2011-06-09  Cary Coutant  <ccoutant@google.com>
5748
5749         PR gold/12804
5750         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5751         used with --compress-debug-sections.
5752         * gold/object.cc (Sized_relobj_file::do_layout): Report
5753         uncompressed size of compressed input sections.
5754
5755 2011-06-08  Cary Coutant  <ccoutant@google.com>
5756
5757         PR gold/12804
5758         * testsuite/two_file_test_2_v1.cc: Change initialization of
5759         v2 to keep it in .data.
5760
5761 2011-06-07  Cary Coutant  <ccoutant@google.com>
5762
5763         * common.cc (Symbol_table::do_allocate_commons_list): Call
5764         gold_fallback.
5765         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5766         (Errors::fallback): New function.
5767         (gold_fallback): New function.
5768         * errors.h (Errors::fallback): New function.
5769         * gold.cc (gold_exit): Change status parameter to enum; adjust
5770         all callers.
5771         (queue_initial_tasks): Call gold_fallback.
5772         * gold.h: Include cstdlib.
5773         (Exit_status): New enum type.
5774         (gold_exit): Change status parameter to enum.
5775         (gold_fallback): New function.
5776         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5777         (Layout::create_symtab_sections): Likewise.
5778         (Layout::create_shdrs): Likewise.
5779         * main.cc (main): Adjust call to gold_exit.
5780         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5781         (Output_data_got::add_got_entry_pair): Likewise.
5782         (Output_section::add_input_section): Likewise.
5783         (Output_section::add_output_section_data): Likewise.
5784         (Output_segment::set_section_list_addresses): Likewise.
5785         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5786
5787 2011-06-07  Cary Coutant  <ccoutant@google.com>
5788
5789         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5790         for incremental links.
5791         * output.cc (Output_segment::set_section_list_addresses): Remove
5792         FIXME and test for TLS or BSS.
5793
5794 2011-06-07  Cary Coutant  <ccoutant@google.com>
5795
5796         * testsuite/Makefile.am: Add incremental_copy_test,
5797         incremental_common_test_1.
5798         * testsuite/Makefile.in: Regenerate.
5799         * testsuite/common_test_1_v1.c: New source file.
5800         * testsuite/common_test_1_v2.c: New source file.
5801         * testsuite/copy_test_v1.cc: New source file.
5802
5803 2011-06-07  Cary Coutant  <ccoutant@google.com>
5804
5805         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5806         update, allocate common from bss section's free list.
5807         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5808         linker-defined symbols.
5809         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5810         Skip GOT and PLT entries that are no longer referenced.
5811         (Output_section_incremental_inputs::write_info_blocks): Mark
5812         linker-defined symbols.
5813         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5814         * output.cc (Output_section::allocate): New function.
5815         * output.h (Output_section::allocate): New function.
5816         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5817         linker-defined symbols.
5818         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5819         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5820         (Symbol::init_base_output_data): Likewise.
5821         (Symbol::init_base_output_segment): Likewise.
5822         (Symbol::init_base_constant): Likewise.
5823         (Sized_symbol::init_output_data): Likewise.
5824         (Sized_symbol::init_output_segment): Likewise.
5825         (Sized_symbol::init_constant): Likewise.
5826         (Symbol_table::do_define_in_output_data): Likewise.
5827         (Symbol_table::do_define_in_output_segment): Likewise.
5828         (Symbol_table::do_define_as_constant): Likewise.
5829         * symtab.h (Symbol::is_predefined): New function.
5830         (Symbol::init_base_output_data): Add is_predefined parameter.
5831         (Symbol::init_base_output_segment): Likewise.
5832         (Symbol::init_base_constant): Likewise.
5833         (Symbol::is_predefined_): New data member.
5834         (Sized_symbol::init_output_data): Add is_predefined parameter.
5835         (Sized_symbol::init_output_segment): Likewise.
5836         (Sized_symbol::init_constant): Likewise.
5837         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5838
5839 2011-06-07  Cary Coutant  <ccoutant@google.com>
5840
5841         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5842         instead of emit_copy_reloc.
5843         (Copy_relocs::emit_copy_reloc): Refactor.
5844         (Copy_relocs::make_copy_reloc): New function.
5845         (Copy_relocs::add_copy_reloc): Remove.
5846         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5847         section.
5848         (Copy_relocs::make_copy_reloc): New function.
5849         (Copy_relocs::add_copy_reloc): Remove.
5850         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5851         unchanged input files.
5852         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5853         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5854         Reserve BSS space for COPY relocations.
5855         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5856         (Output_section_incremental_inputs::write_info_blocks): Record
5857         whether a symbol is copied from a shared object.
5858         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5859         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5860         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5861         (Incremental_input_entry_reader::get_output_symbol_index): Add
5862         is_copy parameter.
5863         (Incremental_binary::emit_copy_relocs): New function.
5864         (Incremental_binary::do_emit_copy_relocs): New function.
5865         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5866         new data member.
5867         (Sized_incremental_binary::add_copy_reloc): New function.
5868         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5869         (Sized_incremental_binary::Copy_reloc): New struct.
5870         (Sized_incremental_binary::Copy_relocs): New typedef.
5871         (Sized_incremental_binary::copy_relocs_): New data member.
5872         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5873         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5874         * target.h (Sized_target::emit_copy_reloc): New function.
5875         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5876
5877 2011-06-02  Cary Coutant  <ccoutant@google.com>
5878
5879         PR gold/12163
5880         * gold/archive.cc (Archive::Archive): Initialize new data member.
5881         (Archive::include_all_members): Return if archive has already been
5882         included.
5883         * gold/archive.h (Archive::include_all_members_): New data member.
5884
5885 2011-06-02  Nick Clifton  <nickc@redhat.com>
5886
5887         * dynobj.h: Fix spelling mistake in comment.
5888         * output.cc: Likewise.
5889
5890 2011-05-31  Doug Kwan  <dougkwan@google.com>
5891             Asier Llano
5892
5893         PR gold/12826
5894         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5895         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5896         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5897         redundant arm_exidx_test.so.
5898         * testsuite/Makefile.in: Regenerate.
5899         (check_SCRIPTS): Add pr12826.sh
5900         (check_DATA): Add pr12826.stdout
5901         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5902         * testsuite/pr12826.sh: New file.
5903         * testsuite/pr12826_1.s: Ditto.
5904         * testsuite/pr12826_1.s: Ditto.
5905
5906 2011-05-30  Ian Lance Taylor  <iant@google.com>
5907
5908         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5909         sections.
5910
5911 2011-05-29  Ian Lance Taylor  <iant@google.com>
5912
5913         PR gold/12804
5914         * testsuite/Makefile.am: Use different file name for two_file_test
5915         temporary file for each incremental test.
5916         * testsuite/Makefile.in: Rebuild.
5917
5918 2011-05-29  Ian Lance Taylor  <iant@google.com>
5919
5920         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5921         binary input file is empty.
5922
5923 2011-05-27  Ian Lance Taylor  <iant@google.com>
5924
5925         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5926         (ver_test_9.so): Likewise.
5927         * testsuite/Makefile.in: Rebuild.
5928
5929 2011-05-26 Cary Coutant  <ccoutant@google.com>
5930
5931         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5932         * incremental.cc (Incremental_inputs::report_input_section): Fix
5933         comment, indentation.
5934         (Incremental_inputs::report_comdat_group): New function.
5935         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5936         of data for incremental input file entry.
5937         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5938         group count, COMDAT group signatures.
5939         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5940         an unchanged input file.
5941         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5942         Initialize new data member.
5943         (Incremental_object_entry::add_comdat_group): New function.
5944         (Incremental_object_entry::get_comdat_group_count): New function.
5945         (Incremental_object_entry::get_comdat_signature_key): New function.
5946         (Incremental_object_entry::groups_): New data member.
5947         (Incremental_inputs::report_comdat_group): New function.
5948         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5949         data for incremental input file entry.
5950         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5951         (Incremental_input_entry_reader::get_input_section): Adjust size of
5952         data for incremental input file entry.
5953         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5954         (Incremental_input_entry_reader::get_comdat_group_signature): New
5955         function.
5956         * object.cc (Sized_relobj::include_section_group): Report kept
5957         COMDAT groups for incremental links.
5958
5959 2011-05-24  David Meyer  <pdox@google.com>
5960
5961         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5962         with name parameter.  Add found_name parameter.
5963         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5964         * dirsearch.h (class Dirsearch): Update declaration.
5965
5966 2011-05-24  Ian Lance Taylor  <iant@google.com>
5967
5968         * archive.cc (Library_base::should_include_member): Pull in object
5969         from archive if it defines the entry symbol.
5970         * parameters.cc (Parameters::entry): New function.
5971         * parameters.h (class Parameters): Declare entry.
5972         * output.h (class Output_file_header): Remove entry_ field.
5973         * output.cc (Output_file_header::Output_file_header): Remove entry
5974         parameter.  Change all callers.
5975         (Output_file_header::entry): Use parameters->entry.
5976         * gold.cc (queue_middle_tasks): Likewise.
5977         * plugin.cc (Plugin_hook::run): Likewise.
5978
5979 2011-05-24 Cary Coutant  <ccoutant@google.com>
5980
5981         * gold.cc (queue_initial_tasks): Pass incremental base filename
5982         to Output_file::open_base_file; don't print error message.
5983         * incremental-dump.cc (main): Adjust call to
5984         Output_file::open_for_modification.
5985         * incremental-dump.cc (main): Likewise.
5986         * incremental.cc (Incremental_inputs::report_command_line):
5987         Ignore --incremental-base option when comparing command lines.
5988         Ignore parameter when given as separate argument.
5989         * options.h (class General_options): Add --incremental-base.
5990         * output.cc (Output_file::Output_file):
5991         (Output_file::open_base_file): Add base_name and writable parameters;
5992         read base file into new file; print error message here.
5993         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5994         callers.
5995         * output.h (Output_file::open_for_modification): Rename to...
5996         (Output_file::open_base_file): ...this; add base_name and
5997         writable parameters; adjust all callers.
5998         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5999         callers.
6000         * testsuite/Makefile.am (incremental_test_4): Test
6001         --incremental-base.
6002         * testsuite/Makefile.in: Regenerate.
6003
6004 2011-05-24 Cary Coutant  <ccoutant@google.com>
6005
6006         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6007         incremental_test_4.
6008         * testsuite/Makefile.in: Regenerate.
6009         * testsuite/two_file_test_1_v1.cc: New test source file.
6010         * testsuite/two_file_test_1b_v1.cc: New test source file.
6011         * testsuite/two_file_test_2_v1.cc: New test source file.
6012
6013 2011-05-24 Cary Coutant  <ccoutant@google.com>
6014
6015         * dynobj.h (Dynobj::do_dynobj): New function.
6016         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6017         flag and soname for shared objects.
6018         * incremental.cc (Incremental_inputs::report_object): Make
6019         either Incremental_object_entry or Incremental_dynobj_entry; add
6020         soname to string table.
6021         (Incremental_inputs::report_input_section): Add assertion.
6022         (Output_section_incremental_inputs::set_final_data_size): Adjust
6023         type of input file entry for shared libraries; adjust size of
6024         shared library info entry.
6025         (Output_section_incremental_inputs::write_input_files): Write
6026         as_needed flag for shared libraries.
6027         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6028         of input file entry for shared libraries; write soname.
6029         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6030         soname from incremental info.
6031         * incremental.h (enum Incremental_input_flags): Add
6032         INCREMENTAL_INPUT_AS_NEEDED.
6033         (Incremental_input_entry::Incremental_input_entry): Initialize new
6034         data member.
6035         (Incremental_input_entry::set_as_needed): New function.
6036         (Incremental_input_entry::as_needed): New function.
6037         (Incremental_input_entry::do_dynobj_entry): New function.
6038         (Incremental_input_entry::as_needed_): New data member.
6039         (Incremental_object_entry::Incremental_object_entry): Don't check
6040         for shared library.
6041         (Incremental_object_entry::do_type): Likewise.
6042         (class Incremental_dynobj_entry): New class.
6043         (Incremental_input_entry_reader::as_needed): New function.
6044         (Incremental_input_entry_reader::get_soname): New function.
6045         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6046         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6047         size of shared library info entry.
6048         * layout.cc (Layout::finish_dynamic_section): Don't test for
6049         incremental link when adding DT_NEEDED entries.
6050         * object.h (Object::Object): Initialize new data member.
6051         (Object::dynobj): New function.
6052         (Object::set_as_needed): New function.
6053         (Object::as_needed): New function.
6054         (Object::do_dynobj): New function.
6055         (Object::as_needed_): New data member.
6056
6057 2011-05-24 Cary Coutant  <ccoutant@google.com>
6058
6059         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6060         info; adjust display of GOT entries.
6061         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6062         vector of input objects; remove file_status_.
6063         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6064         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6065         got_plt reader; call target hooks to reserve GOT entries.
6066         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6067         of input file info header and GOT info entry.
6068         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6069         relocation info.
6070         (Got_plt_view_info::got_descriptor): Remove.
6071         (Got_plt_view_info::sym_index): New data member.
6072         (Got_plt_view_info::input_index): New data member.
6073         (Local_got_offset_visitor::visit): Write input file index.
6074         (Global_got_offset_visitor::visit): Write 0 for input file index.
6075         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6076         with sym_index and input_index.
6077         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6078         incremental info GOT entry; replace got_descriptor with input_index.
6079         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6080         map from input file index to object.
6081         (Sized_relobj_incr::do_layout): Replace direct data member reference
6082         with accessor function.
6083         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6084         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6085         Adjust size of input file info header.
6086         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6087         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6088         (Incremental_input_entry_reader::get_input_section): Adjust size of
6089         input file info header.
6090         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6091         of incremental info GOT entry.
6092         (Incremental_got_plt_reader::get_got_desc): Remove.
6093         (Incremental_got_plt_reader::get_got_symndx): New function.
6094         (Incremental_got_plt_reader::get_got_input_index): New function.
6095         (Sized_incremental_binary::Sized_incremental_binary): Remove
6096         file_status_; add input_objects_.
6097         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6098         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6099         (Sized_incremental_binary::file_is_unchanged): Remove.
6100         (Sized_incremental_binary::set_input_object): New function.
6101         (Sized_incremental_binary::input_object): New function.
6102         (Sized_incremental_binary::file_status_): Remove.
6103         (Sized_incremental_binary::input_objects_): New data member.
6104         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6105         references.
6106         (Sized_relobj_incr::invalid_address): Move to base class.
6107         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6108         class.
6109         (Sized_relobj_incr::do_output_section_offset): Likewise.
6110         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6111         (Sized_relobj_incr::section_offsets_): Likewise.
6112         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6113         function.
6114         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6115         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6116         with accessor function.
6117         (Sized_relobj_file::do_layout): Likewise.
6118         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6119         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6120         (Sized_relobj_file::compute_final_local_value): Replace refs to
6121         section_offsets_ with accessor function.
6122         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6123         * object.h (Relobj::Relobj): Initialize new data members.
6124         (Relobj::add_dyn_reloc): New function.
6125         (Relobj::first_dyn_reloc): New function.
6126         (Relobj::dyn_reloc_count): New function.
6127         (Relobj::first_dyn_reloc_): New data member.
6128         (Relobj::dyn_reloc_count_): New data member.
6129         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6130         references.
6131         (Sized_relobj::Address): New typedef.
6132         (Sized_relobj::invalid_address): Move here from child class.
6133         (Sized_relobj::Sized_relobj): Initialize new data members.
6134         (Sized_relobj::sized_relobj): New function.
6135         (Sized_relobj::is_output_section_offset_invalid): Move here from
6136         child class.
6137         (Sized_relobj::get_output_section_offset): Likewise.
6138         (Sized_relobj::local_has_got_offset): Likewise.
6139         (Sized_relobj::local_got_offset): Likewise.
6140         (Sized_relobj::set_local_got_offset): Likewise.
6141         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6142         (Sized_relobj::clear_got_offsets): New function.
6143         (Sized_relobj::section_offsets): Move here from child class.
6144         (Sized_relobj::do_output_section_offset): Likewise.
6145         (Sized_relobj::do_set_section_offset): Likewise.
6146         (Sized_relobj::Local_got_offsets): Likewise.
6147         (Sized_relobj::local_got_offsets_): Likewise.
6148         (Sized_relobj::section_offsets_): Likewise.
6149         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6150         references.
6151         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6152         class.
6153         (Sized_relobj_file::sized_relobj): New function
6154         (Sized_relobj_file::local_has_got_offset): Move to base class.
6155         (Sized_relobj_file::local_got_offset): Likewise.
6156         (Sized_relobj_file::set_local_got_offset): Likewise.
6157         (Sized_relobj_file::get_output_section_offset): Likewise.
6158         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6159         (Sized_relobj_file::do_output_section_offset): Likewise.
6160         (Sized_relobj_file::do_set_section_offset): Likewise.
6161         (Sized_relobj_file::Local_got_offsets): Likewise.
6162         (Sized_relobj_file::local_got_offsets_): Likewise.
6163         (Sized_relobj_file::section_offsets_): Likewise.
6164         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6165         (all constructors).
6166         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6167         (Output_reloc::get_symbol_index): Likewise.
6168         (Output_reloc::local_section_offset): Likewise.
6169         (Output_reloc::get_address): Likewise.
6170         (Output_reloc::symbol_value): Likewise.
6171         (Output_data_got::reserve_slot): Move to class definition.
6172         (Output_data_got::reserve_local): New function.
6173         (Output_data_got::reserve_slot_for_global): Remove.
6174         (Output_data_got::reserve_global): New function.
6175         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6176         (all constructors, two instantiations).
6177         (Output_reloc::get_relobj): New function (two instantiations).
6178         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6179         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6180         (Output_data_reloc::add_global): Adjust type of relobj.
6181         (Output_data_reloc::add_global_relative): Likewise.
6182         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6183         (Output_data_reloc::add_local): Likewise.
6184         (Output_data_reloc::add_local_relative): Likewise.
6185         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6186         (Output_data_reloc::add_local_section): Likewise.
6187         (Output_data_reloc::add_output_section): Likewise.
6188         (Output_data_reloc::add_absolute): Likewise.
6189         (Output_data_reloc::add_target_specific): Likewise.
6190         (Output_data_got::reserve_slot): Move definition here.
6191         (Output_data_got::reserve_local): New function.
6192         (Output_data_got::reserve_global): New function.
6193         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6194         section_offsets_ with accessor function.
6195         (Sized_relobj_file::write_sections): Likewise.
6196         (Sized_relobj_file::do_relocate_sections): Likewise.
6197         * target.h (Sized_target::reserve_local_got_entry): New function.
6198         (Sized_target::reserve_global_got_entry): New function.
6199         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6200         (Target_x86_64::reserve_global_got_entry): New function.
6201         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6202
6203 2011-05-23 Cary Coutant  <ccoutant@google.com>
6204
6205         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6206         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6207         bit when checking got_type.
6208         * incremental.cc (Sized_incremental_binary::setup_readers):
6209         Store symbol table and string table locations; initialize bit vector
6210         of file status flags.
6211         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6212         unchanged files.
6213         (Sized_incremental_binary::do_process_got_plt): New function.
6214         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6215         (Output_section_incremental_inputs::set_final_data_size): Record
6216         file index for each input file.
6217         (Output_section_incremental_inputs::write_got_plt): Store file index
6218         instead of input entry offset for each GOT entry.
6219         * incremental.h
6220         (Incremental_input_entry::Incremental_input_entry): Initialize new
6221         data member.
6222         (Incremental_input_entry::set_offset): Store file index.
6223         (Incremental_input_entry::get_file_index): New function.
6224         (Incremental_input_entry::file_index_): New data member.
6225         (Incremental_binary::process_got_plt): New function.
6226         (Incremental_binary::do_process_got_plt): New function.
6227         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6228         data members.
6229         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6230         (Sized_incremental_binary::set_file_is_unchanged): New function.
6231         (Sized_incremental_binary::file_is_unchanged): New function.
6232         (Sized_incremental_binary::do_process_got_plt): New function.
6233         (Sized_incremental_binary::file_status_): New data member.
6234         (Sized_incremental_binary::main_symtab_loc_): New data member.
6235         (Sized_incremental_binary::main_strtab_loc_): New data member.
6236         * output.cc (Output_data_got::Got_entry::write): Add case
6237         RESERVED_CODE.
6238         (Output_data_got::add_global): Call add_got_entry.
6239         (Output_data_got::add_global_plt): Likewise.
6240         (Output_data_got::add_global_with_rel): Likewise.
6241         (Output_data_got::add_global_with_rela): Likewise.
6242         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6243         (Output_data_got::add_global_pair_with_rela): Likewise.
6244         (Output_data_got::add_local): Call add_got_entry.
6245         (Output_data_got::add_local_plt): Likewise.
6246         (Output_data_got::add_local_with_rel): Likewise.
6247         (Output_data_got::add_local_with_rela): Likewise.
6248         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6249         (Output_data_got::add_local_pair_with_rela): Likewise.
6250         (Output_data_got::reserve_slot): New function.
6251         (Output_data_got::reserve_slot_for_global): New function.
6252         (Output_data_got::add_got_entry): New function.
6253         (Output_data_got::add_got_entry_pair): New function.
6254         (Output_section::add_output_section_data): Edit FIXME.
6255         * output.h
6256         (Output_section_data_build::Output_section_data_build): New
6257         constructor with size parameter.
6258         (Output_data_space::Output_data_space): Likewise.
6259         (Output_data_got::Output_data_got): Initialize new data member; new
6260         constructor with size parameter.
6261         (Output_data_got::add_constant): Call add_got_entry.
6262         (Output_data_got::reserve_slot): New function.
6263         (Output_data_got::reserve_slot_for_global): New function.
6264         (class Output_data_got::Got_entry): Add RESERVED_CODE.
6265         (Output_data_got::add_got_entry): New function.
6266         (Output_data_got::add_got_entry_pair): New function.
6267         (Output_data_got::free_list_): New data member.
6268         * target.h (Sized_target::init_got_plt_for_update): New function.
6269         (Sized_target::register_global_plt_entry): New function.
6270         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6271         Initialize new data member; call init; add constructor with PLT count.
6272         (Output_data_plt_x86_64::init): New function.
6273         (Output_data_plt_x86_64::add_relocation): New function.
6274         (Output_data_plt_x86_64::reserve_slot): New function.
6275         (Output_data_plt_x86_64::free_list_): New data member.
6276         (Target_x86_64::init_got_plt_for_update): New function.
6277         (Target_x86_64::register_global_plt_entry): New function.
6278         (Output_data_plt_x86_64::add_entry): Allocate from free list for
6279         incremental updates.
6280         (Output_data_plt_x86_64::add_relocation): New function.
6281         * testsuite/object_unittest.cc (Object_test): Set default options.
6282
6283 2011-05-16  Ian Lance Taylor  <iant@google.com>
6284
6285         * options.h (class General_options): Make -i a synonym for -r.
6286
6287 2011-05-16  Ian Lance Taylor  <iant@google.com>
6288
6289         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6290
6291 2011-05-10 Cary Coutant  <ccoutant@google.com>
6292
6293         * object.cc (Sized_relobj::do_count_local_symbols): Check for
6294         strip_all (-s).
6295
6296 2011-05-06  Ian Lance Taylor  <iant@google.com>
6297
6298         * layout.cc (Layout::layout): If the output section flags change,
6299         update the ordering.
6300
6301 2011-04-25 Cary Coutant  <ccoutant@google.com>
6302
6303         * incremental-dump.cc (dump_incremental_inputs): Print local
6304         symbol info for each input file.
6305         * incremental.cc
6306         (Output_section_incremental_inputs::set_final_data_size): Add local
6307         symbol info to input file entries in incremental info.
6308         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6309         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6310         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6311         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6312         implementation.
6313         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6314         (Sized_incr_relobj::do_relocate): Write the local symbols.
6315         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6316         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6317         Adjust size of input file header.
6318         (Incremental_inputs_reader::get_local_symbol_offset): New function.
6319         (Incremental_inputs_reader::get_local_symbol_count): New function.
6320         (Incremental_inputs_reader::get_input_section): Adjust size of input
6321         file header.
6322         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6323         (Sized_incr_relobj::This): New typedef.
6324         (Sized_incr_relobj::sym_size): New const data member.
6325         (Sized_incr_relobj::Local_symbol): New struct.
6326         (Sized_incr_relobj::do_output_local_symbol_count): New function.
6327         (Sized_incr_relobj::do_local_symbol_offset): New function.
6328         (Sized_incr_relobj::local_symbol_count_): New data member.
6329         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6330         (Sized_incr_relobj::local_symbol_index_): New data member.
6331         (Sized_incr_relobj::local_symbol_offset_): New data member.
6332         (Sized_incr_relobj::local_dynsym_offset_): New data member.
6333         (Sized_incr_relobj::local_symbols_): New data member.
6334         * object.h (Relobj::output_local_symbol_count): New function.
6335         (Relobj::local_symbol_offset): New function.
6336         (Relobj::do_output_local_symbol_count): New function.
6337         (Relobj::do_local_symbol_offset): New function.
6338         (Sized_relobj::do_output_local_symbol_count): New function.
6339         (Sized_relobj::do_local_symbol_offset): New function.
6340
6341 2011-04-22  Vladimir Simonov  <sv@sw.ru>
6342
6343         * descriptors.cc (set_close_on_exec): New function.
6344         (Descriptors::open): Use set_close_on_exec.
6345         * output.cc (S_ISLNK): Define if not defined.
6346
6347 2011-04-22 Cary Coutant  <ccoutant@google.com>
6348
6349         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6350         global symbol map.
6351         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6352         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6353         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6354         relocations.
6355         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6356         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6357         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6358         * incremental.h
6359         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6360         function.
6361         (Incremental_binary::apply_incremental_relocs): New function.
6362         (Incremental_binary::do_apply_incremental_relocs): New function.
6363         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6364         data member.
6365         (Sized_incremental_binary::add_global_symbol): New function.
6366         (Sized_incremental_binary::global_symbol): New function.
6367         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6368         (Sized_incremental_binary::symbol_map_): New data member.
6369         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6370         * target.h (Sized_target::apply_relocation): New function.
6371         * target-reloc.h (apply_relocation): New function.
6372         * x86_64.cc (Target_x86_64::apply_relocation): New function.
6373
6374 2011-04-22  Doug Kwan  <dougkwan@google.com>
6375
6376         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6377         flag of a SHT_ARM_EXIDX section.
6378         * testsuite/Makefile.am (arm_exidx_test): New test rules.
6379         * testsuite/Makefile.in: Regenerate.
6380         * testsuite/arm_exidx_test.s: New file.
6381         * testsuite/arm_exidx_test.sh: Same.
6382
6383 2011-04-20 Cary Coutant  <ccoutant@google.com>
6384
6385         PR gold/12689
6386         * archive.h (Incremental_archive_entry::Archive_member):
6387         Initialize arg_serial_ (second constructor).
6388
6389 2011-04-17  Ian Lance Taylor  <iant@google.com>
6390
6391         * object.cc (Relocate_info::location): Simplify location string.
6392         * errors.cc (Errors::error_at_location): Don't print program
6393         name.
6394         (Errors::warning_at_location): Likewise.
6395         (Errors::undefined_symbol): Likewise.
6396         * testsuite/debug_msg.sh: Update accordingly.
6397
6398 2011-04-14 Cary Coutant  <ccoutant@google.com>
6399
6400         * gold/layout.cc (Layout::symtab_section_offset): New function.
6401         * gold/layout.h (Layout::symtab_section_offset): New function.
6402         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6403
6404 2011-04-12  Ian Lance Taylor  <iant@google.com>
6405
6406         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6407         with MREMAP_MAYMOVE.
6408         * output.h (class Output_file): Add map_is_allocated_ field.
6409         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6410         not available, provide stubs.  If mremap is not available, #define
6411         it to gold_mremap.
6412         (MREMAP_MAYMOVE): Define if not defined.
6413         (Output_file::Output_file): Initialize map_is_allocated_.
6414         (Output_file::resize): Check map_is_allocated_.
6415         (Output_file::map_anonymous): If mmap fails, use malloc.
6416         (Output_file::unmap): Don't do anything for an anonymous map.
6417         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6418         is not available, provide stubs.
6419         (File_read::View::~View): Use free rather than delete[].
6420         (File_read::make_view): Use malloc rather than new[].  If mmap
6421         fails, use malloc.
6422         (File_read::find_or_make_view): Use malloc rather than new[].
6423         * gold.h: Remove HAVE_REMAP code.
6424         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6425         exists.  Rename mremap to gold_mremap.  If mmap is not available
6426         don't do anything.
6427         * configure, config.in: Rebuild.
6428
6429 2011-04-11  Ian Lance Taylor  <iant@google.com>
6430
6431         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6432         initialize local variable v.
6433
6434 2011-04-11  Cary Coutant  <ccoutant@google.com>
6435
6436         * archive.cc (Archive::include_member): Adjust call to
6437         report_object.
6438         (Add_archive_symbols::run): Track argument serial numbers.
6439         (Lib_group::include_member): Likewise.
6440         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6441         * archive.h (Incremental_archive_entry::Archive_member):
6442         Initialize arg_serial_.
6443         (Archive_member::arg_serial_): New data member.
6444         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6445         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6446         incremental link.
6447         (Sized_dynobj::do_for_all_local_got_entries): New function.
6448         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6449         function.
6450         * fileread.cc (get_mtime): New function.
6451         * fileread.h (get_mtime): New function.
6452         * gold.cc (queue_initial_tasks): Check for incremental update.
6453         (process_incremental_input): New function.
6454         (queue_middle_tasks): Don't force valid target for incremental
6455         update.
6456         * incremental-dump.cc (find_input_containing_global): Adjust
6457         size of symbol info entry.
6458         (dump_incremental_inputs): Dump argument serial number and
6459         in_system_directory flag; bias shndx by 1; print symbol names
6460         when dumping per-file symbol lists; use new symbol info readers.
6461         * incremental.cc
6462         (Output_section_incremental_inputs:update_data_size): New function.
6463         (Sized_incremental_binary::setup_readers): Setup input readers
6464         for each input file; build maps for files added from libraries
6465         and scripts.
6466         (Sized_incremental_binary::check_input_args): New function.
6467         (Sized_incremental_binary::do_check_inputs): Build map of argument
6468         serial numbers to input arguments.
6469         (Sized_incremental_binary::do_file_has_changed): Rename
6470         do_file_is_unchanged to this; compare file modification times.
6471         (Sized_incremental_binary::do_init_layout): New function.
6472         (Sized_incremental_binary::do_reserve_layout): New function.
6473         (Sized_incremental_binary::do_get_input_reader): Remove.
6474         (Sized_incremental_binary::get_symtab_view): New function.
6475         (Incremental_checker::can_incrementally_link_output_file): Remove.
6476         (Incremental_inputs::report_command_line): Exclude --debug options.
6477         (Incremental_inputs::report_archive_begin): Add parameter; track
6478         argument serial numbers; don't put input file entry for archive
6479         before archive members.
6480         (Incremental_inputs::report_archive_end): Put input file entry
6481         for archive after archive members.
6482         (Incremental_inputs::report_object): Add parameter; track argument
6483         serial numbers and in_system_directory flag.
6484         (Incremental_inputs::report_script): Add parameter; track argument
6485         serial numbers.
6486         (Output_section_incremental_inputs::set_final_data_size): Adjust
6487         size of symbol info entry; check for forwarding symbols.
6488         (Output_section_incremental_inputs::write_input_files): Write
6489         in_system_directory flag and argument serial number.
6490         (Output_section_incremental_inputs::write_info_blocks): Map section
6491         indices between incremental info and original input file; store
6492         input section index for each symbol.
6493         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6494         change operator() to visit().
6495         (class Global_got_offset_visitor): Likewise.
6496         (class Global_symbol_visitor_got_plt):
6497         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6498         classes.
6499         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6500         (Sized_incr_relobj::do_read_symbols): New function.
6501         (Sized_incr_relobj::do_layout): New function.
6502         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6503         (Sized_incr_relobj::do_add_symbols): New function.
6504         (Sized_incr_relobj::do_should_include_member): New function.
6505         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6506         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6507         (Sized_incr_relobj::do_section_size): New function.
6508         (Sized_incr_relobj::do_section_name): New function.
6509         (Sized_incr_relobj::do_section_contents): New function.
6510         (Sized_incr_relobj::do_section_flags): New function.
6511         (Sized_incr_relobj::do_section_entsize): New function.
6512         (Sized_incr_relobj::do_section_address): New function.
6513         (Sized_incr_relobj::do_section_type): New function.
6514         (Sized_incr_relobj::do_section_link): New function.
6515         (Sized_incr_relobj::do_section_info): New function.
6516         (Sized_incr_relobj::do_section_addralign): New function.
6517         (Sized_incr_relobj::do_initialize_xindex): New function.
6518         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6519         (Sized_incr_relobj::do_read_relocs): New function.
6520         (Sized_incr_relobj::do_gc_process_relocs): New function.
6521         (Sized_incr_relobj::do_scan_relocs): New function.
6522         (Sized_incr_relobj::do_count_local_symbols): New function.
6523         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6524         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6525         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6526         (Sized_incr_relobj::do_relocate): New function.
6527         (Sized_incr_relobj::do_set_section_offset): New function.
6528         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6529         (Sized_incr_dynobj::do_read_symbols): New function.
6530         (Sized_incr_dynobj::do_layout): New function.
6531         (Sized_incr_dynobj::do_add_symbols): New function.
6532         (Sized_incr_dynobj::do_should_include_member): New function.
6533         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6534         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6535         (Sized_incr_dynobj::do_section_size): New function.
6536         (Sized_incr_dynobj::do_section_name): New function.
6537         (Sized_incr_dynobj::do_section_contents): New function.
6538         (Sized_incr_dynobj::do_section_flags): New function.
6539         (Sized_incr_dynobj::do_section_entsize): New function.
6540         (Sized_incr_dynobj::do_section_address): New function.
6541         (Sized_incr_dynobj::do_section_type): New function.
6542         (Sized_incr_dynobj::do_section_link): New function.
6543         (Sized_incr_dynobj::do_section_info): New function.
6544         (Sized_incr_dynobj::do_section_addralign): New function.
6545         (Sized_incr_dynobj::do_initialize_xindex): New function.
6546         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6547         (make_sized_incremental_object): New function.
6548         (Incremental_library::copy_unused_symbols): New function.
6549         (Incremental_library::do_for_all_unused_symbols): New function.
6550         * incremental.h (enum Incremental_input_flags): New type.
6551         (class Incremental_checker): Remove.
6552         (Incremental_input_entry::Incremental_input_entry): Add argument
6553         serial number.
6554         (Incremental_input_entry::arg_serial): New function.
6555         (Incremental_input_entry::set_is_in_system_directory): New function.
6556         (Incremental_input_entry::is_in_system_directory): New function.
6557         (Incremental_input_entry::arg_serial_): New data member.
6558         (Incremental_input_entry::is_in_system_directory_): New data member.
6559         (class Script_info): Move here from script.h.
6560         (Script_info::Script_info): Add filename parameter.
6561         (Script_info::filename): New function.
6562         (Script_info::filename_): New data member.
6563         (Incremental_script_entry::Incremental_script_entry): Add argument
6564         serial number.
6565         (Incremental_object_entry::Incremental_object_entry): Likewise.
6566         (Incremental_object_entry::add_input_section): Build list of input
6567         sections with map to original shndx.
6568         (Incremental_object_entry::get_input_section_index): New function.
6569         (Incremental_object_entry::shndx_): New data member.
6570         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6571         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6572         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6573         serial number.
6574         (Incremental_inputs::report_archive_begin): Likewise.
6575         (Incremental_inputs::report_object): Likewise.
6576         (Incremental_inputs::report_script): Likewise.
6577         (class Incremental_global_symbol_reader): New class.
6578         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6579         and store flags and input file type.
6580         (Incremental_input_entry_reader::arg_serial): New function.
6581         (Incremental_input_entry_reader::type): Extract type from flags.
6582         (Incremental_input_entry_reader::is_in_system_directory): New function.
6583         (Incremental_input_entry_reader::get_input_section_count): Call
6584         accessor function for type.
6585         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6586         function for type; adjust size of global symbol entry.
6587         (Incremental_input_entry_reader::get_global_symbol_count): Call
6588         accessor function for type.
6589         (Incremental_input_entry_reader::get_object_count): Likewise.
6590         (Incremental_input_entry_reader::get_object_offset): Likewise.
6591         (Incremental_input_entry_reader::get_member_count): Likewise.
6592         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6593         (Incremental_input_entry_reader::get_member_offset): Likewise.
6594         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6595         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6596         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6597         (Incremental_input_entry_reader::get_global_symbol_reader): New
6598         function.
6599         (Incremental_input_entry_reader::get_output_symbol_index): New
6600         function.
6601         (Incremental_input_entry_reader::type_): Remove.
6602         (Incremental_input_entry_reader::flags_): New data member.
6603         (Incremental_inputs_reader::input_file_offset): New function.
6604         (Incremental_inputs_reader::input_file_index): New function.
6605         (Incremental_inputs_reader::input_file): Call input_file_offset.
6606         (Incremental_inputs_reader::input_file_at_offset): New function.
6607         (Incremental_relocs_reader::get_r_type): Reformat.
6608         (Incremental_relocs_reader::get_r_shndx): Reformat.
6609         (Incremental_relocs_reader::get_r_offset): Reformat.
6610         (Incremental_relocs_reader::data): New function.
6611         (Incremental_binary::Incremental_binary): Initialize new data members.
6612         (Incremental_binary::check_inputs): Add cmdline parameter.
6613         (Incremental_binary::file_is_unchanged): Remove.
6614         (Input_reader::arg_serial): New function.
6615         (Input_reader::get_unused_symbol_count): New function.
6616         (Input_reader::get_unused_symbol): New function.
6617         (Input_reader::do_arg_serial): New function.
6618         (Input_reader::do_get_unused_symbol_count): New function.
6619         (Input_reader::do_get_unused_symbol): New function.
6620         (Incremental_binary::input_file_count): New function.
6621         (Incremental_binary::get_input_reader): Change signature to use
6622         index instead of filename.
6623         (Incremental_binary::file_has_changed): New function.
6624         (Incremental_binary::get_input_argument): New function.
6625         (Incremental_binary::get_library): New function.
6626         (Incremental_binary::get_script_info): New function.
6627         (Incremental_binary::init_layout): New function.
6628         (Incremental_binary::reserve_layout): New function.
6629         (Incremental_binary::output_file): New function.
6630         (Incremental_binary::do_check_inputs): New function.
6631         (Incremental_binary::do_file_is_unchanged): Remove.
6632         (Incremental_binary::do_file_has_changed): New function.
6633         (Incremental_binary::do_init_layout): New function.
6634         (Incremental_binary::do_reserve_layout): New function.
6635         (Incremental_binary::do_input_file_count): New function.
6636         (Incremental_binary::do_get_input_reader): Change signature.
6637         (Incremental_binary::input_args_map_): New data member.
6638         (Incremental_binary::library_map_): New data member.
6639         (Incremental_binary::script_map_): New data member.
6640         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6641         new data members.
6642         (Sized_incremental_binary::output_section): New function.
6643         (Sized_incremental_binary::inputs_reader): Add const.
6644         (Sized_incremental_binary::symtab_reader): Add const.
6645         (Sized_incremental_binary::relocs_reader): Add const.
6646         (Sized_incremental_binary::got_plt_reader): Add const.
6647         (Sized_incremental_binary::get_symtab_view): New function.
6648         (Sized_incremental_binary::Inputs_reader): New typedef.
6649         (Sized_incremental_binary::Input_entry_reader): New typedef.
6650         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6651         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6652         (Sized_incremental_binary::do_file_has_changed): New function.
6653         (Sized_incremental_binary::do_init_layout): New function.
6654         (Sized_incremental_binary::do_reserve_layout): New function.
6655         (Sized_input_reader::Inputs_reader): Remove.
6656         (Sized_input_reader::Input_entry_reader): Remove.
6657         (Sized_input_reader::do_arg_serial): New function.
6658         (Sized_input_reader::do_get_unused_symbol_count): New function.
6659         (Sized_input_reader::do_get_unused_symbol): New function.
6660         (Sized_incremental_binary::do_input_file_count): New function.
6661         (Sized_incremental_binary::do_get_input_reader): Change signature;
6662         use index instead of filename.
6663         (Sized_incremental_binary::section_map_): New data member.
6664         (Sized_incremental_binary::input_entry_readers_): New data member.
6665         (class Sized_incr_relobj): New class.
6666         (class Sized_incr_dynobj): New class.
6667         (make_sized_incremental_object): New function.
6668         (class Incremental_library): New class.
6669         * layout.cc (Free_list::num_lists): New static data member.
6670         (Free_list::num_nodes): New static data member.
6671         (Free_list::num_removes): New static data member.
6672         (Free_list::num_remove_visits): New static data member.
6673         (Free_list::num_allocates): New static data member.
6674         (Free_list::num_allocate_visits): New static data member.
6675         (Free_list::init): New function.
6676         (Free_list::remove): New function.
6677         (Free_list::allocate): New function.
6678         (Free_list::dump): New function.
6679         (Free_list::print_stats): New function.
6680         (Layout_task_runner::run): Resize output file for incremental updates.
6681         (Layout::Layout): Initialize new data members.
6682         (Layout::set_incremental_base): New function.
6683         (Layout::init_fixed_output_section): New function.
6684         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6685         incremental updates.
6686         (Layout::create_gold_note): Do not create gold note section for
6687         incremental updates.
6688         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6689         for incremental updates.
6690         (Layout::set_section_offsets): For incremental updates, allocate space
6691         from free list.
6692         (Layout::create_symtab_sections): Layout with offsets relative to
6693         start of section; for incremental updates, allocate space from free
6694         list.
6695         (Layout::create_shdrs): For incremental updates, allocate space from
6696         free list.
6697         (Layout::finish_dynamic_section): For incremental updates, do not
6698         check --as-needed (fixed in subsequent patch).
6699         * layout.h (class Free_list): New class.
6700         (Layout::set_incremental_base): New function.
6701         (Layout::incremental_base): New function.
6702         (Layout::init_fixed_output_section): New function.
6703         (Layout::allocate): New function.
6704         (Layout::incremental_base_): New data member.
6705         (Layout::free_list_): New data member.
6706         * main.cc (main): Print Free_list statistics.
6707         * object.cc (Relobj::finalize_incremental_relocs): Add
6708         clear_counts parameter; clear counts only when clear_counts is set.
6709         (Sized_relobj::Sized_relobj): Initialize new base class.
6710         (Sized_relobj::do_layout): Don't report special sections.
6711         (Sized_relobj::do_for_all_local_got_entries): New function.
6712         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6713         symtab_off to all symbol table offsets.
6714         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6715         * object.h (class Got_offset_list): Move to top of file.
6716         (Object::Object): Allow case where input_file == NULL.
6717         (Object::~Object): Likewise.
6718         (Object::input_file): Assert that input_file != NULL.
6719         (Object::lock): Allow case where input_file == NULL.
6720         (Object::unlock): Likewise.
6721         (Object::is_locked): Likewise.
6722         (Object::token): Likewise.
6723         (Object::release): Likewise.
6724         (Object::is_incremental): New function.
6725         (Object::get_mtime): New function.
6726         (Object::for_all_local_got_entries): New function.
6727         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6728         (Object::set_is_in_system_directory): New function.
6729         (Object::is_in_system_directory): New function.
6730         (Object::do_is_incremental): New function.
6731         (Object::do_get_mtime): New function.
6732         (Object::do_for_all_local_got_entries): New function.
6733         (Object::is_in_system_directory_): New data member.
6734         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6735         (class Sized_relobj_base): New class.
6736         (class Sized_relobj): Derive from Sized_relobj_base.
6737         (class Sized_relobj::Symbols): Redeclare from base class.
6738         (class Sized_relobj::local_got_offset_list): Remove.
6739         (class Sized_relobj::Output_sections): Redeclare from base class.
6740         (class Sized_relobj::do_for_all_local_got_entries): New function.
6741         (class Sized_relobj::write_local_symbols): Add offset parameter.
6742         (class Sized_relobj::local_symbol_offset_): Update comment.
6743         (class Sized_relobj::local_dynsym_offset_): Update comment.
6744         * options.cc (Input_arguments::add_file): Remove const.
6745         * options.h (Input_file_argument::Input_file_argument):
6746         Initialize arg_serial_ (all constructors).
6747         (Input_file_argument::set_arg_serial): New function.
6748         (Input_file_argument::arg_serial): New function.
6749         (Input_file_argument::arg_serial_): New data member.
6750         (Input_arguments::Input_arguments): Initialize file_count_.
6751         (Input_arguments::add_file): Remove const.
6752         (Input_arguments::number_of_input_files): New function.
6753         (Input_arguments::file_count_): New data member.
6754         (Command_line::number_of_input_files): Call
6755         Input_arguments::number_of_input_files.
6756         * output.cc (Output_segment_headers::Output_segment_headers):
6757         Set current size.
6758         (Output_section::Input_section::current_data_size): New function.
6759         (Output_section::Output_section): Initialize new data members.
6760         (Output_section::add_input_section): Don't do merge sections for
6761         an incremental link; allocate space from free list for an
6762         incremental update.
6763         (Output_section::add_output_section_data): Allocate space from
6764         free list for an incremental update.
6765         (Output_section::update_data_size): New function.
6766         (Output_section::set_fixed_layout): New function.
6767         (Output_section::reserve): New function.
6768         (Output_segment::set_section_addresses): Remove const.
6769         (Output_segment::set_section_list_addresses): Remove const; allocate
6770         space from free list for an incremental update.
6771         (Output_segment::set_offset): Adjust size of RELRO segment for an
6772         incremental update.
6773         * output.h (Output_data::current_data_size): Move here from
6774         child classes.
6775         (Output_data::pre_finalize_data_size): New function.
6776         (Output_data::update_data_size): New function.
6777         (Output_section_headers::update_data_size): new function.
6778         (Output_section_data_build::current_data_size): Move to Output_data.
6779         (Output_data_strtab::update_data_size): New function.
6780         (Output_section::current_data_size): Move to Output_data.
6781         (Output_section::set_fixed_layout): New function.
6782         (Output_section::has_fixed_layout): New function.
6783         (Output_section::reserve): New function.
6784         (Output_section::update_data_size): New function.
6785         (Output_section::has_fixed_layout_): New data member.
6786         (Output_section::free_list_): New data member.
6787         (Output_segment::set_section_addresses): Remove const.
6788         (Output_segment::set_section_list_addresses): Remove const.
6789         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6790         New function.
6791         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6792         New function.
6793         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6794         parameter when calling Add_symbols constructor; store argument
6795         serial number for members of a lib group.
6796         (Add_symbols::locks): Allow case where token == NULL.
6797         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6798         (Read_member::~Read_member): New function.
6799         (Read_member::is_runnable): New function.
6800         (Read_member::locks): New function.
6801         (Read_member::run): New function.
6802         (Check_script::~Check_script): New function.
6803         (Check_script::is_runnable): New function.
6804         (Check_script::locks): New function.
6805         (Check_script::run): New function.
6806         (Check_library::~Check_library): New function.
6807         (Check_library::is_runnable): New function.
6808         (Check_library::locks): New function.
6809         (Check_library::run): New function.
6810         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6811         (Add_symbols::library_): New data member.
6812         (class Read_member): New class.
6813         (class Check_script): New class.
6814         (class Check_library): New class.
6815         * reloc.cc (Read_relocs::is_runnable): Allow case where
6816         token == NULL.
6817         (Read_relocs::locks): Likewise.
6818         (Scan_relocs::locks): Likewise.
6819         (Relocate_task::locks): Likewise.
6820         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6821         to clear counters.
6822         (Sized_relobj::incremental_relocs_scan): Fix comment.
6823         (Sized_relobj::do_relocate): Pass output file offset to
6824         write_local_symbols.
6825         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6826         from class declaration.
6827         * script.cc (read_input_script): Allocate Script_info; pass
6828         argument serial number to report_script.
6829         * script.h (class Script_info): Move to incremental.h.
6830         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6831         * symtab.h (Symbol_table::add_from_incrobj): New function.
6832         (Symbol_table::set_file_offset): New function.
6833
6834 2011-04-05  Cary Coutant  <ccoutant@google.com>
6835
6836         * incremental-dump.cc (dump_incremental_inputs): Change signature
6837         to take a Sized_incremental_binary; change caller.  Use readers
6838         in Sized_incremental_binary.
6839         * incremental.cc
6840         (Sized_incremental_binary::find_incremental_inputs_sections):
6841         Rename do_find_incremental_inputs_sections to this.
6842         (Sized_incremental_binary::setup_readers): New function.
6843         (Sized_incremental_binary::do_check_inputs): Check
6844         has_incremental_info_ flag; move setup code to setup_readers;
6845         use input readers.
6846         (Sized_incremental_binary::do_file_is_unchanged): New function.
6847         (Sized_incremental_binary::do_get_input_reader): New function.
6848         * incremental.h (class Incremental_binary): Move to end of file.
6849         (Incremental_binary::file_is_unchanged): New function.
6850         (Incremental_binary::do_file_is_unchanged): New function.
6851         (Incremental_binary::Input_reader): New class.
6852         (Incremental_binary::get_input_reader): New function.
6853         (class Sized_incremental_binary): Move to end of file.
6854         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6855         input section reader classes.
6856         (Sized_incremental_binary::has_incremental_info): New function.
6857         (Sized_incremental_binary::inputs_reader): New function.
6858         (Sized_incremental_binary::symtab_reader): New function.
6859         (Sized_incremental_binary::relocs_reader): New function.
6860         (Sized_incremental_binary::got_plt_reader): New function.
6861         (Sized_incremental_binary::do_file_is_unchanged): New function.
6862         (Sized_incremental_binary::Sized_input_reader): New class.
6863         (Sized_incremental_binary::get_input_reader): New function.
6864         (Sized_incremental_binary::find_incremental_inputs_sections):
6865         Rename do_find_incremental_inputs_sections to this.
6866         (Sized_incremental_binary::setup_readers): New function.
6867         (Sized_incremental_binary::has_incremental_info_): New data member.
6868         (Sized_incremental_binary::inputs_reader_): New data member.
6869         (Sized_incremental_binary::symtab_reader_): New data member.
6870         (Sized_incremental_binary::relocs_reader_): New data member.
6871         (Sized_incremental_binary::got_plt_reader_): New data member.
6872         (Sized_incremental_binary::current_input_file_): New data member.
6873
6874 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6875
6876         PR gold/12640
6877         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6878         violation.
6879
6880 2011-03-30  Cary Coutant  <ccoutant@google.com>
6881
6882         * archive.cc (Archive::include_member): Adjust call to report_object.
6883         (Add_archive_symbols::run): Add script_info to call to
6884         report_archive_begin.
6885         (Lib_group::include_member): Adjust call to report_object.
6886         (Add_lib_group_symbols::run): Adjust call to report_object.
6887         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6888         blocks.  Add object count for script input files.
6889         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6890         script_info parameter; change all callers.
6891         (Incremental_inputs::report_object): Add script_info parameter;
6892         change all callers.
6893         (Incremental_inputs::report_script): Store backpointer to
6894         incremental info entry.
6895         (Output_section_incremental_inputs::set_final_data_size): Record
6896         additional information for scripts.
6897         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6898         * incremental.h (Incremental_script_entry::add_object): New function.
6899         (Incremental_script_entry::get_object_count): New function.
6900         (Incremental_script_entry::get_object): New function.
6901         (Incremental_script_entry::objects_): New data member; adjust
6902         constructor.
6903         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6904         (Incremental_inputs::report_object): Add script_info parameter.
6905         (Incremental_inputs_reader::get_object_count): New function.
6906         (Incremental_inputs_reader::get_object_offset): New function.
6907         * options.cc (Input_arguments::add_file): Return reference to
6908         new input argument.
6909         * options.h (Input_argument::set_script_info): New function.
6910         (Input_argument::script_info): New function.
6911         (Input_argument::script_info_): New data member; adjust all
6912         constructors.
6913         (Input_file_group::add_file): Return reference to new input argument.
6914         (Input_file_lib::add_file): Likewise.
6915         (Input_arguments::add_file): Likewise.
6916         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6917         * script.cc (Parser_closure::Parser_closure): Add script_info
6918         parameter; adjust all callers.
6919         (Parser_closure::script_info): New function.
6920         (Parser_closure::script_info_): New data member.
6921         (read_input_script): Report scripts earlier to incremental info.
6922         (script_add_file): Set script_info in Input_argument.
6923         (script_add_library): Likewise.
6924         * script.h (Script_options::Script_info): Rewrite class.
6925
6926 2011-03-29  Cary Coutant  <ccoutant@google.com>
6927
6928         * archive.cc (Library_base::should_include_member): Move
6929         method here from class Archive.
6930         (Archive::Archive): Initialize base class.
6931         (Archive::should_include_member): Move to base class.
6932         (Archive::do_for_all_unused_symbols): New function.
6933         (Add_archive_symbols::run): Remove redundant access to
6934         incremental_inputs.
6935         (Lib_group::Lib_group): Initialize base class.
6936         (Lib_group::do_filename): New function.
6937         (Lib_group::include_member): Pass pointer to Lib_group to
6938         report_object.
6939         (Lib_group::do_for_all_unused_symbols): New function.
6940         (Add_lib_group_symbols::run): Report archive information for
6941         incremental links.
6942         * archive.h (class Library_base): New base class.
6943         (class Archive): Derive from Library_base.
6944         (Archive::filename): Move to base class.
6945         (Archive::set_incremental_info): Likewise.
6946         (Archive::incremental_info): Likewise.
6947         (Archive::Should_include): Likewise.
6948         (Archive::should_include_member): Likewise.
6949         (Archive::Armap_entry): Remove.
6950         (Archive::Unused_symbol_iterator): Remove.
6951         (Archive::unused_symbols_begin): Remove.
6952         (Archive::unused_symbols_end): Remove.
6953         (Archive::do_filename): New function.
6954         (Archive::do_get_mtime): New function.
6955         (Archive::do_for_all_unused_symbols): New function.
6956         (Archive::task_): Move to base class.
6957         (Archive::incremental_info_): Likewise.
6958         (class Lib_group): Derive from Library_base.
6959         (Lib_group::do_filename): New function.
6960         (Lib_group::do_get_mtime): New function.
6961         (Lib_group::do_for_all_unused_symbols): New function.
6962         (Lib_group::task_): Move to base class.
6963         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6964         function.
6965         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6966         function.
6967         * incremental.cc (Incremental_inputs::report_archive_begin):
6968         Use Library_base; call library's get_mtime; add incremental inputs
6969         entry before members.
6970         (class Unused_symbol_visitor): New class.
6971         (Incremental_inputs::report_archive_end): Use Library_base; use
6972         visitor class to record unused symbols; don't add incremental inputs
6973         entry after members.
6974         (Incremental_inputs::report_object): Use Library_base.
6975         * incremental.h
6976         (Incremental_archive_entry::Incremental_archive_entry): Remove
6977         unused Archive parameter.
6978         (Incremental_inputs::report_archive_begin): Use Library_base.
6979         (Incremental_inputs::report_archive_end): Likewise.
6980         (Incremental_inputs::report_object): Likewise.
6981         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6982         function.
6983         * object.h (Object::for_all_global_symbols): New function.
6984         (Object::do_for_all_global_symbols): New function.
6985         (Sized_relobj::do_for_all_global_symbols): New function.
6986         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6987         function.
6988         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6989         function.
6990
6991 2011-03-27  Ian Lance Taylor  <iant@google.com>
6992
6993         * archive.cc (Archive::interpret_header): Return -1 if something
6994         goes wrong.  Change callers accordingly.
6995
6996 2011-03-25  Cary Coutant  <ccoutant@google.com>
6997
6998         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6999         * testsuite/Makefile.in: Regenerate.
7000
7001 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7002
7003         * plugin.cc (get_view): New.
7004         (Plugin::load): Pass get_view to the plugin.
7005         (Plugin_manager::get_view): New.
7006
7007 2011-03-21  Ian Lance Taylor  <iant@google.com>
7008
7009         * testsuite/final_layout.sh: Rewrite to not use dc.
7010         * testsuite/relro_test.sh: Fail if dc is not present.
7011
7012 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7013
7014         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7015         Change == to -eq.
7016         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7017         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7018         Change == to -eq.
7019         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7020         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7021
7022 2011-03-14  Ian Lance Taylor  <iant@google.com>
7023
7024         * script-sections.cc (Sort_output_sections::script_compare):
7025         Rename from is_before, change return type.
7026         (Sort_output_sections::operator()): Adjust accordingly.
7027
7028 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7029
7030         PR gold/12572
7031         * testsuite/odr_violation2.cc: Add comment to make all error line
7032         numbers double digits.
7033         * testsuite/debug_msg.sh: Adjust expected errors.
7034
7035 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7036
7037         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7038         but mark earlier ones as non-canonical
7039         (offset_to_iterator): Update search target and example
7040         (do_addr2line): Return extra lines in a vector*
7041         (format_file_lineno): Extract from do_addr2line
7042         (one_addr2line): Add vector* out-param
7043         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7044         when a lineno entry appeared last for its instruction
7045         (Dwarf_line_info): Add vector* out-param
7046         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7047         * symtab.cc (Odr_violation_compare): Include the lineno in the
7048         comparison again.
7049         (linenos_from_loc): New. Combine the canonical line for an
7050         address with its other lines.
7051         (True_if_intersect): New. Helper functor to make
7052         std::set_intersection a query.
7053         (detect_odr_violations): Compare sets of lines instead of just
7054         one line for each function. This became less deterministic, but
7055         has fewer false positives.
7056         * symtab.h: Declarations.
7057         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7058         mix an optimized and non-optimized object in the same binary
7059         (odr_violation2.so): Same.
7060         * testsuite/Makefile.in: Regenerate from Makefile.am.
7061         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7062         * testsuite/debug_msg.sh: Update line numbers and add
7063         assertions.
7064         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7065         non-optimized context.
7066         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7067         isn't inlined, and use OdrDerived in an optimized context.
7068         * testsuite/odr_header1.h: Defines OdrDerived, where
7069         optimization will change the
7070         first-instruction-in-the-destructor's file and line number.
7071         * testsuite/odr_header2.h: Defines OdrBase.
7072
7073 2011-03-09  Ian Lance Taylor  <iant@google.com>
7074
7075         * fileread.cc (File_read::clear_views): Don't delete the whole
7076         file view.
7077
7078 2011-03-08  Ian Lance Taylor  <iant@google.com>
7079
7080         PR gold/12525
7081         * fileread.cc: #include <climits>.
7082         (GOLD_IOV_MAX): Define.
7083         (File_read::read_multiple): Limit number of entries by iov_max.
7084         * fileread.h (class File_read): Always set max_readv_entries to
7085         128.
7086
7087 2011-03-07  Ian Lance Taylor  <iant@google.com>
7088
7089         PR gold/12525
7090         * options.h (class General_options): Add -dy and -dn.
7091
7092 2011-03-02  Cary Coutant  <ccoutant@google.com>
7093
7094         * testsuite/script_test_9.t: Add TLS segment.
7095
7096 2011-03-02  Simon Baldwin  <simonb@google.com>
7097
7098         * configure.ac: Add check for gnu_indirect_function support in
7099         the toolchain building binutils.
7100         * configure: Rebuild.
7101
7102 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7103
7104         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7105         plugin only symbols.
7106         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7107         in plugin files as not needed in the symbol table.
7108
7109 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7110
7111         * output.cc (Output_section::add_input_section): Delay fill
7112         generation for section ordering.
7113
7114 2011-02-09  Ian Lance Taylor  <iant@google.com>
7115
7116         PR gold/12316
7117         * object.h (class Sized_relobj): Remove clear_local_symbols.
7118         * reloc.cc (Sized_relobj::do_relocate): Don't call
7119         clear_local_symbols.
7120
7121 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7122
7123         * plugin.cc (is_visible_from_outside): Return true for symbols
7124         in the -u option.
7125
7126 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7127
7128         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7129         filename.
7130
7131 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7132
7133         * icf.h (is_section_foldable_candidate): Change type of parameter
7134         to std::string.
7135         * icf.cc (Icf::find_identical_sections): Change type of local variable
7136         section_name to be std::string.
7137         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7138
7139 2011-01-25  Ian Lance Taylor  <iant@google.com>
7140
7141         * script.cc (script_add_extern): Rewrite to use
7142         add_symbol_reference.
7143
7144 2011-01-25  Doug Kwan  <dougkwan@google.com>
7145
7146         * icf.cc (get_section_contents): Always lock section's object.
7147
7148 2011-01-24  Ian Lance Taylor  <iant@google.com>
7149
7150         * options.h (class General_options): Accept
7151         --no-detect-odr-violations.
7152
7153 2011-01-24  Ian Lance Taylor  <iant@google.com>
7154
7155         * version.cc (version_string): Bump to 1.11.
7156
7157 2011-01-24  Ian Lance Taylor  <iant@google.com>
7158
7159         * plugin.cc (class Plugin_rescan): Define new class.
7160         (Plugin_manager::claim_file): Set any_claimed_.
7161         (Plugin_manager::save_archive): New function.
7162         (Plugin_manager::save_input_group): New function.
7163         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7164         necessary.
7165         (Plugin_manager::new_undefined_symbol): New function.
7166         (Plugin_manager::rescan): New function.
7167         (Plugin_manager::rescannable_defines): New function.
7168         (Plugin_manager::add_input_file): Set any_added_.
7169         * plugin.h (class Plugin_manager): define new fields rescannable_,
7170         undefined_symbols_, any_claimed_, and any_added_.  Declare
7171         Plugin_rescan as friend.  Declare new functions.
7172         (Plugin_manager::Rescannable): Define type.
7173         (Plugin_manager::Rescannable_list): Define type.
7174         (Plugin_manager::Undefined_symbol_list): Define type.
7175         (Plugin_manager::Plugin_manager): Initialize new fields.
7176         * archive.cc (Archive::defines_symbol): New function.
7177         (Add_archive_symbols::run): Pass archive to plugins if any.
7178         * archive.h (class Archive): Declare defines_symbol.
7179         * readsyms.cc (Input_group::~Input_group): New function.
7180         (Finish_group::run): Pass input_group to plugins if any.
7181         * readsyms.h (class Input_group): Declare destructor.
7182         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7183         any.
7184
7185 2011-01-10  Ian Lance Taylor  <iant@google.com>
7186
7187         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7188         section as relro.
7189         (Layout::set_segment_offsets): Reset increase_relro before calling
7190         set_section_addresses a second time.
7191
7192 2011-01-04  Cary Coutant  <ccoutant@google.com>
7193
7194         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7195         sections before NOBITS sections.
7196
7197 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7198
7199         * version.cc (print_version): Update copyright to 2011.
7200
7201 2010-12-23  Cary Coutant  <ccoutant@google.com>
7202
7203         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7204         of OS to this->add.  Add OD parameter to second form of the function.
7205
7206 2010-12-20  Ian Lance Taylor  <iant@google.com>
7207
7208         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7209         second of two consecutive entries with same offset.
7210
7211 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7212
7213         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7214         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7215         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7216         to avoid unneeded links against $(LDADD).
7217         * testsuite/Makefile.in: Regenerate.
7218
7219 2010-12-15  Ian Lance Taylor  <iant@google.com>
7220
7221         PR gold/12324
7222         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7223         for R_X86_64_32 and R_X86_64_PC32.
7224         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7225         ver_matching_def_pic.o.
7226         (ver_matching_def_pic.o): New target.
7227
7228 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7229
7230         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7231         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7232         Move definition before File_read::View member definitions.
7233         (File_read::View::~View): Initialize and hold lock before
7234         updating current_mapped_bytes.
7235
7236 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7237
7238         * dwarf_reader.cc: Remove outdated comment.
7239         * gold-threads.cc: Fix typo in error message.
7240         * archive.cc: Fix typos in comments.
7241         * archive.h: Likewise.
7242         * arm-reloc-property.cc: Likewise.
7243         * arm-reloc-property.h: Likewise.
7244         * arm-reloc.def: Likewise.
7245         * arm.cc: Likewise.
7246         * attributes.h: Likewise.
7247         * cref.cc: Likewise.
7248         * ehframe.cc: Likewise.
7249         * fileread.h: Likewise.
7250         * gold.h: Likewise.
7251         * i386.cc: Likewise.
7252         * icf.cc: Likewise.
7253         * incremental.h: Likewise.
7254         * int_encoding.cc: Likewise.
7255         * layout.h: Likewise.
7256         * main.cc: Likewise.
7257         * merge.h: Likewise.
7258         * object.cc: Likewise.
7259         * object.h: Likewise.
7260         * options.cc: Likewise.
7261         * readsyms.cc: Likewise.
7262         * reduced_debug_output.cc: Likewise.
7263         * reloc.cc: Likewise.
7264         * script-sections.cc: Likewise.
7265         * sparc.cc: Likewise.
7266         * symtab.h: Likewise.
7267         * target-reloc.h: Likewise.
7268         * target.cc: Likewise.
7269         * target.h: Likewise.
7270         * timer.cc: Likewise.
7271         * timer.h: Likewise.
7272         * x86_64.cc: Likewise.
7273
7274 2010-12-09  Cary Coutant  <ccoutant@google.com>
7275
7276         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7277         stack.
7278         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7279         parameter; change all callers.
7280         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7281         * options.h (warn_execstack): New option.
7282
7283 2010-12-07  Doug Kwan  <dougkwan@google.com>
7284
7285         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7286         like function call relocations.
7287
7288 2010-12-07  Ian Lance Taylor  <iant@google.com>
7289
7290         * archive.cc (Archive::get_elf_object_for_member): Permit
7291         punconfigured to be NULL.
7292         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7293         (Archive::include_member): Pass NULL to get_elf_object_for_member
7294         if we searched for the archive and this is the first included
7295         object.
7296
7297 2010-12-01  Ian Lance Taylor  <iant@google.com>
7298
7299         * dwarf_reader.h (class Sized_dwarf_line_info): Add
7300         track_relocs_type_ field.
7301         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7302         Set track_relocs_type_.
7303         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7304         contents when using RELA relocs.
7305         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7306         reloc_map_.
7307         * reloc.cc (Track_relocs::next_addend): New function.
7308         * reloc.h (class Track_relocs): Declare next_addend.
7309
7310 2010-12-01  Ian Lance Taylor  <iant@google.com>
7311
7312         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7313         virtual destructor.
7314
7315 2010-12-01  Ian Lance Taylor  <iant@google.com>
7316
7317         * README: Update compilers known to work and fail.
7318
7319 2010-11-23  Matthias Klose  <doko@ubuntu.com>
7320
7321         * configure.in: For --enable-gold, handle value `default' instead of
7322         `both*'.  Always install ld as ld.bfd, install as ld if gold is
7323         not the default.
7324         * configure: Regenerate.
7325
7326 2010-11-18  Doug Kwan  <dougkwan@google.com>
7327
7328         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7329         and right_alignment to be zero.  Store result alignment only if it is
7330         greater than existing alignment.
7331
7332 2010-11-16  Cary Coutant  <ccoutant@google.com>
7333
7334         PR gold/12220
7335         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7336         Check for ".zdebug_line".
7337
7338 2010-11-16  Doug Kwan  <dougkwan@google.com>
7339             Cary Coutant  <ccoutant@google.com>
7340
7341         * output.h (Output_segment::set_section_addresses): Pass increase_relro
7342         by reference; adjust all callers.
7343         * output.cc (Output_segment::set_section_addresses): Adjust references
7344         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7345         list is empty.
7346         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7347         end at page boundary.
7348
7349 2010-11-16  Cary Coutant  <ccoutant@google.com>
7350
7351         PR gold/12220
7352         * layout.cc (Layout::choose_output_section): Transform names of
7353         compressed sections even when using a script with a SECTIONS clause.
7354         (Layout::output_section_name): Remove code to transform
7355         compressed debug section names.
7356         * output.cc (Output_section::add_input_section): Use uncompressed
7357         section size when tracking input sections.
7358
7359 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
7360
7361         * symtab.h (Symbol::NON_PIC_REF): Remove.
7362         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7363         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
7364         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7365         (Symbol::use_plt_offset): Take a flags argument and pass it
7366         directly to needs_dynamic_reloc.  Restrict check for undefined
7367         weak symbols to function calls.
7368         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7369         (Target_arm::Scan::global): Use it.
7370         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7371         (Target_arm::Relocate::relocate): Likewise.
7372         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7373         parameter with an r_type parameter.  Use get_reference_flags
7374         to get the flags.
7375         (Target_arm::Relocate::relocate): Update accordingly.
7376         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7377         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7378         (Target_i386::Scan::global): Likewise.
7379         (Target_i386::Relocate::relocate): Likewise.
7380         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7381         parameter with an r_type parameter.  Use get_reference_flags
7382         to get the flags.
7383         (Target_i386::Relocate::relocate): Update accordingly.
7384         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7385         (Target_powerpc::Scan::global): Use it.
7386         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7387         (Target_powerpc::Relocate::relocate): Likewise.
7388         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7389         (Target_sparc::Scan::global): Use it.
7390         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7391         (Target_sparc::Relocate::relocate): Likewise.
7392         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7393         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7394         (Target_x86_64::Scan::global): Likewise.
7395         (Target_x86_64::Relocate::relocate): Likewise.
7396
7397 2010-11-08  Doug Kwan  <dougkwan@google.com>
7398             Cary Coutant  <ccoutant@google.com>
7399
7400         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7401         (Arm_exidx_merge_section::section_contents_): New data member.
7402         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7403         (Arm_input_section::~Arm_input_section): De-allocate memory.
7404         (Arm_input_section::original_contents_): New data member.
7405         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7406         in parameters instead of calling Object::section_contents without
7407         locking.
7408         (Arm_output_section::group_section): New parameter TASK.  Pass it
7409         to callees that need locking objects.
7410         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7411         to lock EXIDX input sections.  Fix a formatting issue.  Call
7412         Arm_exidx_merged_section::build_contents to create merged section
7413         contents.
7414         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7415         to lock object of stub table owner.
7416         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7417         TEXT_SIZE to initialize data member TEXT_SIZE_.
7418         (Arm_exidx_input_section::addralign): Fix typo in comment.
7419         (Arm_exidx_input_section::text_size): New method.
7420         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7421         that require locking objects.  Lock objects before scanning for stubs
7422         and updating local symbols.
7423         (Arm_input_section<big_endian>::init): Copy contents of original
7424         input section.
7425         (Arm_input_section<big_endian>::do_write): Use saved contents of
7426         original input section instead of calling Object::section_contents
7427         without locking.
7428         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7429         size without calling Object::section_size().
7430         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7431         for size.  Allocate a buffer for merged EXIDX entries.
7432         (Arm_exidx_merged_section::build_contents): New method.
7433         (Arm_exidx_merged_section::do_write): Move merge section contents
7434         building code to Arm_exidx_merged_section::build_contetns.  Write
7435         out contetns in buffer instead of building it on the fly.
7436         (Arm_relobj::make_exidx_input_section): Also pass text section size
7437         to Arm_exidx_input_section constructor.
7438         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7439         (Arm_dynobj::do_read_symbols): Fix memory leak.
7440         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7441         * target.h: (class Task): Add forward declaration.
7442         (Target::relax): Add new parameter TASK and pass it to
7443         Target::do_relax().
7444         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7445
7446 2010-11-05  Cary Coutant  <ccoutant@google.com>
7447
7448         PR gold/10708
7449         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7450         object when reading from the file.
7451         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7452         second layout pass.
7453         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7454         when reading section contents.
7455         (get_section_contents): Likewise.
7456         (icf::find_identical_sections): Likewise.
7457         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7458         object when reading from the file.
7459         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7460         the object when doing deferred section layout.
7461
7462 2010-11-03  Nick Clifton  <nickc@redhat.com>
7463
7464         PR gold/12001
7465         * script.h (class Symbol_assignment: name): New member.  Returns
7466         the name of the symbol.
7467         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7468         Returns true if the given symbol name is on the list of
7469         assignments wating to be processed.
7470         * archive.cc (should_incldue_member): If the symbol is undefined,
7471         check to see if it is on the list of symbols pending assignment.
7472
7473 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7474
7475         * script-sections.cc (Script_sections::find_memory_region): Check
7476         for a NULL output section pointer.
7477
7478 2010-10-29  Doug Kwan  <dougkwan@google.com>
7479
7480         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7481         Output_section::add_relaxed_input_section.
7482         * output.cc (Output_section::add_relaxed_input_section): Add new
7483         arguments LAYOUT and NAME.  Set section order index.
7484         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7485         Copy section order index.
7486         * output.h (Output_section::add_relaxed_input_section): Add new
7487         arguments LAYOUT and NAME.
7488
7489 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7490
7491         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7492         NATIVE_OR_CROSS_LINKER.
7493         * testsuite/Makefile.in: Regenerate.
7494
7495 2010-10-20  Doug Kwan  <dougkwan@google.com>
7496
7497         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7498         without SHF_LINK_ORDER flags.
7499         * layout.cc (Layout::choose_output_section): Do not filter
7500         SHF_LINK_ORDER flag in a relocatable link.
7501
7502 2010-10-17  Cary Coutant  <ccoutant@google.com>
7503
7504         * output.h (Output_segment::set_section_addresses): Change function
7505         signature.  Update all callers.
7506         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7507         sections.
7508         (Output_segment::set_section_addresses): Align after last TLS
7509         section.  Add padding before last relro section instead of after.
7510
7511 2010-10-17  Doug Kwan  <dougkwan@google.com>
7512
7513         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7514         GOT output section to be writable.
7515
7516 2010-10-14  Cary Coutant  <ccoutant@google.com>
7517
7518         * debug.h (DEBUG_INCREMENTAL): New flag.
7519         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7520         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7521         mode.
7522         * incremental.cc (report_command_line): Ignore all forms of
7523         --incremental.
7524         * layout.cc (Layout::Layout): Check parameters for incremental link
7525         mode.
7526         * options.cc (General_options::parse_incremental): New function.
7527         (General_options::parse_no_incremental): New function.
7528         (General_options::parse_incremental_full): New function.
7529         (General_options::parse_incremental_update): New function.
7530         (General_options::incremental_mode_): New data member.
7531         (General_options::finalize): Check incremental_mode_.
7532         * options.h (General_options): Update help text for --incremental.
7533         Add --no-incremental, --incremental-full, --incremental-update.
7534         (General_options::Incremental_mode): New enum type.
7535         (General_options::incremental_mode): New function.
7536         (General_options::incremental_mode_): New data member.
7537         * parameters.cc (Parameters::incremental_mode_): New data member.
7538         (Parameters::set_options): Set incremental_mode_.
7539         (Parameters::set_incremental_full): New function.
7540         (Parameters::incremental): New function.
7541         (Parameters::incremental_update): New function.
7542         (set_parameters_incremental_full): New function.
7543         * parameters.h (Parameters::set_incremental_full): New function.
7544         (Parameters::incremental): New function.
7545         (Parameters::incremental_update): New function.
7546         (Parameters::incremental_mode_): New data member.
7547         (set_parameters_incremental_full): New function.
7548         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7549         incremental link mode.
7550         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7551         (Sized_relobj::do_relocate_sections): Likewise.
7552         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7553         option.
7554         * testsuite/Makefile.in: Regenerate.
7555         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7556
7557 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7558
7559         * script-sections.h (class Script_sections): Make
7560         Sections_elements typedef public.
7561         * script-sections.cc (class Sort_output_sections): Add elements_
7562         field.  Add constructor which sets it; change all callers.
7563         (Sort_output_sections::is_before): New function.
7564         (Sort_output_sections::operator()): Call is_before.
7565         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7566         conditional.
7567         * testsuite/script_test_10.sh: New test. Test script section
7568         order.
7569         * testsuite/script_test_10.t: Likewise.
7570         * testsuite/script_test_10.s: Likewise.
7571         * testsuite/Makefile.am: Wrap the cross linker tests and the
7572         common tests into NATIVE_OR_CROSS_LINKER.
7573         (check_SCRIPTS): Add script_test_10.sh.
7574         (check_DATA): Add script_test_10.stdout.
7575         (script_test_10.o, script_test_10): New targets.
7576         (script_test_10.stdout): New target.
7577         * configure, testsuite/Makefile.in: Regenerate.
7578
7579 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7580
7581         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7582         error for the deprecated relocations.
7583         (Target_arm::Scan::global): Likewise.
7584         (Target_arm::Relocate::relocate): Likewise.
7585
7586 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7587
7588         * fileread.cc (Input_file::find_file): Initialize *found_name
7589         and *namep when using the fallback search for case 4.
7590
7591 2010-10-11  Cary Coutant  <ccoutant@google.com>
7592
7593         * options.h (class General_options): Redefine -z lazy as an alias for
7594         the negation of -z now.
7595
7596 2010-10-11  Ian Lance Taylor  <iant@google.com>
7597
7598         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7599         binding.
7600
7601 2010-10-06  Nick Clifton  <nickc@redhat.com>
7602
7603         * script-sections.cc(class Memory_region): Remove
7604         current_lma_offset_ field.  Rename current_vma_offset_ to
7605         current_offset_.  Add last_section_ field.
7606         (Memory_region::get_current_vma_address): Rename to
7607         get_current_address.
7608         (Memory_region::get_current_lma_address): Delete.
7609         (Memory_region::increment_vma_offset): Rename to
7610         increment_offset.
7611         (Memory_region::increment_lma_offset): Delete.
7612         (Memory_region::attributes_compatible): New method.  Returns
7613         true if the provided section is compatible with the region.
7614         (Memory_region::get_last_section): New method.  Returns the last
7615         section to use the region.
7616         (Memory_region::set_last_section): New method.  Stores the last
7617         section to use the region.
7618         (Script_sections::block_in_region): New method.  Returns true if
7619         a block of memory is contained within a region.
7620         (Script_sections::find_memory_region): New method.  Locates a
7621         memory region to be used to set a VMA or LMA address.
7622         (Output_section_definition::set_section_addresses): Add code to
7623         check for addresses set by memory regions.
7624         (Output_segment::set_section_addresses): Remove memory region
7625         walking code.
7626         (Script_sections::create_segment): Add a warning if a header
7627         segment is created outside of any region.
7628         * script-sections.h (class Script_sections): Add prototypes for
7629         find_memory_region and block_in_region methods.
7630         * testsuite/memory_test.s: Use .long instead of .word.
7631         * testsuite/memory_test.t: Add some more output sections.
7632         * testsuite/memory_test.sh: Update expected output.
7633
7634 2010-10-02  Doug Kwan  <dougkwan@google.com>
7635
7636         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7637         defintion to symtab.h
7638         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7639         declaration to defintion.
7640
7641 2010-10-01  Nick Clifton  <nickc@redhat.com>
7642
7643         * expression.cc (eval): Replace dummy argument with NULL.
7644         (eval_maybe_dot): Check for a NULL result section pointer.
7645         (Symbol_expression::value): Likewise.
7646         (Dot_expression::value): Likewise.
7647         (BINARY_EXPRESSION): Likewise.
7648         (Max_expression::value): Likewise.
7649         (Min_expression::value): Likewise.
7650         (Absolute_expression::value): Likewise.
7651         (Addr_expression::value_from_output_section): Likewise.
7652         (Loaddddr_expression::value_from_output_section): Likewise.
7653         (Segment_start_expression::value): Likewise.
7654         * script-sections.cc
7655         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7656         argument with NULL.
7657         (Sections_elememt_dot_assignment::set_section_addresses):
7658         Likewise.
7659         (Output_data_expression::do_write_to_buffer): Likewise.
7660         (Output_section_definition::finalize_symbols): Likewise.
7661         (Output_section_definition::set_section_addresses): Likewise.
7662
7663 2010-09-30  Doug Kwan  <dougkwan@google.com>
7664
7665         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7666
7667 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7668
7669         * target.h (Target::can_icf_inline_merge_sections): New virtual
7670         function.
7671         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7672         virtual function.
7673         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7674         virtual function.
7675         * icf.cc (get_section_contents): Inline merge sections only when
7676         target allows it.
7677
7678 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7679
7680         * configure: Regenerate.
7681
7682 2010-09-17  Ian Lance Taylor  <iant@google.com>
7683
7684         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7685         * testsuite/Makefile.am (memory_test.o): New target.
7686         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7687         memory_test.t.
7688         * testsuite/Makefile.in: Rebuild.
7689
7690 2010-09-17  Doug Kwan  <dougkwan@google.com>
7691
7692         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7693         defintion if relocation uses GOT entries of the symbol.
7694         * testsuite/icf_safe_test.sh: Fix test.
7695         * testsuite/icf_safe_so_test.sh: Fix test.
7696
7697 2010-09-16  Cary Coutant  <ccoutant@google.com>
7698
7699         * script_sections.cc (class Memory_region): Remove "NULL" from
7700         vector initializations.
7701
7702 2010-09-15  Cary Coutant  <ccoutant@google.com>
7703
7704         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7705         Resolve forwarding symbols.
7706
7707 2010-09-15  Doug Kwan  <dougkwan@google.com>
7708
7709         * gold/testsuite/script_test_3.t: Add ARM special sections.
7710         * gold/testsuite/script_test_4.t: Same.
7711         * gold/testsuite/script_test_5.t: Same.
7712         * gold/testsuite/script_test_6.t: Same.
7713         * gold/testsuite/script_test_7.t: Same.
7714         * gold/testsuite/script_test_7.t: Same.
7715         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7716
7717 2010-09-14  Cary Coutant  <ccoutant@google.com>
7718
7719         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7720         (Target_x86_64::Relocate::relocate_tls): Replace check for
7721         saw_tls_block_reloc_ with test for executable section.
7722
7723 2010-09-12  Cary Coutant  <ccoutant@google.com>
7724
7725         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7726         position-independent executables to shared libraries need dynamic
7727         relocations.
7728         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7729         position-independent executables.
7730         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7731         * testsuite/Makefile.in: Regenerate.
7732
7733 2010-09-10  Nick Clifton  <nickc@redhat.com>
7734
7735         PR gold/11997
7736         * testsuite/memory_test.t: Discard any sections that are not
7737         needed.
7738
7739 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7740
7741         PR gold/11996
7742         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7743         "This::" to work around a bug in gcc 4.2.
7744
7745         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7746
7747 2010-09-09  Rafael Espindola  <espindola@google.com>
7748
7749         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7750         sections with different PF_X flags in the same segment.
7751         (Layout::find_first_load_seg): Search all segments to find the first
7752         one.
7753         * options.h (rosegment): New.
7754
7755 2010-09-08  Rafael Espindola  <espindola@google.com>
7756
7757         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7758
7759 2010-09-08  Doug Kwan  <dougkwan@google.com>
7760
7761         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7762         (Arm_relobj::do_relocate_sections): Add new parameter for output
7763         file to match the parent.
7764         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7765         of local symbols instead of input values.  Update code to track
7766         changes in gold::relocate_section.
7767         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7768         (Sized_relobj::compute_final_local_value_internal): New methods.
7769         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7770         body into private version of Sized_relobj::compute_final_local_value.
7771         Call the inline method.
7772         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7773         merged symbol value if there is one.
7774         (Symbol_value::has_output_value): New method defintiion.
7775         (Sized_relobj::Compute_final_local_value_status): New enum type.
7776         (Sized_relobj::compute_final_local_value): New methods.
7777         (Sized_relobj::compute_final_local_value_internal): New methods.
7778         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7779         and arm_cortex_a8.sh.
7780         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7781         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7782         New tests.
7783         * Makefile.in: Regenerate.
7784         * testsuite/arm_bl_out_of_range.s: Update test.
7785         * testsuite/thumb_bl_out_of_range.s: Ditto.
7786         * testsuite/thumb_blx_out_of_range.s: Ditto.
7787         * testsuite/arm_branch_out_of_range.sh: New file.
7788         * testsuite/arm_cortex_a8.sh: Ditto.
7789         * testsuite/arm_cortex_a8_b.s: Ditto.
7790         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7791         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7792         * testsuite/arm_cortex_a8_bl.s: Ditto.
7793         * testsuite/arm_cortex_a8_blx.s: Ditto.
7794         * testsuite/arm_cortex_a8_local.s: Ditto.
7795         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7796         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7797
7798 2010-09-08  Rafael Espindola  <espindola@google.com>
7799
7800         * Makefile.am (memory_test.stdout): Run readelf with -W.
7801         * Makefile.in: Regenerate.
7802         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7803         64 bit output.
7804
7805 2010-09-08  Rafael Espindola  <espindola@google.com>
7806
7807         * script-sections.cc (Script_sections::add_memory_region): Convert
7808         field precision to int.
7809         * script.cc (script_set_section_region, script_set_section_region):
7810         Convert field precision to int.
7811
7812 2010-09-08  Rafael Espindola  <espindola@google.com>
7813
7814         * arm.cc (do_finalize_sections): Create the __exidx_start and
7815         __exdix_end symbols even when the section is missing.
7816
7817 2010-09-08  Nick Clifton  <nickc@redhat.com>
7818
7819         * README: Remove claim that MEMORY is not supported.
7820         * expression.cc (script_exp_function_origin)
7821         (script_exp_function_length): Move from here to ...
7822         * script.cc: ... here.
7823         (script_set_section_region, script_add_memory)
7824         (script_parse_memory_attr, script_include_directive): New
7825         functions.
7826         * script-sections.cc
7827         (class Memory_region): New class.
7828         (class Output_section_definition): Add set_memory_region,
7829         set_section_vma, set_section_lma and get_section_name methods.
7830         (class Script_Sections): Add add_memory_region,
7831         find_memory_region, find_memory_region_origin,
7832         find_memory_region_length and set_memory_region methods.
7833         Have set_section_addresses method walk the list of set memory
7834         regions.
7835         Extend the print methos to display memory regions.
7836         * script-sections.h: Add prototypes for new methods.
7837         Add enum for MEMORY region attributes.
7838         * yyscript.y: Add support for parsing MEMORY regions.
7839         * script-c.h: Add prototypes for new functions.
7840         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7841         * testsuite/Makefile.in: Regenerate.
7842         * testsuite/memory_test.sh: New script.
7843         * testsuite/memory_test.s: New assembler source file.
7844         * testsuite/memory_test.t: New linker script.
7845
7846 2010-08-27  Doug Kwan  <dougkwan@google.com>
7847
7848         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7849         reference override an existing dynamic weak reference.
7850         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7851         * testsuite/Makefile.in: Regenerate.
7852         * testsuite/dyn_weak_ref.sh: New file.
7853         * testsuite/dyn_weak_ref_1.c: Ditto.
7854         * testsuite/dyn_weak_ref_2.c: Ditto.
7855
7856 2010-08-27  Ian Lance Taylor  <iant@google.com>
7857
7858         * incremental.h (class Incremental_input_entry): Add virtual
7859         destructor.
7860
7861 2010-08-27  Ian Lance Taylor  <iant@google.com>
7862
7863         * testsuite/start_lib_test_3.c: Mark t3 as used.
7864
7865 2010-08-27  Nick Clifton  <nickc@redhat.com>
7866
7867         * options.cc (version_script): Fix small typo in previous
7868         whitespace tidyup.
7869
7870 2010-08-25  Nick Clifton  <nickc@redhat.com>
7871
7872         * archive.cc: Formatting fixes: Remove whitespace between
7873         typename and following asterisk.  Remove whitespace between
7874         function name and opening parenthesis.
7875         * archive.h: Likewise.
7876         * arm.cc: Likewise.
7877         * attributes.cc: Likewise.
7878         * attributes.h: Likewise.
7879         * common.cc: Likewise.
7880         * copy-relocs.cc: Likewise.
7881         * dirsearch.h: Likewise.
7882         * dynobj.cc: Likewise.
7883         * ehframe.cc: Likewise.
7884         * ehframe.h: Likewise.
7885         * expression.cc: Likewise.
7886         * fileread.cc: Likewise.
7887         * fileread.h: Likewise.
7888         * gc.h: Likewise.
7889         * gold-threads.cc: Likewise.
7890         * gold.cc: Likewise.
7891         * i386.cc: Likewise.
7892         * icf.h: Likewise.
7893         * incremental-dump.cc: Likewise.
7894         * incremental.cc: Likewise.
7895         * layout.cc: Likewise.
7896         * layout.h: Likewise.
7897         * main.cc: Likewise.
7898         * merge.cc: Likewise.
7899         * merge.h: Likewise.
7900         * object.cc: Likewise.
7901         * object.h: Likewise.
7902         * options.cc: Likewise.
7903         * options.h: Likewise.
7904         * output.cc: Likewise.
7905         * output.h: Likewise.
7906         * plugin.cc: Likewise.
7907         * plugin.h: Likewise.
7908         * powerpc.cc: Likewise.
7909         * reloc.cc: Likewise.
7910         * script-c.h: Likewise.
7911         * script-sections.cc: Likewise.
7912         * script.cc: Likewise.
7913         * stringpool.cc: Likewise.
7914         * symtab.cc: Likewise.
7915         * symtab.h: Likewise.
7916         * target.cc: Likewise.
7917         * timer.cc: Likewise.
7918         * timer.h: Likewise.
7919         * version.cc: Likewise.
7920         * x86_64.cc: Likewise.
7921
7922 2010-08-24  Nick Clifton  <nickc@redhat.com>
7923
7924         PR 11899
7925         * layout.cc (segment_precedes): Sort segments by their physical
7926         addresses, if they have been set.
7927
7928 2010-08-23  Cary Coutant  <ccoutant@google.com>
7929
7930         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7931         symbols data.
7932         (Lib_group::include_member): Unlock object after deleting its
7933         symbols data.
7934         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7935         the bug fixed here.
7936
7937 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7938             Cary Coutant  <ccoutant@google.com>
7939
7940         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7941         constructor, and set_blocker.
7942         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7943         readsyms_blocker_.
7944         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7945         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7946         * testsuite/Makefile.am (start_lib_test): New test case.
7947         * testsuite/Makefile.in: Regenerate.
7948         * testsuite/start_lib_test_main.c: New file.
7949         * testsuite/start_lib_test_1.c: New file.
7950         * testsuite/start_lib_test_2.c: New file.
7951         * testsuite/start_lib_test_3.c: New file.
7952
7953 2010-08-19  Ian Lance Taylor  <iant@google.com>
7954
7955         * Makefile.in: Rebuild with automake 1.11.1.
7956         * aclocal.m4: Likewise.
7957         * testsuite/Makefile.in: Likewise.
7958
7959 2010-08-19  Ian Lance Taylor  <iant@google.com>
7960
7961         PR 10893
7962         * i386.cc (class Output_data_plt_i386): Update declarations.
7963         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7964         local_ifuncs_ fields.
7965         (Target_i386::do_plt_section_for_global): New function.
7966         (Target_i386::do_plt_section_for_local): New function.
7967         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7968         parameter; change all callers.  Initialize global_ifuncs_ and
7969         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7970         __rel_iplt_end.
7971         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7972         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7973         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7974         symbols.
7975         (Target_i386::make_plt_section): New function, broken out of
7976         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7977         (Target_i386::make_plt_entry): Call make_plt_section.
7978         (Target_i386::make_local_ifunc_plt_entry): New function.
7979         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7980         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7981         R_386_IRELATIVE to switch.
7982         (Target_i386::Scan::global): Likewise.
7983         (Target_i386::Relocate::relocate): Likewise.
7984         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7985         switch.
7986         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7987         (Target_x86_64::do_plt_section_for_global): New function.
7988         (Target_x86_64::do_plt_section_for_local): New function.
7989         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7990         parameter; change all callers.  If doing a static link define
7991         __rela_iplt_start and __rela_iplt_end.
7992         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7993         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7994         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7995         to point to .plt.
7996         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7997         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7998         switch.
7999         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8000         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8001         R_X86_64_IRELATIVE to switch.
8002         (Target_x86_64::Scan::global): Likewise.
8003         (Target_x86_64::Relocate::relocate): Likewise.
8004         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8005         switch.
8006         * target.h (class Target): Add plt_section_for_global and
8007         plt_section_for_local functions.  Add do_plt_section_for_global
8008         and do_plt_section_for_local virtual functions.
8009         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8010         clarifying comments.
8011         (Symbol::use_plt_offset): Handle IFUNC symbol.
8012         * object.cc (Sized_relobj::Sized_relobj): Initialize
8013         local_plt_offsets_.
8014         (Sized_relobj::local_has_plt_offset): New function.
8015         (Sized_relobj::local_plt_offset): New function.
8016         (Sized_relobj::set_local_plt_offset): New function.
8017         (Sized_relobj::do_count): Handle IFUNC symbol.
8018         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8019         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8020         is_ifunc_symbol functions.
8021         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8022         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8023         local_plt_offsets_ field.
8024         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8025         * output.h (class Output_section_data): Add non-const
8026         output_section function.
8027         (class Output_data_got): Update declarations.
8028         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8029         Add use_plt_offset parameter to global and local constructors.
8030         Change all callers.  Change local_sym_index_ field to 31 bits.
8031         Change GSYM_CODE and CONSTANT_CODE accordingly.
8032         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8033         doing a static link don't set sh_link field.
8034         (Output_data_got::Got_entry::write): Use PLT offset if
8035         appropriate.
8036         (Output_data_got::add_global_plt): New function.
8037         (Output_data_got::add_local_plt): New function.
8038         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8039         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8040         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8041         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8042         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8043         IFUNC conditional.
8044         * testsuite/ifunc-sel.h: New file.
8045         * testsuite/ifuncmain1.c: New file.
8046         * testsuite/ifuncmain1vis.c: New file.
8047         * testsuite/ifuncmod1.c: New file.
8048         * testsuite/ifuncdep2.c: New file.
8049         * testsuite/ifuncmain2.c: New file.
8050         * testsuite/ifuncmain3.c: New file.
8051         * testsuite/ifuncmod3.c: New file.
8052         * testsuite/ifuncmain4.c: New file.
8053         * testsuite/ifuncmain5.c: New file.
8054         * testsuite/ifuncmod5.c: New file.
8055         * testsuite/ifuncmain6pie.c: New file.
8056         * testsuite/ifuncmod6.c: New file.
8057         * testsuite/ifuncmain7.c: New file.
8058         * configure, testsuite/Makefile.in: Rebuild.
8059
8060 2010-08-18  Ian Lance Taylor  <iant@google.com>
8061
8062         * incremental.cc
8063         (Output_section_incremental_inputs::write_input_files): Add cast
8064         to avoid signed/unsigned comparison warning.
8065         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8066
8067 2010-08-12  Cary Coutant  <ccoutant@google.com>
8068
8069         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8070
8071 2010-08-13  Ian Lance Taylor  <iant@google.com>
8072
8073         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8074
8075 2010-08-12  Cary Coutant  <ccoutant@google.com>
8076             Doug Kwan  <dougkwan@google.com>
8077
8078         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8079         defintion overrides non-weak undef, remember that the original undef
8080         is not weak.
8081         * symtab.cc (Symbol_table::sized_write_global): For undef without
8082         an original weak binding, set binding to global in output.
8083         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8084         * testsuite/Makefile.in: Regenerate.
8085         * testsuite/strong_ref_weak_def.sh: New file.
8086         * testsuite/strong_ref_weak_def_1.c: Ditto.
8087         * testsuite/strong_ref_weak_def_2.c: Ditto.
8088
8089 2010-08-12  Cary Coutant  <ccoutant@google.com>
8090
8091         * testsuite/incremental_test.sh: Rewrite.
8092         * testsuite/incremental_test_1.c: Rewrite.
8093         * testsuite/incremental_test_2.c: Rewrite.
8094
8095 2010-08-12  Cary Coutant  <ccoutant@google.com>
8096
8097         * arm.cc (Target_arm::got_size): Add const.
8098         (Target_arm::got_entry_count): New function.
8099         (Target_arm::plt_entry_count): New function.
8100         (Target_arm::first_plt_entry_offset): New function.
8101         (Target_arm::plt_entry_size): New function.
8102         (Output_data_plt_arm::entry_count): New function.
8103         (Output_data_plt_arm::first_plt_entry_offset): New function.
8104         (Output_data_plt_arm::get_plt_entry_size): New function.
8105         * i386.cc (Target_i386::got_size): Add const.
8106         (Target_i386::got_entry_count): New function.
8107         (Target_i386::plt_entry_count): New function.
8108         (Target_i386::first_plt_entry_offset): New function.
8109         (Target_i386::plt_entry_size): New function.
8110         (Output_data_plt_i386::entry_count): New function.
8111         (Output_data_plt_i386::first_plt_entry_offset): New function.
8112         (Output_data_plt_i386::get_plt_entry_size): New function.
8113         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8114         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8115         * incremental.cc: Include target.h.
8116         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8117         parameter.  Adjust all callers.  Find incremental_got_plt section.
8118         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8119         section.
8120         (Output_section_incremental_inputs::set_final_data_size): Calculate
8121         size of incremental_got_plt section.
8122         (Output_section_incremental_inputs::do_write): Write the
8123         incremental_got_plt section.
8124         (Got_plt_view_info): New struct.
8125         (Local_got_offset_visitor): New class.
8126         (Global_got_offset_visitor): New class.
8127         (Global_symbol_visitor_got_plt): New class.
8128         (Output_section_incremental_inputs::write_got_plt): New function.
8129         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8130         Add parameter.  Adjust all callers.
8131         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8132         (Incremental_inputs::got_plt_section): New function.
8133         (Incremental_inputs::got_plt_section_): New data member.
8134         (Incremental_got_plt_reader): New class.
8135         * layout.cc (Layout::create_incremental_info_sections): Add the
8136         incremental_got_plt section.
8137         * object.h (Got_offset_list::get_list): New function.
8138         (Got offset_list::for_all_got_offsets): New function.
8139         (Sized_relobj::local_got_offset_list): New function.
8140         * powerpc.cc (Target_powerpc::got_size): Add const.
8141         (Target_powerpc::got_entry_count): New function.
8142         (Target_powerpc::plt_entry_count): New function.
8143         (Target_powerpc::first_plt_entry_offset): New function.
8144         (Target_powerpc::plt_entry_size): New function.
8145         (Output_data_plt_powerpc::entry_count): New function.
8146         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8147         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8148         * sparc.cc (Target_sparc::got_size): Add const.
8149         (Target_sparc::got_entry_count): New function.
8150         (Target_sparc::plt_entry_count): New function.
8151         (Target_sparc::first_plt_entry_offset): New function.
8152         (Target_sparc::plt_entry_size): New function.
8153         (Output_data_plt_sparc::entry_count): New function.
8154         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8155         (Output_data_plt_sparc::get_plt_entry_size): New function.
8156         * symtab.h (Symbol::got_offset_list): New function.
8157         (Symbol_table::for_all_symbols): New function.
8158         * target.h (Sized_target::got_entry_count): New function.
8159         (Sized_target::plt_entry_count): New function.
8160         (Sized_target::plt_entry_size): New function.
8161         * x86_64.cc (Target_x86_64::got_size): Add const.
8162         (Target_x86_64::got_entry_count): New function.
8163         (Target_x86_64::plt_entry_count): New function.
8164         (Target_x86_64::first_plt_entry_offset): New function.
8165         (Target_x86_64::plt_entry_size): New function.
8166         (Output_data_plt_x86_64::entry_count): New function.
8167         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8168         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8169
8170 2010-08-12  Cary Coutant  <ccoutant@google.com>
8171
8172         * archive.cc: Include incremental.h.
8173         (Archive::Archive): Initialize incremental_info_.
8174         (Archive::include_member): Record archive members in incremental info.
8175         (Add_archive_symbols::run): Record begin and end of an archive in
8176         incremental info.
8177         (Lib_group::include_member): Record objects in incremental info.
8178         * archive.h (Incremental_archive_entry): Forward declaration.
8179         (Archive::set_incremental_info): New member function.
8180         (Archive::incremental_info): New member function.
8181         (Archive::Unused_symbol_iterator): New class.
8182         (Archive::unused_symbols_begin): New member function.
8183         (Archive::unused_symbols_end): New member function.
8184         (Archive::incremental_info_): New data member.
8185         * incremental-dump.cc (find_input_containing_global): New function.
8186         (dump_incremental_inputs): Dump new incremental info sections.
8187         * incremental.cc: Include symtab.h.
8188         (Output_section_incremental_inputs): New class.
8189         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8190         new incremental info sections.
8191         (Sized_incremental_binary::do_check_inputs): Likewise.
8192         (Incremental_inputs::report_archive): Remove.
8193         (Incremental_inputs::report_archive_begin): New function.
8194         (Incremental_inputs::report_archive_end): New function.
8195         (Incremental_inputs::report_object): New function.
8196         (Incremental_inputs::finalize_inputs): Remove.
8197         (Incremental_inputs::report_input_section): New function.
8198         (Incremental_inputs::report_script): Rewrite.
8199         (Incremental_inputs::finalize): Do nothing but finalize string table.
8200         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8201         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8202         (Incremental_inputs::create_data_sections): New function.
8203         (Incremental_inputs::relocs_entsize): New function.
8204         (Output_section_incremental_inputs::set_final_data_size): New function.
8205         (Output_section_incremental_inputs::do_write): New function.
8206         (Output_section_incremental_inputs::write_header): New function.
8207         (Output_section_incremental_inputs::write_input_files): New function.
8208         (Output_section_incremental_inputs::write_info_blocks): New function.
8209         (Output_section_incremental_inputs::write_symtab): New function.
8210         * incremental.h (Incremental_script_entry): Forward declaration.
8211         (Incremental_object_entry): Forward declaration.
8212         (Incremental_archive_entry): Forward declaration.
8213         (Incremental_inputs): Forward declaration.
8214         (Incremental_inputs_header_data): Remove.
8215         (Incremental_inputs_header): Remove.
8216         (Incremental_inputs_header_write): Remove.
8217         (Incremental_inputs_entry_data): Remove.
8218         (Incremental_inputs_entry): Remove.
8219         (Incremental_inputs_entry_write): Remove.
8220         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8221         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8222         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8223         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8224         Likewise.
8225         (Incremental_input_entry): New class.
8226         (Incremental_script_entry): New class.
8227         (Incremental_object_entry): New class.
8228         (Incremental_archive_entry): New class.
8229         (Incremental_inputs::Incremental_inputs): Initialize new data members.
8230         (Incremental_inputs::report_inputs): Remove.
8231         (Incremental_inputs::report_archive): Remove.
8232         (Incremental_inputs::report_archive_begin): New function.
8233         (Incremental_inputs::report_archive_end): New function.
8234         (Incremental_inputs::report_object): Change prototype.
8235         (Incremental_inputs::report_input_section): New function.
8236         (Incremental_inputs::report_script): Change prototype.
8237         (Incremental_inputs::get_reloc_count): New function.
8238         (Incremental_inputs::set_reloc_count): New function.
8239         (Incremental_inputs::create_data_sections): New function.
8240         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8241         (Incremental_inputs::inputs_section): New function.
8242         (Incremental_inputs::symtab_section): New function.
8243         (Incremental_inputs::relocs_section): New function.
8244         (Incremental_inputs::get_stringpool): Add const.
8245         (Incremental_inputs::command_line): Add const.
8246         (Incremental_inputs::inputs): Remove.
8247         (Incremental_inputs::command_line_key): New function.
8248         (Incremental_inputs::input_file_count): New function.
8249         (Incremental_inputs::input_files): New function.
8250         (Incremental_inputs::relocs_entsize): New function.
8251         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8252         (Incremental_inputs::finalize_inputs): Remove.
8253         (Incremental_inputs::Input_info): Remove.
8254         (Incremental_inputs::lock_): Remove.
8255         (Incremental_inputs::inputs_): Change type.
8256         (Incremental_inputs::inputs_map_): Remove.
8257         (Incremental_inputs::current_object_entry_): New data member.
8258         (Incremental_inputs::inputs_section_): New data member.
8259         (Incremental_inputs::symtab_section_): New data member.
8260         (Incremental_inputs::relocs_section_): New data member.
8261         (Incremental_inputs::reloc_count_): New data member.
8262         (Incremental_inputs_reader): New class.
8263         (Incremental_symtab_reader): New class.
8264         (Incremental_relocs_reader): New class.
8265         * layout.cc (Layout::finalize): Move finalization of incremental info
8266         and creation of incremental info sections to follow finalization of
8267         symbol table.  Set offsets for postprocessing sections.
8268         (Layout::create_incremental_info_sections): Call
8269         Incremental_inputs::create_data_sections.  Add incremental symtab
8270         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
8271         sections to layout after input sections.
8272         * layout.h (struct Timespec): Forward declaration.
8273         (Layout::incremental_inputs): Add const.
8274         (Layout::create_incremental_info_sections): Add parameter.
8275         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8276         * object.cc: Include incremental.h.
8277         (Relobj::finalize_incremental_relocs): New function.
8278         (Sized_relobj::do_layout): Record input sections in incremental info.
8279         * object.h (Object::output_section): New function.
8280         (Object::output_section_offset): Moved from Relobj.
8281         (Object::get_incremental_reloc_base): New function.
8282         (Object::get_incremental_reloc_count): New function.
8283         (Object::do_output_section): New function.
8284         (Object::do_output_section_offset): Moved from Relobj.
8285         (Object::do_get_incremental_reloc_base): New function.
8286         (Object::do_get_incremental_reloc_count): New function.
8287         (Object::Object): Initialize new data members.
8288         (Relobj::output_section): Renamed do_output_section and moved to
8289         protected.
8290         (Relobj::output_section_offset): Moved to Object.
8291         (Relobj::do_get_incremental_reloc_base): New function.
8292         (Relobj::do_get_incremental_reloc_count): New function.
8293         (Relobj::allocate_incremental_reloc_counts): New function.
8294         (Relobj::count_incremental_reloc): New function.
8295         (Relobj::finalize_incremental_relocs): New function.
8296         (Relobj::next_incremental_reloc_index): New function.
8297         (Relobj::reloc_counts_): New data member.
8298         (Relobj::reloc_bases_): New data member.
8299         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
8300         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
8301         (Sized_relobj::incremental_relocs_scan): New function.
8302         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8303         (Sized_relobj::incremental_relocs_write): New function.
8304         (Sized_relobj::incremental_relocs_write_reltype): New function.
8305         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8306         incremental link.
8307         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8308         archives and object files elsewhere.
8309         (Add_symbols::run): Report object files here.
8310         (Finish_group::run): Report end of archive at end of group.
8311         * reloc.cc: Include layout.h, incremental.h.
8312         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8313         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8314         (Sized_relobj::incremental_relocs_scan): New function.
8315         (Sized_relobj::incremental_relocs_scan_reltype): New function.
8316         (Sized_relobj::do_relocate_sections): Write incremental relocations.
8317         (Sized_relobj::incremental_relocs_write): New function.
8318         (Sized_relobj::incremental_relocs_write_reltype): New function.
8319         * script.cc (read_input_script): Rewrite test for incremental link.
8320         Change call to Incremental_inputs::report_script.
8321         * symtab.h (Symbol_table::first_global_index): New function.
8322         (Symbol_table::output_count): New function.
8323
8324 2010-08-12  Doug Kwan  <dougkwan@google.com>
8325
8326         * arm.cc (Target_arm::merge_object_attributes): Check command line
8327         options --no-wchar-size-warning and --no-enum-size-warning.
8328         * options.h (General_options): Add ld-compatible options
8329         --no-enum-size-warning and --no-wchar-size-warning.
8330
8331 2010-08-04  Ian Lance Taylor  <iant@google.com>
8332
8333         * x86_64.cc (Target_x86_64::Scan::local): Use
8334         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8335         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8336         (Target_x86_64::Scan::global): Likewise.
8337         (Target_x86_64::Relocate::relocate): Likewise.
8338         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8339         Likewise.
8340
8341 2010-08-03  Cary Coutant  <ccoutant@google.com>
8342
8343         * merge.cc (Output_merge_string::do_add_input_section): Count strings
8344         to reserve space in merged_strings vector. Keep total input size
8345         for stats.
8346         (Output_merge_string::do_print_merge_stats): Print total input size.
8347         * merge.h (Output_merge_string): Add input_size_ field.
8348         * stringpool.cc (Stringpool_template::string_length): Move
8349         implementations out of Stringpool_template class and place in
8350         stringpool.h.
8351         * stringpool.h (string_length): Move out of Stringpool_template.
8352
8353 2010-08-03  Ian Lance Taylor  <iant@google.com>
8354
8355         PR 11712
8356         * layout.cc (relaxation_loop_body): If address of load segment is
8357         set, adjust address to include headers if possible.
8358
8359 2010-08-03  Ian Lance Taylor  <iant@google.com>
8360
8361         * version.cc (version_string): Bump to 1.10.
8362
8363 2010-08-03  Ian Lance Taylor  <iant@google.com>
8364
8365         PR 11805
8366         * layout.h (enum Output_section_order): Define.
8367         (class Layout): Update declarations.
8368         * layout.cc (Layout::get_output_section): Add order parameter.
8369         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8370         is_first_non_relro parameters.  Change all callers.
8371         (Layout::choose_output_section): Likewise.
8372         (Layout::add_output_section_data): Likewise.
8373         (Layout::make_output_section): Likewise.  Set order.
8374         (Layout::default_section_order): New function.
8375         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8376         * output.cc (Output_section::Output_section): Initialize order_.
8377         Don't initialize deleted fields.
8378         (Output_segment::Output_segment): Don't initialize deleted
8379         fields.
8380         (Output_segment::add_output_section_to_load): New function
8381         replacing add_output_section.  Change all callers to call this or
8382         add_output_section_to_nonload.
8383         (Output_segment::add_output_section_to_nonload): New function.
8384         (Output_segment::remove_output_section): Rewrite.
8385         (Output_segment::add_initial_output_data): Likewise.
8386         (Output_segment::has_any_data_sections): Likewise.
8387         (Output_segment::is_first_section_relro): Likewise.
8388         (Output_segment::maximum_alignment): Likewise.
8389         (Output_segment::has_dynamic_reloc): New function replacing
8390         dynamic_reloc_count.  Change all callers.
8391         (Output_segment::has_dynamic_reloc_list): New function replacing
8392         dynamic_reloc_count_list.  Change all callers.
8393         (Output_segment::set_section_addresses): Rewrite.
8394         (Output_segment::set_offset): Rewrite.
8395         (Output_segment::find_first_and_last_list): Remove.
8396         (Output_segment::set_tls_offsets): Rewrite.
8397         (Output_segment::first_section_load_address): Likewise.
8398         (Output_segment::output_section_count): Likewise.
8399         (Output_segment::section_with_lowest_load_address): Likewise.
8400         (Output_segment::write_section_headers): Likewise.
8401         (Output_segment::print_sections_to_map): Likewise.
8402         * output.h (class Output_data): Remove dynamic_reloc_count_
8403         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8404         (Output_data::add_dynamic_reloc): Rewrite.
8405         (Output_data::has_dynamic_reloc): New function.
8406         (Output_data::dynamic_reloc_count): Remove.
8407         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8408         is_last_relro_, is_first_non_relro_, is_interp_,
8409         is_dynamic_linker_section_ fields.  Add order and set_order
8410         functions.  Remove is_relro_local, set_is_relro_local,
8411         is_last_relro, set_is_last_relro, is_first_non_relro,
8412         set_is_first_non_relro functions, is_interp, set_is_interp,
8413         is_dynamic_linker_section, and set_is_dynamic_linker_section
8414         functions.
8415         (class Output_segment): Change Output_data_list from std::list to
8416         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8417         output_bss_ fields.  Update declarations.
8418
8419 2010-08-02  Ian Lance Taylor  <iant@google.com>
8420
8421         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8422         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8423         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8424
8425 2010-08-02  Ian Lance Taylor  <iant@google.com>
8426
8427         PR 11855
8428         * script.cc (Script_options::Script_options): Initialize
8429         symbol_definitions_ and symbol_references_.
8430         (Script_options::add_symbol_assignment): Update
8431         symbol_definitions_ and symbol_references_.
8432         (Script_options::add_symbol_reference): New function.
8433         (script_symbol): New function.
8434         * script.h (class Script_options): Add symbol_definitions_ and
8435         symbol_references_ fields.
8436         (Script_options::referenced_const_iterator): New type.
8437         (Script_options::referenced_begin): New function.
8438         (Script_options::referenced_end): New function.
8439         (Script_options::is_referenced): New function.
8440         (Script_options::any_unreferenced): New function.
8441         * script-c.h (script_symbol): Declare.
8442         * yyscript.y (exp): Call script_symbol.
8443         * symtab.cc: Include "script.h".
8444         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8445         Change all callers.  Check symbols referenced by scripts.
8446         (Symbol_table::add_undefined_symbols_from_command_line): Add
8447         layout parameter.  Change all callers.
8448         (Symbol_table::do_add_undefined_symbols_from_command_line):
8449         Likewise.  Break out loop body.  Check symbols referenced by
8450         scripts.
8451         (Symbol_table::add_undefined_symbol_from_command_line): New
8452         function broken out of
8453         do_add_undefined_symbols_from_command_line.
8454         * symtab.h (class Symbol_table): Update declarations.
8455         * archive.cc: Include "layout.h".
8456         (Archive::should_include_member): Add layout parameter.  Change
8457         all callers.  Check for symbol mentioned in expression.
8458         * archive.h (class Archive): Update declaration.
8459         * object.cc (Sized_relobj::do_should_include_member): Add layout
8460         parameter.
8461         * object.h (Object::should_include_member): Add layout parameter.
8462         Change all callers.
8463         (Object::do_should_include_member): Add layout parameter.
8464         (class Sized_relobj): Update declaration.
8465         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8466         parameter.
8467         * dynobj.h (class Sized_dynobj): Update declaration.
8468         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8469         layout parameter.
8470         * plugin.h (class Sized_pluginobj): Update declaration.
8471
8472 2010-08-02  Ian Lance Taylor  <iant@google.com>
8473
8474         PR 11866
8475         * output.cc (Output_segment::set_offset): Search for the first and
8476         last sections rather than assuming that the list is in order.
8477         (Output_segment::find_first_and_last_list): New function.
8478         * output.h (class Output_segment): Update declarations.
8479         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8480         (relro_strip_test_SOURCES): New variable.
8481         (relro_strip_test_DEPENDENCIES): New variable.
8482         (relro_strip_test_LDFLAGS): New variable.
8483         (relro_strip_test_LDADD): New variable.
8484         (relro_strip_test.so): New target.
8485
8486 2010-08-02  Ian Lance Taylor  <iant@google.com>
8487
8488         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8489         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8490         (Target_i386::got_tlsdesc_section): New function.
8491         (Target_i386::got_section): Create space for GOT entries for
8492         TLSDESC relocations.
8493         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8494         R_386_TLS_GOTDESC.
8495         (Target_i386::Scan::global): Likewise.
8496         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8497         using TLSDESC GOT.
8498         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8499         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8500         (Target_x86_64::got_tlsdesc_section): New function.
8501         (Target_x86_64::got_section): Create space for GOT entries for
8502         TLSDESC relocations.
8503         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8504         R_386_TLS_GOTDESC.
8505         (Target_x86_64::Scan::global): Likewise.
8506         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8507         using TLSDESC GOT.
8508
8509 2010-08-02  Ian Lance Taylor  <iant@google.com>
8510
8511         * testsuite/final_layout.sh: Use dc to convert from hex to
8512         decimal.
8513
8514 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8515
8516         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8517         paramter to the call to gold::gc_process_relocs.
8518         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8519         paramter to the call to gold::gc_process_relocs.
8520         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8521         parameter to the call to gold::gc_process_relocs.
8522         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8523         template parameter to the call to gold::gc_process_relocs.
8524         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8525         paramter to the call to gold::gc_process_relocs.
8526         * gc.h (get_embedded_addend_size): New function.
8527         (gc_process_relocs): Save the size of the reloc for use by ICF.
8528         * icf.cc (get_section_contents): Get the addend from the text section
8529         for SHT_REL relocation sections.
8530         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8531         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8532         * int_encoding.h (read_from_pointer): New overloaded function.
8533         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8534         * testsuite/icf_sht_rel_addend_test.sh: New file.
8535         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8536         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8537
8538 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8539
8540         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8541         * Makefile.in: Regenerate.
8542         * testsuite/Makefile.in: Regenerate.
8543
8544 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8545
8546         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8547         * gold/testsuite/debug_msg.cc: Likewise.
8548         * gold/testsuite/odr_violation1.cc
8549         * gold/testsuite/odr_violation2.cc
8550
8551 2010-07-21  Cary Coutant  <ccoutant@google.com>
8552
8553         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8554         string, and length fields.
8555         (Output_merge_string::Merged_strings_list): New type.
8556         (Output_merge_string::Merged_strings_lists): New typedef.
8557         (Output_merge_string): Replace merged_strings_ with
8558         merged_strings_lists_.
8559         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8560         Merged_strings_list per input object and section.  Don't store pointer
8561         to the string.  Don't store length with each merged string entry.
8562         (Output_merge_string::finalize_merged_data): Loop over list of merged
8563         strings lists.  Recompute length of each merged string.
8564
8565 2010-07-15  Cary Coutant  <ccoutant@google.com>
8566
8567         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8568         here.
8569
8570 2010-07-14  Ian Lance Taylor  <iant@google.com>
8571
8572         * descriptors.cc (Descriptors::open): Report correct name in error
8573         message.
8574
8575 2010-07-13  Doug Kwan  <dougkwan@google.com>
8576
8577         * arm.cc (Arm_input_section::Arm_input_section): For a
8578         SHT_ARM_EXIDX section, always keeps the input sections.
8579         (Arm_input_section::set_exidx_section_link): New method.
8580         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8581         has_errors_ to false.
8582         (Arm_exidx_input_section::has_errors,
8583         Arm_exidx_input_section::set_has_errors): New methods.
8584         (Arm_exidx_input_section::has_errors_): New data member.
8585         (Arm_relobj::get_exidx_shndx_list): New method.
8586         (Arm_output_section::append_text_sections_to_list): Do not skip
8587         section without SHF_EXECINSTR.
8588         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8589         errors.
8590         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8591         section header.  Make error messages more verbose.  Check for
8592         a non-executable section linked to an EXIDX section.
8593         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8594         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8595         check that there is no deferred EXIDX section if we exit early.
8596         Instead of not making an EXIDX section in case of an error, make one
8597         and set the has_errors flag of it.
8598         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8599         in a relocatable link.
8600         (Target_arm::do_relax): Look for the EXIDX output section instead of
8601         assuming that it is called .ARM.exidx.
8602         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8603         section list.  Do not check for SHF_EXECINSTR section flags but
8604         skip any input section with errors.
8605         * output.cc (Output_section::Output_section): Initialize
8606         always_keeps_input_sections_ to false.
8607         (Output_section::add_input_section): Check for
8608         always_keeps_input_sections_.
8609         *  output.h (Output_section::always_keeps_input_sections,
8610         Output_section::set_always_keeps_input_sections): New methods.
8611         (Output_section::always_keeps_input_sections): New data member.
8612
8613 2010-07-13  Rafael Espindola  <espindola@google.com>
8614
8615         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8616         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8617
8618 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8619             Ian Lance Taylor  <iant@google.com>
8620
8621         * output.h (Output_section_lookup_maps::add_merge_section):
8622         Correct check of whether value was inserted.
8623         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8624         (Output_section_lookup_maps::add_relaxed_input_section):
8625         Likewise.
8626         * arm.cc (Target_arm::got_section): Remove used local os.
8627         * i386.cc (Target_i386::got_section): Likewise.
8628         * x86_64.cc (Target_x86_64::got_section): Likewise.
8629         * sparc.cc (Target_sparc::got_section): Likewise.
8630         (Target_sparc::relocate): Remove unused local have_got_offset.
8631         * powerpc.cc (Target_powerpc::relocate): Likewise.
8632
8633 2010-07-13  Ian Lance Taylor  <iant@google.com>
8634
8635         * compressed_output.cc (zlib_decompress): Fix signature in
8636         !HAVE_ZLIB_H case.
8637
8638         * archive.cc (Archive::include_member): Unlock an external member
8639         of a thin archive.  Don't bother to delete an object we know is
8640         NULL.
8641
8642 2010-07-12  Cary Coutant  <ccoutant@google.com>
8643
8644         * compressed_output.cc (zlib_decompress): New function.
8645         (get_uncompressed_size): New function.
8646         (decompress_input_section): New function.
8647         * compressed_output.h (get_uncompressed_size): New function.
8648         (decompress_input_section): New function.
8649         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8650         Handle compressed debug sections.
8651         * layout.cc (is_compressed_debug_section): New function.
8652         (Layout::output_section_name): Map compressed section names to
8653         canonical names.
8654         * layout.h (is_compressed_debug_section): New function.
8655         (is_debug_info_section): Recognize compressed debug sections.
8656         * merge.cc: Include compressed_output.h.
8657         (Output_merge_data::do_add_input_section): Handle compressed
8658         debug sections.
8659         (Output_merge_string::do_add_input_section): Handle compressed
8660         debug sections.
8661         * object.cc: Include compressed_output.h.
8662         (Sized_relobj::Sized_relobj): Initialize new data members.
8663         (build_compressed_section_map): New function.
8664         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8665         * object.h (Object::section_is_compressed): New method.
8666         (Object::do_section_is_compressed): New method.
8667         (Sized_relobj::Compressed_section_map): New type.
8668         (Sized_relobj::do_section_is_compressed): New method.
8669         (Sized_relobj::compressed_sections_): New data member.
8670         * output.cc (Output_section::add_input_section): Handle compressed
8671         debug sections.
8672         * reloc.cc: Include compressed_output.h.
8673         (Sized_relobj::write_sections): Handle compressed debug sections.
8674
8675 2010-07-08  Cary Coutant  <ccoutant@google.com>
8676
8677         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8678         weak when resolving to a dynamic def.
8679         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8680         for weak undef/dynamic def cases. Adjust callers.
8681         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8682         undef_binding_weak_.
8683         (Symbol_table::sized_write_globals): Adjust symbol binding.
8684         (Symbol_table::sized_write_symbol): Add binding parameter.
8685         * symtab.h (Symbol::set_undef_binding): New method.
8686         (Symbol::is_undef_binding_weak): New method.
8687         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8688         (Symbol_table::should_override): Add new parameter.
8689         (Symbol_table::sized_write_symbol): Add new parameter.
8690
8691         * testsuite/weak_undef_file1.cc: Add new test case.
8692         * testsuite/weak_undef_file2.cc: Fix header comment.
8693         * testsuite/weak_undef_test.cc: Add new test case.
8694
8695 2010-06-29  Doug Kwan  <dougkwan@google.com>
8696
8697         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8698         Initialize USE_SYMBOL_.
8699         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8700         definition.
8701         (Arm_reloc_property::uses_symbol_): New data member declaration.
8702         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8703         uses symbol value and symbol is undefined but not weakly undefined.
8704
8705 2010-06-28  Rafael Espindola  <espindola@google.com>
8706
8707         * plugin.cc (Plugin::load): Use dlerror.
8708
8709 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8710
8711         * symtab.cc (detect_odr_violations): When reporting an ODR
8712         violation, report an object where the symbol is defined.
8713
8714 2010-06-25  Doug Kwan  <dougkwan@google.com>
8715
8716         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8717         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8718         definition.
8719         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8720         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8721         target hook to detect function points.
8722         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8723         * icf.h (Icf::check_section_for_function_pointers): Change type of
8724         parameter SECTION_NAME to const reference to std::string.  Use
8725         target hook to determine if section may have unsafe pointers.
8726         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8727         method definition.
8728
8729 2010-06-21  Rafael Espindola  <espindola@google.com>
8730
8731         * fileread.cc (Input_file::find_fie): New
8732         (Input_file::open): Use Input_file::find_fie.
8733         * fileread.h (Input_file::find_fie): New
8734         * plugin.cc (set_extra_library_path): New.
8735         (Plugin::load): Add set_extra_library_path to the transfer vector.
8736         (Plugin_manager::set_extra_library_path): New.
8737         (Plugin_manager::add_input_file): Use the extra search path if set.
8738         (set_extra_library_path(): New.
8739         * plugin.h (Plugin_manager): Add set_extra_library_path and
8740         extra_search_path_.
8741
8742 2010-06-19  Cary Coutant  <ccoutant@google.com>
8743
8744         * layout.cc (gdb_sections): Add .debug_types.
8745         (lines_only_debug_sections): Likewise.
8746
8747 2010-06-18  Rafael Espindola  <espindola@google.com>
8748
8749         * plugin.cc (add_input_file,add_input_library)
8750         (Plugin_manager::add_input_file): Make filename arguments const.
8751         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8752         const.
8753
8754 2010-06-16  Doug Kwan  <dougkwan@google.com>
8755
8756         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8757         .ARM.attributes section if we have not merged any input
8758         attributes sections.
8759
8760 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8761
8762         * arm.cc: Allow combining objects with no EABI version
8763         information.
8764
8765 2010-06-15  Rafael Espindola  <espindola@google.com>
8766
8767         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8768
8769 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8770
8771         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8772         (struct iovec): Correct !HAVE_READV definition.
8773
8774 2010-06-10  Cary Coutant  <ccoutant@google.com>
8775
8776         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8777         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8778         reloc sections.
8779         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8780
8781         PR 11683
8782         * symtab.h (Symbol::is_placeholder): New member function.
8783         * target-reloc.h (relocate_section): Check for placeholder symbols.
8784
8785         * testsuite/Makefile.am (plugin_test_8): New test.
8786         (plugin_test_9): New test.
8787         * testsuite/Makefile.in: Regenerate.
8788
8789 2010-06-09  Nick Clifton  <nickc@redhat.com>
8790
8791         * yyscript.y (input_list_element): Allow strings prefixed with
8792         the '-' character.  Treat these as libraries.
8793         * script.cc (script_add_library): New function.  Adds a library
8794         specified by "-l<name>" found in an input script.
8795         * script-c.h: Add prototype for script_add_library.
8796
8797 2010-06-07  Doug Kwan  <dougkwan@google.com>
8798
8799         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8800         Restrict stub-group size to be within long conditional branch
8801         range when working around cortex-A8 erratum.
8802
8803 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8804
8805         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8806         #ifdef typo.
8807
8808 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8809
8810         PR gold/11658
8811         * output.cc
8812         (Output_section::Input_section_sort_entry::compare_section_ordering):
8813         Change to return non-zero correctly.
8814         (Output_section::Input_section_sort_section_order_index_compare
8815         ::operator()): Change to fix ambiguity in comparisons.
8816
8817 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8818
8819         * gold.h (is_wildcard_string): New function.
8820         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8821         (Layout::layout_eh_frame): Ditto.
8822         (Layout::find_section_order_index): New method.
8823         (Layout::read_layout_from_file): New method.
8824         * layout.h (Layout::find_section_order_index): New method.
8825         (Layout::read_layout_from_file): New method.
8826         (Layout::input_section_position_): New private member.
8827         (Layout::input_section_glob_): New private member.
8828         * main.cc (main): Call read_layout_from_file here.
8829         * options.h (--section-ordering-file): New option.
8830         * output.cc (Output_section::input_section_order_specified_): New
8831         member.
8832         (Output_section::Output_section): Initialize new member.
8833         (Output_section::add_input_section): Add new parameter.
8834         Keep input sections when --section-ordering-file is used.
8835         (Output_section::set_final_data_size): Sort input sections when
8836         section ordering file is specified.
8837         (Output_section::Input_section_sort_entry): Add new parameter.
8838         Check sorting type.
8839         (Output_section::Input_section_sort_entry::compare_section_ordering):
8840         New method.
8841         (Output_section::Input_section_sort_compare::operator()): Change to
8842         consider section_order_index.
8843         (Output_section::Input_section_sort_init_fini_compare::operator()):
8844         Change to consider section_order_index.
8845         (Output_section::Input_section_sort_section_order_index_compare
8846         ::operator()): New method.
8847         (Output_section::sort_attached_input_sections): Change to sort
8848         according to section order when specified.
8849         (Output_section::add_input_section<32, true>): Add new parameter.
8850         (Output_section::add_input_section<64, true>): Add new parameter.
8851         (Output_section::add_input_section<32, false>): Add new parameter.
8852         (Output_section::add_input_section<64, false>): Add new parameter.
8853         * output.h (Output_section::add_input_section): Add new parameter.
8854         (Output_section::input_section_order_specified): New
8855         method.
8856         (Output_section::set_input_section_order_specified): New method.
8857         (Input_section::Input_section): Initialize section_order_index_.
8858         (Input_section::section_order_index): New method.
8859         (Input_section::set_section_order_index): New method.
8860         (Input_section::section_order_index_): New member.
8861         (Input_section::Input_section_sort_section_order_index_compare): New
8862         struct.
8863         (Output_section::input_section_order_specified_): New member.
8864         * script-sections.cc (is_wildcard_string): Delete and move modified
8865         method to gold.h.
8866         (Output_section_element_input::Output_section_element_input): Modify
8867         call to is_wildcard_string.
8868         (Output_section_element_input::Input_section_pattern
8869         ::Input_section_pattern): Ditto.
8870         (Output_section_element_input::Output_section_element_input): Ditto.
8871         * testsuite/Makefile.am (final_layout): New test case.
8872         * testsuite/Makefile.in: Regenerate.
8873         * testsuite/final_layout.cc: New file.
8874         * testsuite/final_layout.sh: New file.
8875
8876 2010-06-01  Rafael Espindola  <espindola@google.com>
8877
8878         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8879
8880 2010-06-01  Rafael Espindola  <espindola@google.com>
8881
8882         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8883         visibility of symbols.
8884
8885 2010-05-27  Doug Kwan  <dougkwan@google.com>
8886
8887         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8888         from start of output section instead of address for a local symbol
8889         in a merged or relaxed section when doing a relocatable link.
8890
8891 2010-05-26  Rafael Espindola  <espindola@google.com>
8892
8893         PR 11604
8894         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8895         adding sections the garbage collector removed.
8896         * gold/testsuite/Makefile.am: Add test.
8897         * gold/testsuite/Makefile.in: Regenerate.
8898         * gold/testsuite/plugin_test_7.sh: New.
8899         * gold/testsuite/plugin_test_7_1.c: New.
8900         * gold/testsuite/plugin_test_7_2.c: New.
8901
8902 2010-05-26  Rafael Espindola  <espindola@google.com>
8903
8904         * script-sections.cc (Output_section_definition::set_section_addresses):
8905         Check for --section-start.
8906
8907 2010-05-26  Doug Kwan  <dougkwan@google.com>
8908
8909         * arm.cc (Arm_scan_relocatable_relocs): New class.
8910         (Target_arm::relocate_special_relocatable): New method.
8911         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8912         (Arm_relocate_functions::thumb_branch_common): Same.
8913         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8914         instead of Default_scan_relocatable_relocs.
8915         * target-reloc.h (relocate_for_relocatable): Let target handle
8916         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8917         * target.h (Sized_target::relocate_special_relocatable): New method.
8918
8919 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8920
8921         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8922
8923 2010-05-23  Doug Kwan  <dougkwan@google.com>
8924
8925         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8926         instead of a cast.
8927         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8928         with a direct branch, not a conditional branch, to a stub.
8929         * merge.cc (Output_merge_base::record_input_section): New method
8930         defintion.
8931         (Output_merge_data::do_add_input_section): Record input section if
8932         keeps-input-sections flag is set.
8933         (Output_merge_string::do_add_input_section): Ditto.
8934         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8935         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8936         INPUT_SECTIONS_.
8937         (Output_merge_base::keeps_input_sections,
8938         Output_merge_base::set_keeps_input_sections,
8939         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8940         method definitions.
8941         (Output_merge_base::Input_sections): New type declaration.
8942         (Output_merge_base::input_sections_begin,
8943         Output_merge_base::input_sections_end,
8944         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8945         (Output_merge_base::bool keeps_input_sections_,
8946         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8947         Output_merge_base::input_sections_): New data members.
8948         (Output_merge_data::do_set_keeps_input_sections): New method
8949         defintion.
8950         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8951         * output.cc (Output_section::Input_section::relobj): Move method
8952         defintion from class declaration to here and handle merge sections.
8953         (Output_section::Input_section::shndx): Ditto.
8954         (Output_section::Output_section): Remove initializations of removed
8955         data members and initialize new data member LOOKUP_MAPS_.
8956         (Output_section::add_input_section): Set keeps-input-sections flag
8957         for a newly created merge output section as appropriate.  Adjust code
8958         to use Output_section_lookup_maps class.
8959         (Output_section::add_relaxed_input_section): Adjst code for lookup
8960         maps code refactoring.
8961         (Output_section::add_merge_input_section): Add a new parameter
8962         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8963         class.  If adding input section to a newly created merge output
8964         section fails, remove the new merge section.
8965         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8966         Adjust code for use of the Output_section_lookup_maps class.
8967         (Output_section::find_merge_section): Ditto.
8968         (Output_section::build_lookup_maps): New method defintion.
8969         (Output_section::find_relaxed_input_section): Adjust code to use
8970         Output_section_lookup_maps class.
8971         (Output_section::get_input_sections): Export merge sections.  Adjust
8972         code to use Output_section_lookup_maps class.
8973         (Output_section:::add_script_input_section): Adjust code to use
8974         Output_section_lookup_maps class.  Update lookup maps for merge
8975         sections also.
8976         (Output_section::discard_states): Use Output_section_lookup_maps.
8977         (Output_section::restore_states): Same.
8978         * output.h (Merge_section_properties): Move class defintion out of
8979         Output_section.
8980         (Output_section_lookup_maps): New class.
8981         (Output_section::Input_section::is_merge_section): New method
8982         defintion.
8983         (Output_section::Input_section::relobj): Move defintion out of class
8984         defintion.  Declare method only.
8985         (Output_section::Input_section::shndx): Ditto.
8986         (Output_section::Input_section::output_merge_base): New method defintion.
8987         (Output_section::Input_section::u2_.pomb): New union field.
8988         (Output_section::Merge_section_by_properties_map,
8989         Output_section::Output_section_data_by_input_section_map,
8990         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8991         Remove types.
8992         (Output_section::add_merge_input_section): Add new parameter
8993         KEEPS_INPUT_SECTIONS.
8994         (Output_section::build_lookup_maps): New method declaration.
8995         (Output_section::merge_section_map_,
8996         Output_section::merge_section_by_properties_map_,
8997         Output_section::relaxed_input_section_map_,
8998         Output_section::is_relaxed_input_section_map_valid_): Remove data
8999         members.
9000         (Output_section::lookup_maps_): New data member.
9001
9002 2010-05-21  Doug Kwan  <dougkwan@google.com>
9003
9004         PR gold/11619
9005         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9006         avoid a compilation error.
9007
9008 2010-05-19  Rafael Espindola  <espindola@google.com>
9009
9010         * script-sections.cc (Output_section_definition::allocate_to_segment):
9011         Update the phdrs_list even when the output section is NULL.
9012         * testsuite/Makefile.am: Add test.
9013         * testsuite/Makefile.in: Regenerate.
9014         * testsuite/script_test_9.cc: New.
9015         * testsuite/script_test_9.sh: New.
9016         * testsuite/script_test_9.t: New.
9017
9018 2010-05-19  Doug Kwan  <dougkwan@google.com>
9019
9020         * arm.cc (Arm_input_section::original_size): New method.
9021         (Arm_input_section::do_addralign): Add a cast.
9022         (Arm_input_section::do_output_offset): Remove static cast.
9023         (Arm_input_section::original_addralign,
9024          Arm_input_section::original_size_): Change type to uint32_t.
9025         (Arm_input_section::init): Add safe casts for section alignment
9026         and size.
9027         (Arm_input_section::set_final_data_size): Do not set address and
9028         offset of stub table.
9029         (Arm_output_section::fix_exidx_coverage): Change use of of
9030         Output_section::Simple_input_section to that of
9031         Output_section::Input_section.
9032         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9033         except for the first pass.
9034         * output.cc (Output_section::get_input_sections): Change type of
9035         input_sections to std::list<Input_section>.
9036         (Output_section::add_script_input_section): Rename from
9037         Output_section::add_simple_input_section.  Change type of SIS
9038         parameter from Simple_input_section to Input_section.
9039         * output.h (Output_section::Simple_input_section): Remove class.
9040         (Output_section::Input_section): Change class visibility to public.
9041         (Output_section::Input_section::addralign): Use stored alignments
9042         for special input sections if set.
9043         (Output_section::Input_section::set_addralign): New method.
9044         (Output_section::get_input_sections): Change parameter type from
9045         list of Simple_input_section to list of Input_section.
9046         (Output_section::add_script_input_section): Rename from
9047         Output_section::add_simple_input_section. Change first parameter's
9048         type from Simple_input_section to Input_section and remove the
9049         second and third parameters.
9050         * script-sections.cc (Input_section::Input_section_list): Change
9051         type to list of Output_section::Input_section/
9052         (Input_section_info::Input_section_info): Change parameter type of
9053         INPUT_SECTION to Output_section::Input_section.
9054         (Input_section_info::input_section): Change return type.
9055         (Input_section_info::input_section_): Change type to
9056         Output_section::Input_section.
9057         (Output_section_element_input::set_section_addresses): Adjust code
9058         to use Output_section::Input_section instead of
9059         Output_section::Simple_input_section.  Adjust code for renaming
9060         of Output_section::add_simple_input_section.
9061         (Orphan_output_section::set_section_addresses): Ditto.
9062
9063 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9064
9065         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9066         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9067
9068 2010-05-18  Rafael Espindola  <espindola@google.com>
9069
9070         * options.cc (General_options::finalize): Handle -nostdlib.
9071         * options.h (nostdlib): New option.
9072         * script.cc (script_add_search_dir): Handle -nostdlib.
9073
9074 2010-05-12  Doug Kwan  <dougkwan@google.com>
9075
9076         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9077         attributes section only if there no attributes section after merging.
9078         (Target_arm::merge_object_attributes): Move value of
9079         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9080         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9081         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9082         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9083         and arm_attr_merge_7.stdout.
9084         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9085         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9086         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9087         arm_attr_merge_7b.o): New rules.
9088         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9089         arm_attr_merge_7
9090         * testsuite/Makefile.in: Regenerate.
9091         * testsuite/arm_attr_merge.sh: New file.
9092         * testsuite/arm_attr_merge_[67][ab].s: Same.
9093
9094 2010-05-05  Nick Clifton  <nickc@redhat.com>
9095
9096         * po/es.po: Updated Spanish translation.
9097
9098 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9099
9100         * Makefile.am (install-exec-local): Properly install gold as
9101         default cross linker.
9102         * Makefile.in: Regenerated.
9103
9104 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9105             Nick Clifton  <nickc@redhat.com>
9106
9107         * configure.ac (install_as_default): Define and set to false
9108         unless --enable-gold or --enable-gold=both/gold has been
9109         specified.
9110         * configure: Regenerate.
9111
9112         * Makefile.am (install-exec-local): Install the executable as
9113         'ld.gold'.  If install_as_default is true then also install it as
9114         'ld'.
9115         * Makefile.in: Regenerated.
9116
9117 2010-04-24  Ian Lance Taylor  <iant@google.com>
9118
9119         * layout.cc (Layout::layout_reloc): In relocatable link don't
9120         combine reloc sections for grouped sections.
9121
9122 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9123
9124         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9125         sections that are not ordinary to icf.
9126         * icf.cc (get_section_contents): Handle relocation pointing to section
9127         with no object or shndx information.
9128         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9129         * testsuite/Makefile.in: Regenerate.
9130         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9131         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9132
9133 2010-04-22  Ian Lance Taylor  <iant@google.com>
9134
9135         * expression.cc (Expression::Expression_eval_info): Add
9136         result_alignment_pointer field.
9137         (Expression::eval_with_dot): Add result_alignment_pointer
9138         parameter.  Change all callers.
9139         (Expression::eval_maybe_dot): Likewise.
9140         (class Binary_expression): Add alignment_pointer parameter to
9141         left_value and right_value.  Change all callers.
9142         (BINARY_EXPRESSION): Set result alignment.
9143         (class Trinary_expression): Add alignment_pointer parameter to
9144         arg2_value and arg3_value.  Change all callers.
9145         (Trinary_cond::value): Set result alignment.
9146         (Max_expression::value, Min_expression::value): Likewise.
9147         (Align_expression::value): Likewise.
9148         * script-sections.cc (class Sections_element): Add dot_alignment
9149         parameter to set_section_addresses virtual function.  Update
9150         instantiations.
9151         (class Output_section_element): Likewise.
9152         (Script_sections::create_segments): Add dot_alignment parameter.
9153         Change all callers.
9154         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9155         (Script_sections::set_phdrs_clause_addresses): Likewise.
9156         * script-sections.h: Update declarations.
9157         * script.h: Update declarations.
9158         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9159         min_p_align.
9160         * testsuite/script_test_3.t: Set large alignment.
9161         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9162         segment has expected alignment.
9163
9164 2010-04-22  Nick Clifton  <nickc@redhat.com>
9165
9166         * po/gold.pot: Updated by the Translation project.
9167         * po/vi.po: Updated Vietnamese translation.
9168
9169 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9170
9171         * testsuite/Makefile.am (check_PROGRAMS): Add
9172         icf_virtual_function_folding_test.
9173         * testsuite/Makefile.in: Regenerated.
9174
9175 2010-04-15  Andrew Haley  <aph@redhat.com>
9176
9177         * options.h (merge_exidx_entries): New option.
9178         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9179         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9180         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9181         (Target_arm::merge_exidx_entries): New function.
9182         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9183         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9184         to Arm_exidx_fixup constructor.
9185         Add new arg, merge_exidx_entries.
9186         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9187         Arm_output_section::fix_exidx_coverage.
9188
9189 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9190
9191         * icf.cc (get_section_contents): Check for preemptible functions.
9192         Ignore addend when appropriate.
9193         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9194         section folded.
9195         (add_from_relobj): Check for section folded.
9196         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9197         * symtab.h (should_add_dynsym_entry): Add new parameter.
9198         * target-reloc.h (scan_relocs): Check for section folded.
9199         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9200         Check reloc types for function pointers in shared objects.
9201         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9202         case.
9203         (icf_preemptible_functions_test): New test case.
9204         (icf_string_merge_test): New test case.
9205         * testsuite.Makefile.in: Regenerate.
9206         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9207         bar_glob.  Refactor code.
9208         * testsuite/icf_preemptible_functions_test.cc: New file.
9209         * testsuite/icf_preemptible_functions_test.sh: New file.
9210         * testsuite/icf_string_merge_test.cc: New file.
9211         * testsuite/icf_string_merge_test.sh: New file.
9212         * testsuite/icf_virtual_function_folding_test.cc: New file.
9213         * testsuite/icf_virtual_function_folding_test.sh: New file.
9214
9215 2010-04-14  Doug Kwan  <dougkwan@google.com>
9216
9217         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9218         for local symbol recounting if we remove a section due to ICF.
9219         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9220         there are no regular objects in input.
9221
9222 2010-04-13  Doug Kwan  <dougkwan@google.com>
9223
9224         * arm.cc (Arm_input_section::set_final_data_size): Compute
9225         accurate final data size instead of using current data size.
9226
9227 2010-04-09  Doug Kwan  <dougkwan@google.com>
9228
9229         * layout.cc (Layout::choose_output_section): Handle script section
9230         types.
9231         (Layout::make_output_section_for_script): Add section type parameter.
9232         Handle script section types.
9233         * layout.h (Layout::make_output_section_for_script): Add section
9234         type parameter.
9235         * output.cc (Output_section::Output_section): Initialize data member
9236         is_noload_.
9237         (Output_section::do_reset_address_and_file_offset): Do not set address
9238         to 0 if section is a NOLOAD section.
9239         * output.h (Output_section::is_noload): New method.
9240         (Output_section::set_is_noload): Ditto.
9241         (Output_section::is_noload_): New data member.
9242         * script-c.h (Script_section_type): New enum type.
9243         (struct Parser_output_section_header): Add new file section_type.
9244         * script-sections.cc (Sections_element::output_section_name): Add
9245         parameter for returning script section type.
9246         (Output_section_definition::output_section_name): Ditto.
9247         (Output_section_definition::section_type)P; New method.
9248         (Output_section_definiton::script_section_type_name): Ditto.
9249         (Output_section_definition::script_section_type_): New data member.
9250         (Output_section_definition::Output_section_definition): Initialize
9251         data member Output_section_definition::script_section_type_.
9252         (Output_section_definition::create_sections): Pass script section type
9253         to Layout::make_output_section_for_script.
9254         (Output_section_definition::output_section_name): Return script
9255         section type to caller.
9256         (Output_section_definition::set_section_address): Do not advance
9257         dot value and load address if section type is NOLOAD.  Set address
9258         of NOLOAD sections regardless of section flags.
9259         (Output_section_definition::print): Print section type if it is
9260         not SCRIPT_SECTION_TYPE_NONE.
9261         (Output_section_definition::section_type): New method.
9262         (Output_section_definition::script_section_type_name): Ditto.
9263         (Script_sections::output_section_name): Add new parameter
9264         PSECTION_TYPE for returning script section type.  Pass it to
9265         section elements.  Handle discard sections.
9266         (Sort_output_sections::operator()): Handle NOLOAD sections.
9267         * script-sections.h (Script_sections::Section_type): New enum type.
9268         (Script_sections::output_section_name): Add a new parameter for
9269         returning script section type.
9270         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9271         INFO and NOLOAD.
9272         * yyscript.y (union): Add new field SECTION_TYPE.
9273         (COPY, DSECT, INFO, NOLOAD): New tokens.
9274         (opt_address_and_section_type): Change type to output_section_header.
9275         (section_type): New non-terminal
9276         (section_header): Handle section type.
9277         (opt_address_and_section_type): Return section type value.
9278
9279 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
9280
9281         * testsuite/plugin_common_test_1.c (foo): Add prototype.
9282         * testsuite/plugin_common_test_2.c (foo): Likewise.
9283
9284 2010-04-08  Doug Kwan  <dougkwan@google.com>
9285
9286         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9287         Output_merge_data.
9288         * output.cc (Output_section::add_merge_input_section): Simplify
9289         code and return status of Output_merge_base::add_input_section.
9290         Update merge section map only if Output_merge_base::add_input_section
9291         returns true.
9292
9293 2010-04-07  Doug Kwan  <dougkwan@google.com>
9294
9295         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9296         if section is marked as containing instructions but has no mapping
9297         symbols.
9298         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9299         correct section index.
9300         (Arm_relobj::find_linked_text_section): Ditto.
9301
9302 2010-04-07  Cary Coutant  <ccoutant@google.com>
9303
9304         * archive.cc (include_member): Destroy Read_symbols_data object before
9305         releasing file.
9306         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9307         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9308         (Read_symbols_data::~Read_symbols_data) New destructor.
9309         (Section_relocs::Section_relocs) New constructor.
9310         (Section_relocs::~Section_relocs) New destructor.
9311         (Read_relocs_data::Read_relocs_data) New constructor.
9312         (Read_relocs_data::~Read_relocs_data) New destructor.
9313         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9314         pointers to NULL after deleting.
9315
9316 2010-04-07  Doug Kwan  <dougkwan@google.com>
9317
9318         * arm.cc: Replace "endianity" with "endianness" in comments.
9319         (Arm_exidx_cantunwind): Ditto.
9320         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9321         (Arm_relobj::merge_flags_and_attributes): New method.
9322         (Arm_relobj::merge_flags_and_attributes_): New data member.
9323         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9324         (Arm_relobj::scan_sections_for_stubs): Ditto.
9325         (Arm_relobj::do_read_symbols): Check to see if we really want to
9326         merge processor-specific flags and attributes.  Exit early if
9327         an object is empty except for section names and the undefined symbol.
9328         (Target_arm::do_finalize_sections): Move check for ELF format to
9329         Arm_relobj::do_read_symbols.  Merge processor specific flags and
9330         attributes from a regular object only when we have determined that
9331         it is aapropriate.  Do not create an .ARM.attributes section in
9332         output if there is no regular input object.
9333         (Target_arm::merge_processor_specific_flags): Check
9334         --warn-mismatch before printing any error.
9335         (Target_arm::merge_object_attributes): Ditto.
9336         * gold.cc (queue_middle_tasks): Handle the case in which there is
9337         no regular object in input.
9338         * options.cc (General_options::parse_EB): New method.
9339         (General_options::parse_EL): Same.
9340         (General_options::General_options): Initialize endianness_.
9341         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9342         New options.
9343         (General_options::Endianness): New enum.
9344         (General_options::endianness): New method.
9345         (General_options::endianness_): New data member.
9346         * parameters.cc (Parameters::set_options): Check target endianness.
9347         (Parameters::set_target_once): Ditto.
9348         (Parameters::check_target_endianness): New method.
9349         (parameters_force_valid_target): If either -EL or -EB is specified,
9350         use it to define endianness of default target.
9351         * parameters.h (Parameters::check_target_endianness): New method
9352         declaration.
9353         * target.h (class Target): Change "endianity" to "endianness"
9354         in comments.
9355
9356 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9357
9358         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9359         * configure: Regenerate.
9360         * Makefile.in: Regenerate.
9361         * testsuite/Makefile.in: Regenerate.
9362
9363 2010-04-06  Cary Coutant  <ccoutant@google.com>
9364
9365         gcc PR lto/42757
9366         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9367         prevailing definitions of common symbols.
9368         * testsuite/plugin_test_6.sh: New test case.
9369         * testsuite/plugin_common_test_1.c: New test case.
9370         * testsuite/plugin_common_test_2.c: New test case.
9371         * testsuite/Makefile.am (plugin_test_6): New test case.
9372         * testsuite/Makefile.in: Regenerate.
9373
9374 2010-04-06  Nick Clifton  <nickc@redhat.com>
9375
9376         * po/vi.po: New Vietnamese translation.
9377
9378 2010-03-30  Doug Kwan  <dougkwan@google.com>
9379
9380         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9381
9382 2010-03-25  Doug Kwan  <dougkwan@google.com>
9383
9384         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9385         to avoid a conversion warning on a 32-bit host.
9386
9387 2010-03-24  Ian Lance Taylor  <iant@google.com>
9388
9389         * testsuite/script_test_3.t: Add a TLS segment.
9390         * testsuite/Makefile.am (check_PROGRAMS): Add
9391         tls_phdrs_script_test.
9392         (tls_phdrs_script_test_SOURCES): Define.
9393         (tls_phdrs_script_test_DEPENDENCIES): Define.
9394         (tls_phdrs_script_test_LDFLAGS): Define.
9395         (tls_phdrs_script_test_LDADD): Define.
9396         * testsuite/Makefile.in: Rebuild.
9397
9398 2010-03-23  Cary Coutant  <ccoutant@google.com>
9399
9400         * fileread.cc (find_or_make_view): Fix comment.
9401
9402 2010-03-23  Ian Lance Taylor  <iant@google.com>
9403
9404         * script-sections.cc (class Orphan_section_placement): Define
9405         PLACE_TLS and PLACE_TLS_BSS.
9406         (Orphan_section_placement::Orphan_section_placement): Initialize
9407         new places.
9408         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9409         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9410         (tls_script_test_SOURCES): Define.
9411         (tls_script_test_DEPENDENCIES): Define.
9412         (tls_script_test_LDFLAGS): Define.
9413         (tls_script_test_LDADD): Define.
9414         * testsuite/Makefile.in: Rebuild.
9415
9416 2010-03-22  Doug Kwan  <dougkwan@google.com>
9417
9418         * arm.cc (Arm_relocate_functions::abs8,
9419         Arm_relocate_functions::abs16): Use correct check for overflow
9420         specified in the ARM ELF specs.
9421         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9422         target of a BLX instruction specially.
9423         (Reloc_stub::stub_type_for_reloc): Ditto.
9424         (Relocate::relocate): Use symbolic names instead of numeric relocation
9425         codes to report error.
9426         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9427         workaround.
9428         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9429         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9430         thumb2_blx_out_of_range.stdout
9431         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9432         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9433         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9434         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9435         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9436         thumb2_blx_in_range, thumb2_blx_in_range.o,
9437         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9438         thumb2_blx_out_of_range.o): New rules.
9439         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9440         thumb2_blx_in_range and thumb2_blx_out_of_range.
9441         * testsuite/Makefile.in: Regenerate.
9442         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9443         * testsuite/thumb_blx_in_range.s: New file.
9444         * testsuite/thumb_blx_out_of_range.s: New file.
9445
9446 2010-03-22  Rafael Espindola  <espindola@google.com>
9447
9448         * archive.cc (Should_include): Move to archive.h.
9449         (should_include_member): Make it a member of Archive.
9450         (Lib_group): New.
9451         (Add_lib_group_symbols): New.
9452         * archive.h: Include options.h.
9453         (Archive_member): Moved from Archive.
9454         (Should_include): Moved from archive.cc.
9455         (Lib_group): New.
9456         (Add_lib_group_symbols): New.
9457         * dynobj.cc (do_should_include_member): New.
9458         * dynobj.h (do_should_include_member): New.
9459         * gold.cc (queue_initial_tasks): Update call to queue.
9460         * main.cc (main): Print lib group stats.
9461         * object.cc (do_should_include_member): New.
9462         * object.h: Include archive.h.
9463         (Object::should_include_member): New.
9464         (Object::do_should_include_member): New.
9465         (Sized_relobj::do_should_include_member): New.
9466         * options.cc (General_options::parse_start_lib): New.
9467         (General_options::parse_end_lib): New.
9468         (Input_arguments::add_file): Handle lib groups.
9469         (Input_arguments::start_group): Check we are not in a lib.
9470         (Input_arguments::start_lib): New.
9471         (Input_arguments::end_lib): New.
9472         * options.h (General_options): Add start_lib and end_lib.
9473         (Input_argument::lib_): New.
9474         (Input_argument::lib): New.
9475         (Input_argument::is_lib): New.
9476         (Input_file_lib): New.
9477         (Input_arguments::in_lib_): New.
9478         (Input_arguments::in_lib): New.
9479         (Input_arguments::start_lib): New.
9480         (Input_arguments::end_lib_): New.
9481         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9482         in unused members as preempted.
9483         (Sized_pluginobj::do_should_include_member): New.
9484         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9485         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9486         return the blocker.
9487         (Read_symbols::do_whole_lib_group): New.
9488         (Read_symbols::do_lib_group): New.
9489         (Read_symbols::do_read_symbols): Handle lib groups.
9490         (Read_symbols::get_name): Handle lib groups.
9491         * readsyms.h (Read_symbols): Add an archive member pointer.
9492         (Read_symbols::do_whole_lib_group): New.
9493         (Read_symbols::do_lib_group): New.
9494         (Read_symbols::member_): New.
9495         * script.cc (read_input_script): Update call to queue_soon.
9496
9497 2010-03-19  Doug Kwan  <dougkwan@google.com>
9498
9499         * arm.cc (Stub_table::Stub_table): Initialize new data members
9500         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9501         (Stub_table::add_reloc_stub): Assign stub offset and update
9502         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9503         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9504         New data members.
9505         (Stub_table::update_data_size_and_addralign): Use
9506         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9507         instead of going over all reloc stubs.
9508         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9509         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9510         Stringpool_template::offset_ to size of Stringpool_char.
9511         (Stringpool_template::new_key_offset): Remove code to initialize
9512         Stringpool_template::offset_.
9513         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9514         Stringpool_template::offset_ to zero.
9515
9516 2010-03-15  Doug Kwan  <dougkwan@google.com>
9517
9518         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9519         offset_.
9520         (Stringpool_template::new_key_offset): New method.
9521         (Stringpool_template::add_string): Assign offsets when adding new
9522         strings.
9523         (Stringpool_template::set_string_offsets): Do not set string offsets
9524         when not optimizing.
9525         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9526         member size_.
9527         (Chunked_vector::clear): Clear size_.
9528         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9529         (Chunked_vector::size): Return size_.
9530         (Chunked_vector::push_back): Use size_ to find insert position.
9531         (Chunked_vector::size_): New data member.
9532         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9533         (Stringpool_template::new_key_offset): New method declaration.
9534         (Stringpool_template::offset_): New data member.
9535
9536 2010-03-15   Rafael Espindola  <espindola@google.com>
9537
9538         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9539         Add_symbols' constructor.
9540         * readsyms.h (Add_symbols): Remove the input_group member.
9541
9542 2010-03-10  Ian Lance Taylor  <iant@google.com>
9543
9544         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9545         target to ask whether a reference to a symbol requires a stack
9546         split.
9547         * target.h (Target::is_call_to_non_split): New function.
9548         (Target::do_is_call_to_non_split): Declare virtual function.
9549         * target.cc: Include "symtab.h".
9550         (Target::do_is_call_to_non_split): New function.
9551         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9552
9553 2010-03-10  Cary Coutant  <ccoutant@google.com>
9554
9555         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9556         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9557         (File_read::open[2]): Add whole_file_view_ to list of views.
9558         (File_read::make_view): Remove test of whole_file_view_.
9559         (File_read::find_or_make_view): Create whole_file_view_ if
9560         necessary.
9561         (File_read::clear_views): Replace bool parameter with enum;
9562         adjust all callers.  Don't delete views with permanent data;
9563         do delete cached views and views from archives if
9564         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9565         if clearing the corresponding view.
9566         * fileread.h (File_read::Clear_views_mode): New enum.
9567         (File_read::View::is_permanent_view): New method.
9568         (File_read::clear_views): Replace bool parameter
9569         with enum; adjust all callers.
9570         * options.h (General_options): Change keep_files_mapped option;
9571         add map_whole_files.
9572         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9573         releasing the file.
9574         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9575         the file.
9576
9577 2010-03-10  David S. Miller  <davem@davemloft.net>
9578
9579         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9580
9581 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9582
9583         * icf.cc (get_section_contents): Add '@' marker after processing the
9584         merge reloc.
9585
9586 2010-03-08  Doug Kwan  <dougkwan@google.com>
9587
9588         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9589         due to a conversion warning.
9590         (Arm_relobj::update_output_local_symbol_count): Check for local
9591         symbol with unset output index.
9592
9593 2010-03-05  Ian Lance Taylor  <iant@google.com>
9594
9595         * options.h (class General_options): Add --spare-dynamic-tags.
9596         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9597         --spare-dynamic-tags.
9598
9599 2010-03-05  Ian Lance Taylor  <iant@google.com>
9600
9601         * incremental.cc: Include "libiberty.h".
9602
9603 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9604
9605         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9606         function, is_info_ member.
9607         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9608         (Versions::Versions): Update caller.
9609         (Versions::define_base_version): Likewise.
9610         (Versions::add_def): Likewise.
9611
9612 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9613
9614         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9615         (Scan::possible_function_pointer_reloc): New function.
9616         (Scan::local_reloc_may_be_function_pointer): Change to call
9617         possible_function_pointer_reloc.
9618         (Scan::global_reloc_may_be_function_pointer): Ditto.
9619         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9620         relocations in ".data.rel.ro._ZTV" section.
9621         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9622         * testsuite/icf_safe_so_test.cc: Ditto.
9623         * testsuite/icf_safe_test.cc: Ditto.
9624         * testsuite/icf_safe_test.sh: Ditto.
9625
9626 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9627             Ian Lance Taylor  <iant@google.com>
9628
9629         * target-reloc.h (relocate_section): Check the symbol table index
9630         for -1U before setting the local symbol index.
9631         (scan_relocatable_relocs): If copying the relocation, record that
9632         the local symbol is required.
9633         * object.h (Symbol_value::is_output_symtab_index_set): New
9634         function.
9635         (Symbol_value::may_be_discarded_from_output_symtab): New
9636         function.
9637         (Symbol_value::has_output_symtab_entry): New function.
9638         (Symbol_value::needs_output_symtab_entry): Remove.
9639         (Symbol_value::output_symtab_index): Make sure the symbol index is
9640         set.
9641         (Symbol_value::set_output_symtab_index): Make sure the symbol
9642         index is not set.  Make sure the new index is valid.
9643         (Symbol_value::set_must_have_output_symtab_entry): New function.
9644         (Symbol_value::has_output_dynsym_entry): New function.
9645         (Symbol_value::set_output_dynsym_index): Make sure the new index
9646         is valid.
9647         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9648         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9649         local symbol if permitted.
9650         (Sized_relobj::do_finalize_local_symbols): Call
9651         is_output_symtab_index_set rather than needs_output_symtab_entry.
9652         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9653         rather than needs_output_symtab_entry.  Call
9654         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9655         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9656         is_output_symtab_index_set rather than needs_output_symtab_entry.
9657         * testsuite/discard_locals_relocatable_test.c: New file.
9658         * testsuite/discard_locals_test.sh: Test -r.
9659         * testsuite/Makefile.am (check_DATA): Add
9660         discard_locals_relocatable_test1.syms,
9661         discard_local_relocatable_test2.syms.
9662         (MOSTLYCLEANFILES): Likewise.  Also add
9663         discard_locals_relocatable_test1.lout and
9664         discard_locals_relocatable_test2.out.
9665         (discard_locals_relocatable_test1.syms): New target.
9666         (discard_locals_relocatable_test.o): New target.
9667         (discard_locals_relocatable_test1.out): New target.
9668         (discard_locals_relocatable_test2.syms): New target.
9669         (discard_locals_relocatable_test2.out): New target.
9670         (various): Add missing ../ld-new dependencies.
9671         * testsuite/Makefile.in: Rebuild.
9672
9673 2010-03-03  Nick Clifton  <nickc@redhat.com>
9674
9675         * po/fi.po: New Finnish translation.
9676
9677 2010-03-01  Doug Kwan  <dougkwan@google.com>
9678
9679         * layout.cc (Layout::Layout): Force section types of .init_array*,
9680         .preinit_array* and .fini_array* sections.
9681         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9682         Fix check of return value of std::string::find.().
9683         (Output_section::Input_section_sort_compare::operator()): Remove
9684         comment about .init_array.
9685         (Output_section::Input_section_sort_init_fini_compare::operator()):
9686         New method.
9687         (Output_section::sort_attached_input_sections): Handle .init_array
9688         and .fini_array specially.
9689         * output.h (Output_section::Inut_section_sort_compare): Update
9690         comment.
9691         (Output_section::Input_section_sort_init_fini_compare): New struct.
9692
9693 2010-02-26  Doug Kwan  <dougkwan@google.com>
9694
9695         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9696         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9697         * testsuite/debug_msg.sh: Avoid matching source line number for
9698         use of global variable undef_int.
9699
9700 2010-02-26  Doug Kwan  <dougkwan@google.com>
9701
9702         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9703         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9704         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9705         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9706         * options.cc (General_options::General_options): Initialize member
9707         fix_v4bx_.
9708         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9709         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9710         and rm_no_fix_v4bx.stdout
9711         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9712         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9713         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9714         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9715         and arm_no_fix_v4bx.
9716         * Makefile.in: Regenerate.
9717         * testsuite/arm_fix_v4bx.s: New file.
9718         * testsuite/arm_fix_v4bx.sh: Ditto.
9719
9720 2010-02-24  Doug Kwan  <dougkwan@google.com>
9721
9722         * arm.cc (Target_arm::got_section): Make the .got section the first
9723         non RELRO section in the data segment.
9724         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9725         suffixes of section names.
9726
9727 2010-02-24  Doug Kwan  <dougkwan@google.com>
9728
9729         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9730         flags and attributes merging if an input file is a binary file.
9731         * fileread.cc (Input_file::open): Record format of original file.
9732         * fileread.h (Input_file::Format): New enum type.
9733         (Input_file::Input_file): Initialize data member format_.
9734         (Input_file::format): New method definition.
9735         (Input_file::format_):: New data member.
9736
9737 2010-02-24  Doug Kwan  <dougkwan@google.com>
9738
9739         * arm.cc (Arm_output_data_got): New class.
9740         (ARM_TCB_SIZE): New constant
9741         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9742         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9743         If user uses a script with a SECTIONS clause, issue only a warning
9744         for a misplaced EXIDX input section.  Otherwise, issue an error.
9745         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9746         garbage collection.
9747         (Target_arm::got_mode_index_entry): Handle static linking.
9748         (Target_arm::Scan::local): Ditto.
9749         (Target_arm::Scan::global): Ditto.
9750         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9751         all incorrectly implemented relocations.
9752         (Target_arm::fix_exidx_coverage): Pass layout to
9753         Arm_output_section::fix_exidx_coverage.
9754         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9755         from ".ARM.exidx." and ".ARM.extab.".
9756
9757 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9758
9759         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9760         section if it does not already exist.
9761         * attributes.cc (Attributes_section_data::Attributes_section_data):
9762         Don't crash if size is zero.
9763
9764 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9765             Ian Lance Taylor  <iant@google.com>
9766
9767         * gold.cc (queue_middle_tasks): If no input files were opened,
9768         exit.
9769         * workqueue.h (Task_function::Task_function): Assert that there is
9770         a blocker.
9771
9772 2010-02-22  Doug Kwan  <dougkwan@google.com>
9773
9774         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9775         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9776         types to avoid warnings due to different uint64_t implementations
9777         on different hosts.
9778
9779 2010-02-21  Doug Kwan  <dougkwan@google.com>
9780
9781         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9782         handling of the maximum backward branch offset.
9783         (Arm_relocate_functions::thumb_branch_common): Ditto.
9784         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9785         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9786         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9787         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9788         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9789         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9790         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9791         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9792         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9793         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9794         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9795         thumb2_bl_out_of_range.o): New rules.
9796         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9797         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9798         thumb2_bl_out_of_range
9799         * testsuite/Makefile.in: Regenerate.
9800         * testsuite/arm_bl_in_range.s: New file.
9801         * testsuite/arm_bl_out_of_range.s: Ditto.
9802         * testsuite/arm_branch_in_range.sh: Ditto.
9803         * testsuite/arm_branch_range.t: Ditto.
9804         * testsuite/thumb2_branch_range.t: Ditto.
9805         * testsuite/thumb_bl_in_range.s: Ditto.
9806         * testsuite/thumb_bl_out_of_range.s: Ditto.
9807         * testsuite/thumb_branch_range.t: Ditto.
9808
9809 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9810
9811         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9812         Add reloc offset information.
9813         * icf.cc (get_section_contents): Change iterators to point to the new
9814         vectors. Add reloc offset information to the contents.
9815         * icf.h (Icf::Sections_reachable_info): New typedef.
9816         (Icf::Sections_reachable_list): New typedef.
9817         (Icf::Offset_info): New typedef.
9818         (Icf::Reloc_info): New struct typedef.
9819         (Icf::Reloc_info_list): New typedef.
9820         (Icf::symbol_reloc_list): Delete method.
9821         (Icf::addend_reloc_list): Delete method.
9822         (Icf::section_reloc_list): Delete method.
9823         (Icf::reloc_info_list): New method.
9824         (Icf::reloc_info_list_): New member.
9825
9826 2010-02-19  Doug Kwan  <dougkwan@google.com>
9827
9828         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9829         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9830         * arm.cc (Arm_relocation_functions): New forward declaration.
9831         (Target_arm::Target_arm): Initialize new data members
9832         got_mod_index_offset_ and tls_base_symbol_defined_.
9833         (Target_arm::Relocate::relocate_tls): New method.
9834         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9835          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9836         New methods.
9837         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9838         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9839         (Target_arm::got_mod_index_offset_,
9840         Target_arm::tls_base_symbol_defined_): New data members.
9841         (Target_arm::Scan::local, Target::Scan::global,
9842         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9843         relocations.
9844
9845 2010-02-18  Doug Kwan  <dougkwan@google.com>
9846
9847         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9848         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9849         text section as a parameter becuase some broken tools may not set
9850         the link in section header.
9851         (Target_arm::has_got_section): New method.
9852         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9853         without any mapping symbol as data only.  Remove warning.
9854         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9855         link in its section header, try to discover the link by inspecting the
9856         REL31 relocation at the beginning of the section.
9857         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9858         in error message.
9859         (Target_arm::Scan::global): Treat any reference to the symbol
9860         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9861
9862 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9863
9864         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9865         (Scan::global_reloc_may_be_function_pointer): New function.
9866         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9867         (Scan::global_reloc_may_be_function_pointer): New function.
9868         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9869         (Scan::global_reloc_may_be_function_pointer): New function.
9870         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9871         (Scan::global_reloc_may_be_function_pointer): New function.
9872         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9873         (Scan::global_reloc_may_be_function_pointer): New function.
9874         (Scan::possible_function_pointer_reloc): New function.
9875         (Target_x86_64::can_check_for_function_pointers): New function.
9876         * gc.h (gc_process_relocs): Scan relocation types to determine if
9877         function pointers were taken for targets that support it.
9878         * icf.cc (Icf::find_identical_sections): Include functions for
9879         folding in safe ICF whose pointer is not taken.
9880         * icf.h (Secn_fptr_taken_set): New typedef.
9881         (fptr_section_id_): New member.
9882         (section_has_function_pointers): New function.
9883         (set_section_has_function_pointers): New function.
9884         (check_section_for_function_pointers): New function.
9885         * options.h: Fix comment for safe ICF option.
9886         * target.h (can_check_for_function_pointers): New function.
9887         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9888         Modify icf_safe_test for X86-64.
9889         * testsuite/Makefile.in: Regenerate.
9890         * testsuite/icf_safe_so_test.cc: New file.
9891         * testsuite/icf_safe_so_test.sh: New file.
9892         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9893         (main): Change to take pointer to function kept_func_3.
9894         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9895         folding is done correctly for X86-64.
9896
9897 2010-02-12  David S. Miller  <davem@davemloft.net>
9898
9899         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9900         is_symbolless parameter.
9901         (Output_reloc<SHT_REL>::is_symbolless): New.
9902         (Output_reloc<SHT_REL>::is_symbolless_): New.
9903         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9904         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9905         (Output_reloc<SHT_RELA>::is_symbolless): New.
9906         (Output_data_reloc::add_global): Handle is_symbolless.
9907         (Output_data_reloc::add_global_relative): Likewise.
9908         (Output_data_reloc::add_local): Likewise.
9909         (Output_data_reloc::add_local_relative): Likewise.
9910         (Output_data_reloc::add_symbolless_global_addend): New.
9911         (Output_data_reloc::add_symbolless_local_addend): New.
9912         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9913         is_symbolless.
9914         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9915         instead of ->is_relative_
9916         (Output_reloc::write): Likewise.
9917         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9918         (Output_reloc::write_rel): Simplify.
9919
9920         * sparc.cc (Target_sparc::Scan::local): Use
9921         ->add_symbolless_local_addend as needed.
9922         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9923         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9924         based upon relocation offset.
9925
9926 2010-02-11  Doug Kwan  <dougkwan@google.com>
9927
9928         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9929         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9930         beginning of function.
9931         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9932         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9933         parameter is_32bit in calls to should_apply_static_reloc.
9934         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9935         (check_DATA): Add arm_abs_global.stdout.
9936         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9937         arm_abs_global.stdout): New rules.
9938         (MOSTLLYCLEANFILES): Add arm_abs_global
9939         * Makefile.in: Regenerate.
9940         * testsuite/arm_abs_global.s: New file.
9941         * testsuite/arm_abs_global.sh: Ditto.
9942         * testsuite/arm_abs_lib.s: Ditto.
9943
9944 2010-02-11  Ian Lance Taylor  <iant@google.com>
9945
9946         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9947         Read_relocs task.
9948         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9949         Allocate_commons_task first.
9950         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9951         task, rather than symtab_lock_.
9952         (Gc_process_relocs::~Gc_process_relocs): New function.
9953         (Gc_process_relocs::is_runnable): Check this_blocker_.
9954         (Gc_process_relocs::locks): Use next_blocker_ rather than
9955         blocker_.
9956         (Scan_relocs::~Scan_relocs): New function.
9957         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9958         symtab_lock_.
9959         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9960         next_blocker_.
9961         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9962         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9963         constructor accordingly.
9964         (class Gc_process_relocs): Likewise.
9965         (class Scan_relocs): Likewise.
9966         * common.h (class Allocate_commons_task): Remove symtab_lock_
9967         field, and corresponding constructor parameter.
9968         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9969         symtab_lock_.
9970         (Allocate_commons_task::locks): Likewise.
9971
9972 2010-02-11  Ian Lance Taylor  <iant@google.com>
9973
9974         * gold-threads.h (class Once): Define.
9975         (class Initialize_lock): Rewrite as child of Once.
9976         * gold-threads.cc (class Once_initialize): Define.
9977         (once_pointer_control): New static variable.
9978         (once_pointer, once_arg): New static variables.
9979         (c_run_once): New static function.
9980         (Once::Once, Once::run_once, Once::internal_run): New functions.
9981         (class Initialize_lock_once): Remove.
9982         (initialize_lock_control): Remove.
9983         (initialize_lock_pointer): Remove.
9984         (initialize_lock_once): Remove.
9985         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9986         (Initialize_lock::initialize): Rewrite.
9987         (Initialize_lock::do_run_once): New function.
9988         * archive.cc (Archive::interpret_header): Only clear name if it is
9989         not already empty.
9990         * fileread.cc: Include "gold-threads.h"
9991         (file_counts_lock): New static variable.
9992         (file_counts_initialize_lock): Likewise.
9993         (File_read::release): Only increment counts when using --stats.
9994         Use a lock around the increment.
9995         * parameters.cc (class Set_parameters_target_once): Define.
9996         (set_parameters_target_once): New static variable.
9997         (Parameters::Parameters): Move here from parameters.h.
9998         (Parameters::set_target): Rewrite.
9999         (Parameters::set_target_once): New function.
10000         (Parameters::clear_target): Move here and rewrite.
10001         * parameters.h (class Parameters): Update declarations.  Add
10002         set_parameters_target_once_ field.
10003         (Parameters::Parameters): Move to parameters.cc.
10004         (Parameters::clear_target): Likewise.
10005         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10006         task.
10007         (Start_group::~Start_group): New function.
10008         (Start_group::is_runnable): New function.
10009         (Start_group::locks, Start_group::run): New functions.
10010         (Finish_group::run): Change saw_undefined to size_t.
10011         * readsyms.h (class Start_group): Define.
10012         (class Finish_group): Change saw_undefined_ field to size_t.
10013         (Finish_group::Finish_group): Remove saw_undefined and
10014         this_blocker parameters.  Change all callers.
10015         (Finish_group::set_saw_undefined): New function.
10016         (Finish_group::set_blocker): New function.
10017         * symtab.h (class Symbol_table): Change saw_undefined to return
10018         size_t.  Change saw_undefined_ field to size_t.
10019         * target-select.cc (Set_target_once::do_run_once): New function.
10020         (Target_selector::Target_selector): Initialize set_target_once_
10021         field.  Don't initialize lock_ and initialize_lock_ fields.
10022         (Target_selector::instantiate_target): Rewrite.
10023         (Target_selector::set_target): New function.
10024         * target-select.h (class Set_target_once): Define.
10025         (class Target_selector): Update declarations.  Make
10026         Set_target_once a friend.  Remove lock_ and initialize_lock_
10027         fields.  Add set_target_once_ field.
10028
10029 2010-02-10  Ian Lance Taylor  <iant@google.com>
10030
10031         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10032         queueing any tasks.
10033         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10034         (queue_middle_tasks): Add all blockers before queueing any tasks.
10035         (queue_final_tasks): Likewise.
10036         * token.h (Task_token::add_blockers): New function.
10037         * object.h (Input_objects::number_of_relobjs): New function.
10038
10039 2010-02-10  Ian Lance Taylor  <iant@google.com>
10040
10041         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10042         shared, not if not position independent.
10043         * x86_64.cc (Relocate::relocate_tls): Likewise.
10044         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10045         (tls_pie_pic_test): New target.
10046         * testsuite/Makefile.in: Rebuild.
10047
10048         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10049         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10050         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10051         * testsuite/Makefile.in: Rebuild.
10052
10053 2010-02-09  David S. Miller  <davem@davemloft.net>
10054
10055         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10056         R_SPARC_RELATIVE using ->add_local_relative().
10057         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10058
10059         * output.h (Output_data_dynamic::add_section_size): New method
10060         that takes two Output_data objects.
10061         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10062         entry param.  Handle it in initializers.
10063         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10064         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10065         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10066         arg.
10067         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10068         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10069         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10070         for dynrel_includes_plt.
10071         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10072         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10073         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10074         before .rela.plt
10075         (Target_sparc::do_finalize_sections): Update to pass true for
10076         dynrel_includes_plt.
10077         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10078         output before .rela.plt
10079         (Target_powerpc::do_finalize_sections): Update to pass true for
10080         dynrel_includes_plt when 32-bit.
10081
10082 2010-02-08  Doug Kwan  <dougkwan@google.com>
10083
10084         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10085         method.
10086         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10087         Arm_relobj::scan_section_for_cortex_a8_stubs,
10088         Arm_relobj::do_relocation_section): Instead of calling
10089         Output_section::output_address, use faster
10090         Arm_relobj::simple_input_section_output_address.
10091
10092 2010-02-08  David S. Miller  <davem@davemloft.net>
10093
10094         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10095         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10096         relocation helper function.
10097
10098         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10099         just like R_SPARC_GOT{10,13,22}.
10100         (Target_sparc::Scan::local): Likewise.
10101         (Target_sparc::Relocate:relocate): Likewise.
10102
10103 2010-02-06  Ian Lance Taylor  <iant@google.com>
10104
10105         * configure.ac: Rewrite targetobjs duplicate removal code to use
10106         only shell constructs.
10107         * configure: Rebuild.
10108
10109 2010-02-05  Doug Kwan  <dougkwan@google.com>
10110
10111         PR 11247
10112         * arm.cc (Arm_relobj::section_is_scannable): New method.
10113         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10114         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10115
10116 2010-02-04  Doug Kwan  <dougkwan@google.com>
10117
10118         PR 11247
10119         * arm-reloc-property.cc (cstdio): Include.
10120         * configure.ac (targetobjs): Remove duplicates.
10121         * configure: Regenerate.
10122         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10123         big and little endian version for a given address size.
10124
10125 2010-02-03  Doug Kwan  <dougkwan@google.com>
10126
10127         * arm-reloc-property.cc
10128         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10129         definition.
10130         * arm-reloc-property.h
10131         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10132         New method definition.
10133         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10134         declaration.
10135         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10136         overflow to N.
10137         (GOT_PREL): Change implemented to Y.
10138         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10139         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10140         (Arm_relocate_functions::movw_abs_nc): Remove method.
10141         (Arm_relocate_functions::movt_abs): Ditto.
10142         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10143         (Arm_relocate_functions::thm_movt_abs): Ditto.
10144         (Arm_relocate_functions::movw_rel_nc): Ditto.
10145         (Arm_relocate_functions::movw_rel): Ditto.
10146         (Arm_relocate_functions::movt_rel): Ditto.
10147         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10148         (Arm_relocate_functions:thm_movw_rel): Ditto.
10149         (Arm_relocate_functions:thm_movt_rel): Ditto.
10150         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10151         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10152         New method definitions.
10153         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10154         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10155         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10156         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10157         (Target_arm::Relocate::relocate): Check for non-static or
10158         unimplemented relocation code and exit early.  Change calls to
10159         Target_arm::reloc_uses_thumb_bit and
10160         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10161         instead.  Refactor code to handle similar relocations to increase
10162         code sharing.  Remove check for unsupported relocation code in switch
10163         statement.
10164         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10165         relocation property table to find out size.  Change error message to
10166         print out the name of a relocation code instead of the numeric value.
10167         (Target_arm::scan_reloc_for_stub): Use relocation property table
10168         instead of calling Target_arm::reloc_uses_thumb_bit().
10169
10170 2010-02-02  Doug Kwan  <dougkwan@google.com>
10171
10172         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10173         types of relaxed input section.
10174
10175 2010-02-02  Doug Kwan  <dougkwan@google.com>
10176
10177         * Makefile.am (HFILES): Add arm-reloc-property.h.
10178         (DEFFILES): New.
10179         (TARGETSOURCES): Add arm-reloc-property.cc
10180         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10181         (libgold_a_SOURCES): $(DEFFILES)
10182         * Makefile.in: Regenerate.
10183         * arm-reloc-property.cc: New file.
10184         * arm-reloc-property.h: New file.
10185         * arm-reloc.def: New file.
10186         * arm.cc: Update comments.
10187         (arm-reloc-property.h): New included header.
10188         (arm_reloc_property_table): New global variable.
10189         (Target_arm::do_select_as_default_target): New method definition.
10190         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10191         arm-reloc-property to targ_extra_obj.
10192         * parameters.cc (set_parameters_target): Call
10193         Target::select_as_default_target().
10194         * target.h (Target::select_as_default_target): New method definition.
10195         (Target::do_select_as_default_target): Same.
10196
10197 2010-02-01  Doug Kwan  <dougkwan@google.com>
10198
10199         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10200         first_output_text_section_.
10201         (Arm_exidx_fixup::first_output_text_section): New method definition.
10202         (Arm_exidx_fixup::first_output_text_section_): New data member.
10203         (Arm_exidx_fixup::process_exidx_section): Record the first text
10204         output section seen.
10205         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10206         and entsize in output section header.
10207
10208 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10209
10210         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10211         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10212         (Arm_relocate_functions::thm_alu11): New Method.
10213         (Arm_relocate_functions::thm_pc8): New Method.
10214         (Arm_relocate_functions::thm_pc12): New Method.
10215         (Target_arm::Scan::local): Handle the relocations.
10216         (Target_arm::Scan::global): Likewise.
10217         (Target_arm::Relocate::relocate): Likewise.
10218         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10219
10220 2010-01-29  Doug Kwan  <dougkwan@google.com>
10221
10222         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10223         of relocation types as ld.
10224
10225 2010-01-29  Doug Kwan  <dougkwan@google.com>
10226
10227         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10228         to public.
10229         (Arm_relocate_functions::thumb_branch_common): Ditto.
10230         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10231         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10232         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10233         Arm_relocate_functions::jump24): Remove.
10234         (Target_arm::Relocate::relocate): Adjust code to call
10235         Arm_relocation_functions::arm_branch_common and
10236         Arm_relocation_functions::thumb_branch_common instead of their removed
10237         wrappers.  Merge switch-cases together to reduce source code size.
10238
10239 2010-01-29  Doug Kwan  <dougkwan@google.com>
10240
10241         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10242         output_local_symbol_count_needs_update_.
10243         (Arm_relobj::output_local_symbol_count_needs_update,
10244          Arm_relobj::set_output_local_symbol_count_needs_update,
10245          Arm_relobj::update_output_local_symbol_count): New methods.
10246         (Arm_relobj::output_local_symbol_count_needs_update_): New data
10247         member.
10248         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10249         of pointed function as in a R_ARM_PREL31 relocation.
10250         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10251         for output local symbol count updating.
10252         (Target_arm::do_relax): Update output local symbol counts in objects
10253         if necessary.
10254         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10255
10256 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10257
10258         * arm.cc: Added support for the ARM relocations:
10259         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10260         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10261         (Arm_relocate_functions::movw_rel_nc): Renamed (was
10262         movw_prel_nc).
10263         (Arm_relocate_functions::movw_rel): New method.
10264         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10265         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10266         thm_movw_prel_nc).
10267         (Arm_relocate_functions::thm_movw_rel): New method.
10268         (Arm_relocate_functions::thm_movt_rel): Renamed (was
10269         thm_movt_prel).
10270         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10271         relocations.
10272         (Target_arm::Scan::global): Likewise.
10273         (Target_arm::Relocate::relocate): Likewise.
10274         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10275         Likewise.
10276
10277 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10278
10279         * arm.cc: Added support for ARM group relocations.
10280         (Target_arm::reloc_needs_sym_origin): New method.
10281         (Arm_relocate_functions::calc_grp_kn): New method.
10282         (Arm_relocate_functions::calc_grp_residual): New method.
10283         (Arm_relocate_functions::calc_grp_gn): New method.
10284         (Arm_relocate_functions::arm_grp_alu): New Method.
10285         (Arm_relocate_functions::arm_grp_ldr): New Method.
10286         (Arm_relocate_functions::arm_grp_ldrs): New Method.
10287         (Arm_relocate_functions::arm_grp_ldc): New Method.
10288         (Target_arm::Scan::local): Handle the ARM group relocations.
10289         (Target_arm::Scan::global): Likewise.
10290         (Target_arm::Relocate::relocate): Likewise.
10291         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10292         Likewise.
10293
10294 2010-01-26  Doug Kwan  <dougkwan@google.com>
10295
10296         * arm.cc (set): Include.
10297         (class Arm_exidx_fixup): Change type of last_input_section_ to const
10298         pointer type.
10299         (Arm_output_section::Text_section_list): New type.
10300         (Arm_output_section::append_text_sections_to_list): New method.
10301         (Arm_output_section::fix_exidx_coverage): Ditto.
10302         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10303         (Arm_relobj::convert_input_section_to_relaxed_section): Use
10304         Relobj::set_section_offset() instead of
10305         Sized_relobj::invalidate_section_offset().
10306         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10307         parameter for section headers. Ignore relocation sections for
10308         unallocated sections and EXIDX sections.
10309         (Target_arm::fix_exidx_coverage): New method.
10310         (Target_arm::output_section_address_less_than): New type.
10311         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10312         linked text section instead of the EXIDX section.
10313         (Arm_output_section::create_stub_group): Add an assertion to check
10314         that this is not an EXIDX output section.
10315         (Arm_output_section::append_text_sections_to_list): New method.
10316         (Arm_output_section::fix_exidx_coverage): Ditto.
10317         (Arm_relobj::scan_sections_for_stubs): Adjust call to
10318         Arm_relobj::section_needs_reloc_stub_scanning.
10319         (Target_arm::do_relax): Fix EXIDX output section coverage in the
10320         first pass.
10321         (Target_arm::fix_exidx_coverage): New method.
10322         * object.h (Relobj::set_output_section): New method.
10323         (Sized_relobj::invalidate_section_offset): Remove method.
10324         (Sized_relobj::do_invalidate_section_offset): Remove method.
10325         (Sized_relobj::do_set_section_offset): Handle offset value -1.
10326
10327 2010-01-25  Doug Kwan  <dougkwan@google.com>
10328
10329         * arm.cc (Arm_exidx_merged_section::do_output_offset):
10330         Fix warning due to signed and unsigned comparison on a 32-bit host.
10331
10332 2010-01-22  Doug Kwan  <dougkwan@google.com>
10333
10334         * arm.cc (Target_arm::do_relax): Record an output section for section
10335         offset adjustment it contains any stub table that has changed.
10336         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10337         offsets in an output section if necessary.
10338         * output.cc (Output_section::Output_section): Initialize
10339         section_offsets_need_adjustments_.
10340         (Output_section::add_input_section_for_script): Renamed to
10341         Output_section::add_simple_input_section.
10342         (Output_section::save_states): Add a comment.
10343         (Output_section::discard_states): New method defintion.
10344         (Output_section::adjust_section_offsets): Same.
10345         * output.h (Output_section::add_input_section_for_script): Renamed to
10346         Output_section::add_simple_input_section.
10347         (Output_section::discard_states): New method declaration.
10348         (Output_section::adjust_section_offsets): Same.
10349         (Output_section::section_offsets_need_adjustment,
10350         Output_section::set_section_offsets_need_adjustment): New method
10351         definitions.
10352         (Output_section::section_offsets_need_adjustment_): New data member.
10353         * script-sections.cc
10354         (Output_section_element_input::set_section_address): Adjust code for
10355         renaming of Output_section::add_input_section_for_script.
10356         (Orphan_output_section::set_section_address): Same.
10357
10358 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10359
10360         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10361         Fix_v4bx enum values .
10362         * gold/options.h (General_options): New option definitions.
10363         (General_options::fix_v4bx): New method.
10364         (General_options::Fix_v4bx): New enum.
10365         * gold/options.cc (General_options::parse_fix_v4bx): New method.
10366         (General_options::parse_fix_v4bx_interworking): New method.
10367
10368 2010-01-22  Doug Kwan  <dougkwan@google.com>
10369
10370         * arm.cc (Arm_exidx_fixup): New class.
10371
10372 2010-01-21  Doug Kwan  <dougkwan@google.com>
10373
10374         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10375         classes.
10376         (Arm_exidx_section_offset_map): New type.
10377
10378 2010-01-21  Doug Kwan  <dougkwan@google.com>
10379
10380         * arm.cc (Arm_exidx_input_section): New class.
10381         (Arm_relobj::exidx_input_section_by_link,
10382         Arm_relobj::exidx_input_section_by_shndx,
10383         Arm_relobj::make_exidx_input_section): New methods.
10384         (read_arm_attributes_section): Remove.
10385         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10386         information about them.
10387         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10388         to here.
10389
10390 2010-01-20  Doug Kwan  <dougkwan@google.com>
10391
10392         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10393         Input_section_specifier to Section_id.
10394         (Target_arm::new_arm_input_section: Adjust code for change of key
10395         type.
10396         (Target_arm::find_arm_input_section): Ditto.
10397         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10398         (Section_id): Remove.
10399         (Garbage_collection::Section_id_hash): Remove.
10400         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10401         (Section_id): Remove.
10402         (Icf::Section_id_hash): Remove.
10403         * object.h (Section_id, Const_section_id, Section_id_hash,
10404         Const_section_id_hash): New type definitions.
10405         * output.cc (Output_section::add_relaxed_input_section): Change to
10406         use Const_section_id instead of Input_section_specifier as key type.
10407         (Output_section::add_merge_input_section): Ditto.
10408         (Output_section::build_relaxation_map): Change to use Section_id
10409         instead of Input_section_specifier as key type.
10410         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10411         Ditto.
10412         (Output_section::convert_input_sections_to_relaxed_sections): Change
10413         to use Const_section_id instead of Input_section_specifier as key type.
10414         (Output_section::find_merge_section): Ditto.
10415         (Output_section::find_relaxed_input_section): Ditto.
10416         * output.h (Input_section_specifier): Remove class.
10417         (Output_section::Output_section_data_by_input_section_map): Change
10418         key type to Const_section_id.
10419         (Output_section::Output_relaxed_input_section_by_input_section_map):
10420         Ditto.
10421         (Output_section::Relaxation_map): Change key type to Section_id.
10422
10423 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10424
10425         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10426         (class Arm_v4bx_stub): New class.
10427         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10428         (Stub_factory::make_arm_v4bx_stub): New method.
10429         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10430         (Stub_table::empty): Handle v4bx stubs.
10431         (Stub_table::add_arm_v4bx_stub): New method.
10432         (Stub_table::find_arm_v4bx_stub): New method.
10433         (Arm_relocate_functions::v4bx): New method.
10434         (Target_arm::fix_v4bx): New method.
10435         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10436         (Stub_table::relocate_stubs): Likewise.
10437         (Stub_table::do_write): Likewise.
10438         (Stub_table::update_data_size_and_addralign): Likewise.
10439         (Stub_table::finalize_stubs):  Likewise.
10440         (Target_arm::Scan::local): Likewise.
10441         (Target_arm::Scan::global): Likewise.
10442         (Target_arm::do_finalize_sections): Likewise.
10443         (Target_arm::Relocate::relocate): Likewise.
10444         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10445         Likewise.
10446         (Target_arm::scan_reloc_for_stub): Likewise.
10447         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10448
10449 2010-01-19  Ian Lance Taylor  <iant@google.com>
10450
10451         * output.cc (Output_section_headers::do_sized_write): Write large
10452         segment count to sh_info field.
10453         (Output_file_header::do_sized_write): For large segment count,
10454         write PN_XNUM to e_phnum field.
10455
10456 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10457
10458         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10459         (Arm_relocate_functions::thm_jump8): New function.
10460         (Arm_relocate_functions::thm_jump11): New function.
10461         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10462         R_ARM_THM_JUMP11.
10463         (Target_arm::Scan::global): Likewise.
10464         (Target_arm::Relocate::relocate): Likewise.
10465         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10466         Likewise.
10467
10468 2010-01-14  Doug Kwan  <dougkwan@google.com>
10469
10470         * arm.cc (map, utility): Include headers.
10471         (Target_arm::apply_cortex_a8_workaround): New method.
10472         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10473         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10474         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10475         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10476         the --[no-]fix-cortex-a8 command line options.
10477         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10478         (Target_arm::relocate_stub): Use addend in instruction template.
10479         * options.h (DEFINE_bool): Set the user-set flag.
10480         (General_options): Add --[no-]-fix-cortex options.
10481         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10482         : Update fast look-up map after conversion.
10483
10484 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10485
10486         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10487         in the first pass of do_layout.
10488
10489 2010-01-13  Doug Kwan  <dougkwan@google.com>
10490
10491         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10492         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10493         apparent compiler problem of not folding static constant integral
10494         data members of elfcpp::Elf_sizes<32>.
10495
10496 2010-01-13  Doug Kwan  <dougkwan@google.com>
10497
10498         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10499         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10500         Arm_relobj::scan_section_for_cortex_a8_erratum,
10501         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10502         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10503         sections to scan for relocation stubs into a new method
10504         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10505         relocation and Cortex-A8 stub scanning.
10506         (Target_arm::do_relax): Force stubs to be after stubbed sections
10507         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10508         the beginning of a new relaxation pass.  Update a comment.
10509         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10510
10511 2010-01-12  Ian Lance Taylor  <iant@google.com>
10512
10513         * target-reloc.h (visibility_error): New inline function.
10514         (relocate_section): Call visibility_error.
10515         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10516         (MOSTLYCLEANFILES): Likewise.
10517         (protected_4_pic.o, protected_3.err): New targets.
10518         * testsuite/protected_4.cc: New file.
10519
10520 2010-01-12  Doug Kwan  <dougkwan@google.com>
10521
10522         * arm.cc (Cortex_a8_reloc): New class.
10523         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10524         and cortex_a8_relocs_info_.
10525         (Target_arm::fix_cortex_a8): New method definition.
10526         (Target_arm::Cortex_a8_relocs_info): New type.
10527         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10528         New data member declarations.
10529         (Target_arm::scan_reloc_for_stub): Record information about
10530         relocations for THUMB branches that might be exempted from the
10531         Cortex-A8 workaround.
10532         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10533         at the beginning of a relaxation pass.
10534
10535 2010-01-12  Doug Kwan  <dougkwan@google.com>
10536
10537         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10538         (Arm_relobj::Mapping_symbol_position,
10539          Arm_reloj::Mapping_symbol_position_less,
10540          Arm_relobj::Mapping_symbols_info): New types.
10541         (Target_arm::is_mapping_symbol_name): New method definition.
10542         (Arm_relobj::do_count_local_symbols): Save information about mapping
10543         symbols.
10544
10545 2010-01-11  Doug Kwan  <dougkwan@google.com>
10546
10547         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10548         Arm_relocate_functions::thumb32_branch_upper,
10549         Arm_relocate_functions::thumb32_branch_lower,
10550         Arm_relocate_functions::thumb32_cond_branch_offset,
10551         Arm_relocate_functions::thumb32_cond_branch_upper,
10552         Arm_relocate_functions::thumb32_cond_branch_lower,
10553         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10554         branch offset encoding.
10555         (Arm_relocate_functions::thumb_branch_common): Use new branch
10556         offset encoding methods to avoid code duplication.
10557         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10558         (Stub_addend_reader::operator()): Use new branch encoding method
10559         to avoid code duplication.
10560
10561 2010-01-11  Doug Kwan  <dougkwan@google.com>
10562
10563         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10564         (Target_arm::do_finalize_sections): Define special EXIDX section
10565         symbols only if referenced.
10566         * gc.h (Garbage_collection::add_reference): New method.
10567         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10568         code duplication.
10569
10570 2010-01-11  Ian Lance Taylor  <iant@google.com>
10571
10572         * script.cc (Version_script_info::build_expression_list_lookup):
10573         Change complaing about duplicate wildcard match from error to
10574         warning.
10575
10576         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10577         of 2009-12-30.
10578         (Version_script_info::Version_script_info): Initialize globs_,
10579         default_version_, default_is_global_, and exact_.  Don't
10580         initialize globals_ or locals_.
10581         (Version_script_info::build_lookup_tables): Build local symbols
10582         first.
10583         (Version_script_info::unquote): New function.
10584         (Version_script_info::add_exact_match): New function.
10585         (Version_script_info::build_expression_list_lookup): Remove lookup
10586         parameter.  Add is_global parameter.  Change all callers.  Handle
10587         wildcard pattern specially.  Unquote pattern.  Call
10588         add_exact_match.
10589         (Version_script_info::get_name_to_match): New function.
10590         (Version_script_info::get_symbol_version): New function.
10591         (Version_script_info::get_symbol_version_helper): Remove.
10592         (Version_script_info::check_unmatched_names): Call unquote.
10593         * script.h (class Version_script_info): Change get_symbol_version
10594         to be non-inline and add is_global parameter; change all callers.
10595         Rewrite symbol_is_local.  Update declarations.  Define struct
10596         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10597         Remove globals_ and locals_ members.  Add exact_, globs_,
10598         default_version_, is_global_.
10599         (Version_script_info::Glob): Remove pattern, add expression and
10600         is_global.  Update constructor.  Change all callers.
10601         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10602         default version.
10603         (Versions::symbol_section_contents): If a symbol is undefined, or
10604         defined in a dynamic object, set the version index to
10605         VER_NDX_LOCAL.
10606         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10607         symbol_is_local.
10608         (Symbol_table::add_from_pluginobj): Likewise.
10609         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10610
10611 2010-01-11  Doug Kwan  <dougkwan@google.com>
10612
10613         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10614         (incremental_dump_LDADD): Add linking option for libintl.
10615         * Makefile.in: Regenerate.
10616
10617 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10618
10619         PR gold/11144
10620         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10621         instead of -Ds.
10622         * testsuite/Makefile.in: Regenerated.
10623
10624 2010-01-10  Doug Kwan  <dougkwan@google.com>
10625
10626         * options.h (DEFINE_var): Use parentheses around argument varname__
10627         in macro body to avoid any unintended subsequent substitutions.
10628
10629 2010-01-10  Ian Lance Taylor  <iant@google.com>
10630
10631         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10632         candidates before doing symbol resolution.
10633
10634         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10635         ODR candidates if only one is weak.
10636
10637 2010-01-08  Ian Lance Taylor  <iant@google.com>
10638
10639         * script.cc (Version_script_info::build_expression_list_lookup):
10640         Don't warn about ambiguous version, just record the ambiguity.
10641         (Version_script_info::get_symbol_version_helper): Give error if
10642         version is ambiguous.
10643
10644 2010-01-08  Doug Kwan  <dougkwan@google.com>
10645
10646         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10647         prev_data_size_ and prev_addralign_.  Remove initializer for
10648         deleted data member has_been_changed_.
10649         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10650         to determine if the table is empty.
10651         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10652         Remove.
10653         (Stub_table::add_reloc_stub): Define method in class definition
10654         instead of just declaring it there.
10655         (Stub_table::add_cortex_a8_stub): New method definition.
10656         (Stub_table::update_data_size_and_addralign): Ditto.
10657         (Stub_table::finalize_stubs): Ditto.
10658         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10659         (Stub_table::do_addralign_): Return address alignment in the
10660         (Stub_table::do_reset_address_and_file_offset): Define method in
10661         class definition instead of declaring it there.  Set current data
10662         size to be the data size of the previous pass.
10663         (Stub_table::set_final_data_size): Use current data size as the
10664         final data size.
10665         (Stub_table::relocate_stub): Change parameter type of stub from
10666         Reloc_stub pointer to Stub pointer.
10667         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10668         (Stub_table::Cortex_a8_stub_list): New typedef.
10669         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10670          Stub_table::prev_addralign_): New data member.
10671         (Arm_relobj::Arm_relobj): Initialize data member
10672         section_has_cortex_a8_workaround_.
10673         (Arm_relobj::section_has_cortex_a8_workaround,
10674          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10675          definitions.
10676         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10677         declarations.
10678         (Target_arm::relocate_stub): Change parameter type of stub from
10679         Reloc_stub pointer to Stub pointer.
10680         (Insn_template::size, Insn_template::alignment): Handle
10681         THUMB16_SPECIAL_TYPE.
10682         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10683          Stub_table::update_data_size_and_addralign,
10684          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10685         definitions.
10686         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10687         (Stub_table::do_write): Ditto.
10688         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10689
10690 2010-01-08  Ian Lance Taylor  <iant@google.com>
10691
10692         PR 11108
10693         * symtab.h (class Symbol): Remove fields is_target_special_ and
10694         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10695         (Symbol::is_defined_in_discarded_section): New function.
10696         (Symbol::set_is_defined_in_discarded_section): New function.
10697         (Symbol::has_plt_offset): Rewrite.
10698         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10699         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10700         Don't initialize is_target_special_ or has_plt_offset_.
10701         Initialize is_defined_in_discarded_section_.
10702         (Symbol_table::add_from_relobj): If appropriate, set
10703         is_defined_in_discarded_section.
10704         * resolve.cc (Symbol::override_base_with_special): Don't test
10705         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10706         * target-reloc.h (relocate_section): Do special handling for
10707         symbols defined in discarded sections for global symbols as well
10708         as local symbols.
10709
10710 2010-01-08  Ian Lance Taylor  <iant@google.com>
10711
10712         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10713         the SHT_SYMTAB case.
10714
10715 2010-01-08  Ian Lance Taylor  <iant@google.com>
10716
10717         * object.cc (Sized_relobj::do_layout): Don't get confused if
10718         layout_eh_frame returns NULL.
10719
10720 2010-01-08  Ian Lance Taylor  <iant@google.com>
10721
10722         PR 11084
10723         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10724         dynamic symbol table, use the normal symbol table.
10725         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10726         symbol table.
10727
10728 2010-01-08  Ian Lance Taylor  <iant@google.com>
10729
10730         PR 11072
10731         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10732         sections.
10733
10734 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10735
10736         * version.cc (print_version): Change to "Copyright 2010".
10737
10738 2010-01-08  Ian Lance Taylor  <iant@google.com>
10739
10740         PR 10287
10741         PR 11063
10742         * i386.cc (class Target_i386): Change return type of plt_section
10743         to be non-const.
10744         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10745         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10746         tls_desc_rel_ field.
10747         (Output_data_plt_i386::rel_tls_desc): New function.
10748         (Target_i386::rel_tls_desc_section): New function.
10749         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10750         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10751         R_386_TLS_DESC reloc in rel_tls_desc_section.
10752         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10753         Define struct Tlsdesc_info.
10754         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10755         (Target_x86_64::do_reloc_symbol_index): New function.
10756         (Target_x86_64::add_tlsdesc_info): New function.
10757         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10758         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10759         tlsdesc_rel_ field.
10760         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10761         all callers.
10762         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10763         (Target_x86_64::rela_tlsdesc_section): New function.
10764         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10765         handling.
10766         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10767         (Target_x86_64::do_reloc_addend): New function.
10768         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10769         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10770         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10771         (Output_reloc::type): New function.
10772         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10773         (Output_reloc::is_target_specific): New function.
10774         (Output_reloc::target_arg): New function.
10775         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10776         absolute relocs and target specific relocs.
10777         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10778         add_target_specific.
10779         (class Output_data_reloc) [SHT_RELA]: Likewise.
10780         * output.cc (Output_reloc::Output_reloc): Add four new versions
10781         for absolute relocs and target specific relocs.
10782         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10783         (Output_reloc::get_symbol_index): Likewise.
10784         (Output_reloc::local_section_offset): Check that local_sym_index_
10785         is not TARGET_CODE or 0.
10786         (Output_reloc::symbol_value): Likewise.
10787         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10788         reloc.
10789         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10790         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10791         functions.
10792         * layout.cc (add_target_dynamic_tags): Use output section for
10793         DT_PLTRELSZ and DT_JMPREL.
10794
10795 2010-01-07  Ian Lance Taylor  <iant@google.com>
10796
10797         PR 11061
10798         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10799         function.
10800         (class Output_data_reloc_generic): Define.
10801         (class Output_data_reloc_base): Change base class to
10802         Output_data_reloc_generic.  Change add() method to call
10803         bump_relative_reloc_count for a relative reloc.  Remove
10804         sort_relocs_ field.
10805         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10806         to sort_relocs().
10807         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10808         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10809         appropriate.
10810         * layout.h (class Layout): Update declaration.
10811
10812 2010-01-07  Ian Lance Taylor  <iant@google.com>
10813
10814         * output.h (class Output_data): Add const version of
10815         output_section and do_output_section.
10816         (class Output_section_data): Add const version of
10817         do_output_section.
10818         (class Output_section): Likewise.
10819         * layout.cc (Layout::add_target_dynamic_tags): New function.
10820         * layout.h (class Layout): Update declarations.
10821         * arm.cc (Target_arm::do_finalize_sections): Use
10822         add_target_dynamic_tags.
10823         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10824         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10825         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10826         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10827
10828 2010-01-07  Ian Lance Taylor  <iant@google.com>
10829
10830         PR 11042
10831         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10832         object as needed.
10833
10834 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10835             Ian Lance Taylor  <iant@google.com>
10836
10837         PR 11019
10838         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10839         Xindex::read_symtab_xindex.
10840
10841 2010-01-07  Doug Kwan  <dougkwan@google.com>
10842
10843         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10844         (Insn_template::thumb16_bcond_insn): New method declaration.
10845         (Insn_template): Fix spelling.
10846         (Stub::thumb16_special): New method declaration.
10847         (Stub::do_write): Define virtual method which was previously pure
10848         virtual.
10849         (Stub::do_thumb16_special): New method declaration.
10850         (Stub::do_fixed_endian_write): New template member.
10851         (Reloc_stub::do_write): Remove.
10852         (Reloc_stub::do_fixed_endian_write): Remove.
10853         (Cortex_a8_stub): New class definition.
10854         (Stub_factory::make_cortex_a8_stub): New method definition.
10855         (Stub_factory::Stub_factory): Add missing static storage class
10856         qualifier for elf32_arm_stub_a8_veneer_blx.
10857
10858 2010-01-07  Ian Lance Taylor  <iant@google.com>
10859
10860         PR 10980
10861         * options.h (class General_options): Add --warn-unresolved-symbols
10862         and --error-unresolved-symbols.
10863         * errors.cc (Errors::undefined_symbol): Implement
10864         --warn-unresolved-symbols.
10865
10866         * options.h (class General_options): Add -z text and -z textoff.
10867         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10868
10869 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10870
10871         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10872         (Garbage_collection::cident_sections): New function.
10873         (Garbage_collection::add_cident_section): New function.
10874         (Garbage_collection::cident_sections_): New member.
10875         (gc_process_relocs): Add references to sections whose names are C
10876         identifiers.
10877         * gold.h (cident_section_start_prefix): New constant.
10878         (cident_section_stop_prefix): New constant.
10879         (is_cident): New function.
10880         * layout.cc (Layout::define_section_symbols): Replace string constants
10881         with the newly defined constants.
10882         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10883         C identifiers.
10884         * testsuite/Makefile.am: Add gc_orphan_section_test.
10885         * testsuite/Makefile.in: Regenerate.
10886         * testsuite/gc_orphan_section_test.cc: New file.
10887         * testsuite/gc_orphan_section_test.sh: New file.
10888
10889 2010-01-06  Ian Lance Taylor  <iant@google.com>
10890
10891         PR 10980
10892         * options.h (class General_options): Add --warn-shared-textrel.
10893         * layout.cc (Layout::finish_dynamic_section): Implement
10894         --warn-shared-textrel.
10895
10896         PR 10980
10897         * options.h (class General_options): Add --warn-multiple-gp.
10898
10899 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10900
10901         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10902         $(THREADSLIB) and $(LIBDL).
10903         * Makefile.in: Rebuild.
10904
10905 2010-01-06  Ian Lance Taylor  <iant@google.com>
10906
10907         PR 10980
10908         * options.cc (General_options::parse_section_start): New function.
10909         (General_options::section_start): New function.
10910         (General_options::General_options): Initialize all members.
10911         * options.h: Include <map>
10912         (class General_options): Add --section-start.  Add section_starts_
10913         member.
10914         * layout.cc (Layout::attach_allocated_section_to_segment): If
10915         --section-start was used, set the address of the segment.  Remove
10916         local sort_sections.
10917         (Layout::relaxation_loop_body): If the address of the load segment
10918         has been set by --section-start, don't use it.
10919         * output.h (Output_segment::update_flags_for_output_section): New
10920         function.
10921         * output.cc (Output_segment::add_output_section): Call
10922         update_flags_for_output_section.
10923
10924 2010-01-05  Ian Lance Taylor  <iant@google.com>
10925
10926         PR 10980
10927         * options.h (class General_options): Add --undefined-version.
10928         * script.cc (struct Version_expression): Add was_matched_by_symbol
10929         field.
10930         (Version_script_info::matched_symbol): New function.
10931         (Version_script_info::get_symbol_version_helper): Call
10932         matched_symbol.
10933         (Version_script_info::check_unmatched_names): New function.
10934         * script.h (class Version_script_info): Update declarations.
10935         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10936
10937         * options.h (class General_options): Use DEFINE_bool_alias for
10938         allow_multiple_definition.
10939         * resolve.cc (Symbol_table::should_override): Don't test
10940         allow_multiple_definition.
10941
10942         PR 10980
10943         * options.h (class General_options): Add --cref.
10944         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10945         until after printing cref table.
10946         * cref.cc: Include "symtab.h".
10947         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10948         (Cref_table_compare::operator()): New function.
10949         (Cref_inputs::gather_cref): New function.
10950         (filecol): New static const.
10951         (Cref_inputs::print_cref): New function.
10952         (Cref::print_cref): New function.
10953         * cref.h: Include <cstdio>.
10954         (class Cref): Update declarations.
10955         * mapfile.h (Mapfile::file): New function.
10956         * object.h (class Object): Define Symbols.  Declare virtual
10957         do_get_global_symbols.
10958         (Object::get_global_symbols): New function.
10959         * object.cc (Input_objects::add_object): Pass object to cref_ if
10960         --cref.
10961         (Input_objects::archive_start): Likewise.
10962         (Input_objects::archive_stop): Likewise.
10963         (Input_objects::print_cref): New function.
10964         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10965         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10966         --cref.
10967         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10968         function.
10969         * plugin.h (class Sized_pluginobj): Update declarations.
10970
10971 2010-01-05  Ian Lance Taylor  <iant@google.com>
10972
10973         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10974         to is_default_version.  Rename insdef to insdefault.
10975         (Symbol_table::add_from_relobj): Rename def to is_default_version
10976         and local to is_forced_local.
10977         (Symbol_table::add_from_pluginobj): Likewise.
10978         (Symbol_table::add_from_dynobj): Likewise.
10979         (Symbol_table::define_special_symbol): Rename insdef to
10980         insdefault.
10981
10982 2010-01-04  Ian Lance Taylor  <iant@google.com>
10983
10984         PR 10980
10985         * options.h (class General_options): Add
10986         --allow-multiple-definition and -z muldefs.
10987         * resolve.cc (Symbol_table::should_override): Don't warn about a
10988         multiple symbol definition if --allow-multiple-definition or -z
10989         muldefs.
10990
10991         PR 10980
10992         * options.h (class General_options): Add --add-needed and
10993         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10994         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10995         error if --copy-dt-needed-entries aka --add-needed is used and
10996         would cause a change in behaviour.
10997
10998         PR 10980
10999         * options.h (class General_options): Add -G as a short version of
11000         --shared.  Add no-op options -assert, -g, and -i.
11001
11002 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11003
11004         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11005         check for .text or .gnu.linkonce.t sections.
11006         * icf.cc (Icf::find_identical_sections): Ditto.
11007         Change the detection for mangled function name within the section
11008         name.
11009         * icf.h (is_section_foldable_candidate): New function.
11010
11011 2009-12-30  Ian Lance Taylor  <iant@google.com>
11012
11013         PR 10980
11014         * options.h (class General_options): Permit two dashes with
11015         --retain-symbols-file.
11016
11017 2009-12-30  Ian Lance Taylor  <iant@google.com>
11018
11019         PR 10979
11020         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11021         don't put the file header and segment headers in the text
11022         segment.
11023
11024         PR 10979
11025         * common.cc (Sort_commons::operator()): Stabilize sort when both
11026         entries are NULL.
11027         (Symbol_table::do_allocate_commons_list): When allocating common
11028         symbols, skip a symbol which is no longer common.
11029         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11030         an object before checking its type.
11031         * testsuite/common_test_2.c: New file.
11032         * testsuite/common_test_3.c: New file.
11033         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11034         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11035         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11036         (common_test_2_pic.o, common_test_2.so): New targets.
11037         (common_test_3_pic.o, common_test_3.so): New targets.
11038         * testsuite/Makefile.in: Rebuild.
11039
11040         PR 10979
11041         * script.cc (read_input_script): If we see a new SECTIONS clause,
11042         and we have added an input section, give an error.
11043         * layout.h (class Layout): Add have_added_input_section function.
11044         Add have_added_input_section_ field.
11045         * layout.cc (Layout::Layout): Initialize
11046         have_added_input_section_.
11047         (Layout::layout): Set have_added_input_section_.
11048         (Layout::layout_eh_frame): Likewise.
11049
11050 2009-12-30  Ian Lance Taylor  <iant@google.com>
11051
11052         PR 10931
11053         * options.h (class General_options): Add --sort-common option.
11054         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11055         * common.cc (Sort_common): Add sort_order parameter to
11056         constructor.  Add sort_order_ field.
11057         (Sort_commons::operator): Check sort_order_.
11058         (Symbol_table::allocate_commons): Determine the sort order.
11059         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11060         Change all callers.
11061         (Symbol_table::do_allocate_commons_list): Likewise.
11062
11063 2009-12-30  Ian Lance Taylor  <iant@google.com>
11064
11065         PR 10916
11066         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11067         symbols from this object, don't change the visibility of an
11068         undefined symbol.
11069         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11070
11071 2009-12-30  Ian Lance Taylor  <iant@google.com>
11072
11073         PR 10861
11074         * script.h (class Version_script_info): Define Language enum.
11075         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11076         new fields globals_, locals_, and is_finalized_.
11077         * script.cc: Various formatting fixes.
11078         (class Parser_closure): Change language_stack_ from a vector of
11079         std::string to one of Version_script_info::Language.  Adjust all
11080         uses accordingly.
11081         (class Lazy_demangler): Remove.
11082         (struct Version_expression): Change language from std::string to
11083         Version_script_info::Language.
11084         (Version_script_info::Version_script_info): New function.
11085         (Version_script_info::~Version_script_info): Don't call clear.
11086         (Version_script_info::finalize): New function.
11087         (Version_script_info::build_lookup_tables): New function.
11088         (Version_script_info::build_expression_list_lookup): New
11089         function.
11090         (Version_script_info::get_symbol_version_helper): Rewrite to use
11091         lookup tables.
11092         (Version_script_info::print_expression_list): Adjust to use
11093         Version_script_info::Language.
11094         (script_push_lex_into_version_mode): Check that the version script
11095         has not been finalized.
11096         (version_script_push_lang): Change language string to
11097         Version_script_info::Language.
11098         * options.cc (Command_line::version_script): New function.
11099         * options.h (class General_options): Add finalize_dynamic_list
11100         function.  Change version_script from declaration to definition.
11101         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11102         * testsuite/version_script.map: Remove duplicate def of foo.
11103         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11104         version_script.map.
11105         * testsuite/Makefile.in: Rebuild.
11106
11107 2009-12-30  Ian Lance Taylor  <iant@google.com>
11108
11109         PR 10843
11110         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11111         if the input symbol index is 0, make the output symbol index 0.
11112
11113 2009-12-30  Ian Lance Taylor  <iant@google.com>
11114
11115         PR 10670
11116         * options.h (class General_options): Add -x/--discard-all.
11117         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11118         --discard-all.  If the local symbol needs a dynamic entry, check
11119         that before handling --discard-locals.
11120
11121 2009-12-30  Ian Lance Taylor  <iant@google.com>
11122
11123         PR 10450
11124         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11125         flags to PF_R.
11126         (Output_segment::add_output_section): Don't change the flags if
11127         the type is PT_TLS.
11128
11129         PR 10450
11130         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11131         GNU hash table if they need a dynamic value.  Otherwise, don't add
11132         them if they are defined in a dynamic object or are forced local.
11133
11134 2009-12-29  Ian Lance Taylor  <iant@google.com>
11135
11136         PR 10450
11137         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11138         .gnu.hash table for a 32-bit target.
11139
11140         PR 10450
11141         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11142         regular and a dynamic object only needs a dynamic symbol table
11143         entry if it is externally visible.
11144
11145         PR 10450
11146         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11147         constructor.  Add global_offset_table_ field.
11148         (Target_i386::got_section): Set global_offset_table_.
11149         (Target_i386::do_finalize_sections): Set global_offset_table_
11150         size.
11151         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11152         in constructor.  Add global_offset_table_ field.
11153         (Target_x86_64::got_section): Set global_offset_table_.
11154         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11155         size.
11156
11157         * layout.cc (Layout::Layout): Initialize increase_relro_.
11158         (Layout::get_output_section): Add is_relro, is_last_relro, and
11159         is_first_non_relro parameters.  Change all callers.
11160         (Layout::choose_output_section): Likewise.
11161         (Layout::add_output_section_data): Likewise.
11162         (Layout::make_output_section): Likewise.
11163         (Layout::set_segment_offsets): Clear increase_relro when using a
11164         linker script.
11165         * layout.h (class Layout): Add increase_relro method.  Add
11166         increase_relro_ field.  Update declarations.
11167         * output.cc (Output_section::Output_section): Initialize
11168         is_last_relro_ and is_first_non_relro_.
11169         (Output_segment::add_output_section): Group relro sections is
11170         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11171         (Output_segment::maximum_alignment): Remove relro handling.
11172         (Output_segment::set_section_addresses): Add increase_relro
11173         parameter.  Change all callers.  Add initial alignment to align
11174         relro sections on separate page.  Remove old relro handling.
11175         (Output_segment::set_section_list_addresses): Remove in_relro
11176         parameter.  Change all callers.
11177         (Output_segment::set_offset): Add increase parameter.  Change all
11178         callers.  Remove old relro handling.
11179         * output.h (class Output_section): Add new methods: is_last_relro,
11180         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11181         Add is_last_relro_ and is_first_non_relro_ fields.
11182         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11183         Create separate .got.plt section.  Call increase_relro.
11184         * x86_64.cc (Target_x86_64::got_section): Likewise.
11185         * testsuite/relro_script_test.t: Add .got.plt.
11186
11187         PR 10450
11188         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11189         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11190         (Layout::finalize): Call set_dynamic_symbol_size.
11191         (Layout::set_dynamic_symbol_size): New function.
11192         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11193         set_dynamic_symbol_size.
11194
11195         PR 10450
11196         * output.h (class Output_section): Add is_entsize_zero_ field.
11197         * output.cc (Output_section::Output_section): Initialize
11198         is_entsize_zero_.
11199         (Output_section::set_entsize): If two different entsizes are
11200         requested, force it to zero.
11201         (Output_section::add_input_section): Set flags for .debug_str
11202         before updating section flags.  Set entsize.
11203         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11204         and SHF_STRING if all input sections have those flags.
11205
11206 2009-12-29   Rafael Espindola  <espindola@google.com>
11207
11208         * main.cc (main): Fix the sys time reporting.
11209         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11210         reporting.
11211
11212 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11213
11214         * options.cc (General_options::parse_version): Allow -v to exit
11215         without an error if there is nothing to link.
11216
11217 2009-12-29  Ian Lance Taylor  <iant@google.com>
11218
11219         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11220         using a version of gcc before 4.1.
11221         * configure: Rebuild.
11222
11223 2009-12-28  Chris Demetriou  <cgd@google.com>
11224
11225         * attributes.cc (Output_attributes_section_data::do_write): Use
11226         std::vector::front rather than std::vector::data.
11227
11228 2009-12-28  Ian Lance Taylor  <iant@google.com>
11229
11230         * symtab.h (class Symbol_table): Add enum Defined.
11231         * resolve.cc (Symbol_table::should_override): Add defined
11232         parameter.  Change all callers.  Test whether object is NULL
11233         before calling a method on it.
11234         (Symbol_table::report_resolve_problem): Add defined parameter.
11235         Change all callers.
11236         (Symbol_table::should_override_with_special): Likewise.
11237         * symtab.cc (Symbol_table::define_in_output_data): Add defined
11238         parameter.  Change all callers.
11239         (Symbol_table::do_define_in_output_data): Likewise.
11240         (Symbol_table::define_in_output_segment): Likewise.
11241         (Symbol_table::do_define_in_output_segment): Likewise.
11242         (Symbol_table::define_as_constant): Likewise.
11243         (Symbol_table::do_define_as_constant): Likewise.
11244         * script.h (class Symbol_assignment): Add is_defsym parameter to
11245         constructor; change all callers.
11246         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11247         parameter.  Change all callers.  Add is_defsym_ field.
11248         (class Parser_closure): Add parsing_defsym parameter to
11249         constructor; change all callers.  Add parsing_defsym accessor
11250         function.  Add parsing_defsym_ field.
11251
11252 2009-12-28  Ian Lance Taylor  <iant@google.com>
11253
11254         * gold.cc (queue_middle_tasks): Fix formatting.
11255         * object.cc (Relobj::is_section_name_included): Likewise.
11256
11257 2009-12-23  Ian Lance Taylor  <iant@google.com>
11258
11259         * i386.cc (Target_i386::do_calls_non_split): Recognize
11260         -fsplit-stack prologue for a function with a static chain.
11261         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11262         -fsplit-stack prologue when using %r11.
11263
11264 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
11265
11266         * options.cc (General_options::parse_version): Make -v continue and do
11267         the link like GNU ld does.
11268
11269 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
11270
11271         * Makefile.am (CCFILES): Add timer.cc.
11272         (HFILES): Add timer.h.
11273         * configure.ac: Check for sysconf and times.
11274         * main.cc: include timer.h.
11275         (main): Use Timer instead of get_run_time.
11276         * timer.cc: New.
11277         * timer.h: New.
11278         * workqueue.cc: include timer.h.
11279         (Workqueue::find_and_run_task):
11280         Report user, sys and wall time.
11281         * Makefile.in: Regenerate.
11282         * config.in: Regenerate.
11283         * configure: Regenerate.
11284
11285 2009-12-16  Doug Kwan  <dougkwan@google.com>
11286
11287         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11288         sections.
11289         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11290         relaxed input sections.
11291         * output.cc (Output_section::find_relaxed_input_section): Change
11292         return type to Output_relaxed_input_section pointer.  Adjust code
11293         for new type of relaxed_input_section_map_.
11294         * output.h (Output_section::find_relaxed_input_section): Change
11295         return type to Output_relaxed_input_section pointer.
11296         (Output_section::Output_relaxed_input_section_by_input_section_map):
11297         New type.
11298         (Output_section::relaxed_input_section_map_): Change type to
11299         Output_section::Output_relaxed_input_section_by_input_section_map.
11300         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11301         input section.
11302
11303 2009-12-15  Ian Lance Taylor  <iant@google.com>
11304
11305         * layout.cc (Layout::create_shstrtab): Only write out after input
11306         sections if we are compressing debug sections.
11307
11308 2009-12-15  Ian Lance Taylor  <iant@google.com>
11309
11310         * archive.cc (Archive::add_symbols): Only look up a symbol without
11311         a version if there is, in fact, a version.
11312
11313 2009-12-14  Ian Lance Taylor  <iant@google.com>
11314
11315         Revert -Wshadow changes, all changes from:
11316         2009-12-11  Doug Kwan  <dougkwan@google.com>
11317         2009-12-11  Nick Clifton  <nickc@redhat.com>
11318         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11319
11320 2009-12-11  Doug Kwan  <dougkwan@google.com>
11321
11322         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11323         due to -Wshadow.
11324         * attributes.cc (Object_attribute::size): Ditto.
11325         (Attributes_section_data::size): Ditto.
11326         (Attributes_section_data::Attributes_section_data): Ditto.
11327         (Output_attributes_section_data::do_write): Ditto.
11328         * attributes.h (Object_attribute::set_type): Ditto.
11329         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11330
11331 2009-12-11  Nick Clifton  <nickc@redhat.com>
11332
11333         * archive.cc: Fix shadowed variable warnings.
11334         * arm.cc: Likewise.
11335         * compressed_output.cc: Likewise.
11336         * compressed_output.h: Likewise.
11337         * configure: Likewise.
11338         * dwarf_reader.cc: Likewise.
11339         * dynobj.cc: Likewise.
11340         * dynobj.h: Likewise.
11341         * ehframe.cc: Likewise.
11342         * ehframe.h: Likewise.
11343         * errors.cc: Likewise.
11344         * expression.cc: Likewise.
11345         * fileread.cc: Likewise.
11346         * fileread.h: Likewise.
11347         * freebsd.h: Likewise.
11348         * i386.cc: Likewise.
11349         * icf.cc: Likewise.
11350         * incremental.h: Likewise.
11351         * layout.cc: Likewise.
11352         * layout.h: Likewise.
11353         * mapfile.cc: Likewise.
11354         * merge.cc: Likewise.
11355         * merge.h: Likewise.
11356         * object.cc: Likewise.
11357         * object.h: Likewise.
11358         * options.h: Likewise.
11359         * output.cc: Likewise.
11360         * output.h: Likewise.
11361         * parameters.cc: Likewise.
11362         * plugin.cc: Likewise.
11363         * powerpc.cc: Likewise.
11364         * reduced_debug_output.cc: Likewise.
11365         * reduced_debug_output.h: Likewise.
11366         * reloc.cc: Likewise.
11367         * reloc.h: Likewise.
11368         * resolve.cc: Likewise.
11369         * script-sections.cc: Likewise.
11370         * script.cc: Likewise.
11371         * script.h: Likewise.
11372         * sparc.cc: Likewise.
11373         * symtab.cc: Likewise.
11374         * symtab.h: Likewise.
11375         * target-select.cc: Likewise.
11376         * target-select.h: Likewise.
11377         * token.h: Likewise.
11378         * workqueue.cc: Likewise.
11379         * workqueue.h: Likewise.
11380         * x86_64.cc: Likewise.
11381
11382 2009-12-10  Doug Kwan  <dougkwan@google.com>
11383
11384         * arm.cc (attributes.h): New include.
11385         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11386         (Arm_relobj::~Arm_relobj): Delete object pointed by
11387         attributes_section_data_.
11388         (Arm_relobj::attributes_section_data): New method definition.
11389         (Arm_relobj::attributes_section_data_): New data member declaration.
11390         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11391         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11392         attributes_section_data_.
11393         (Arm_dynobj::attributes_section_data): New method definition.
11394         (Arm_dynobj::attributes_section_data_): New data member declaration.
11395         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11396         initialization value of may_use_blx_ to false.
11397         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11398         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11399         object attributes to compute results instead of hard-coding.
11400         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11401         Target_arm::get_secondary_compatible_arch,
11402         Target_arm::set_secondary_compatible_arch
11403         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11404         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11405         New method declarations.
11406         (Target_arm::get_aeabi_object_attribute): New method definition.
11407         (Target_arm::attributes_section_data_): New data member declaration.
11408         (read_arm_attributes_section): New template definition.
11409         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11410         (Arm_dynobj::do_read_symbols): Ditto.
11411         (Target_arm::do_finalize_sections): Merge attributes sections from
11412         input.  Check for BLX use after attributes section merging.
11413         Fix __exidx_start and __exidx_end visibility.  Create an
11414         .ARM.attributes section if necessary.
11415         (Target_arm::get_secondary_compatible_arch,
11416         Target_arm::set_secondary_compatible_arch,
11417         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11418         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11419         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11420         New method definitions.
11421
11422 2009-12-09  Ian Lance Taylor  <iant@google.com>
11423
11424         * plugin.cc (Plugin::load): Don't cast from void* to a function
11425         pointer.
11426
11427 2009-12-09  Ian Lance Taylor  <iant@google.com>
11428
11429         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11430         information fields.
11431
11432 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11433
11434         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11435         Replace two_file_shared_1.so with two_file_shared_2.so.
11436         * testsuite/Makefile.in: Regenerated.
11437
11438 2009-12-08  Doug Kwan  <dougkwan@google.com>
11439
11440         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11441         (HFILES): Add attributes.h and int_encoding.h.
11442         * Makefile.in: Regenerate.
11443         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11444         function definitions to int_encoding.cc
11445         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11446         prototypes to int_encoding.h
11447         * reduced_debug_output.cc (int_encoding.h): New include.
11448         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11449         function definitions to int_encoding.cc
11450         (insert_into_vector, read_from_pointer): Move template definitions to
11451         int_encoding.h
11452         * attributes.cc: New file.
11453         * attributes.h: New file.
11454         * int_encoding.cc: New file.
11455         * int_encoding.h: New file.
11456
11457 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11458
11459         PR gold/11055
11460         * incremental-dump.cc (dump_incremental_inputs): New.
11461         (main): Use dump_incremental_inputs.
11462
11463 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11464
11465         PR gold/10893
11466         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11467         checking elfcpp::STT_FUNC.
11468         (Target_i386::Relocate::relocate): Likewise.
11469         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11470
11471         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11472         symbols from shared libraries into normal FUNC symbols.
11473
11474         * symtab.h (Symbol): Add is_func and use it.
11475
11476 2009-12-05  Doug Kwan  <dougkwan@google.com>
11477
11478         * arm.cc (Target_arm::arm_info): Initialize new fields
11479         attributes_section and attributes_vendor.
11480         * i386.cc (Target_i386::i386_info): Same.
11481         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11482         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11483         fields attributes_section and attributes_vendor.
11484         * sparc.cc (Target_sparc::sparc_info): Same.
11485         * target.h (Target::attributes_section, Target::attributes_vendor,
11486         Target::is_attributes_section, Target::attribute_arg_type,
11487         Target::attributes_order): New method definitions.
11488         (Target::Target_info::attributes_section,
11489         Target::Target_info::attributes_vendor): New fields.
11490         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11491         virtual method definitions.
11492         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11493         attributes_section and attributes_vendor.
11494         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11495
11496 2009-12-05  Doug Kwan  <dougkwan@google.com>
11497
11498         * arm.cc: Update comments about interworking and stub generation.
11499         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11500         considered as non-PIC.
11501         (Arm_relocate_functions::base_abs): Fix formatting.
11502         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11503         of function to use GOT entry address instead of offset.
11504         (Target_arm::Scan::global): Issue an error if a symbol would need a
11505         PLT does not get one because it is untyped.  Remove code to create
11506         dynamic symbols for relative branches.
11507         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11508         takes unsigned integer instead of boolean.
11509
11510 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11511
11512         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11513         (two_file_test_LDADD): Likewise.
11514         (common_test_1_LDADD): Likewise.
11515         (exception_test_LDADD) Likewise.
11516         (weak_test_LDADD): Likewise.
11517         (many_sections_test_LDADD): Likewise.
11518         (initpri1_LDADD): Likewise.
11519         (script_test_1_LDADD): Likewise.
11520         (script_test_2_LDADD): Likewise.
11521         (justsyms_LDADD): Likewise.
11522         (binary_test_LDADD): Likewise.
11523         (large_LDADD): Likewise.
11524         * testsuite/Makefile.in: Regenerated.
11525
11526 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11527
11528         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11529         (Symbol_table::override_with_special): Likewise.
11530         (Symbol_table::add_from_object): Likewise.
11531
11532 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11533
11534         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11535         Don't set the data_offset twice.
11536
11537 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11538
11539         * testsuite/Makefile.in: Regenerate.
11540
11541 2009-12-03  Doug Kwan  <dougkwan@google.com>
11542
11543         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11544         (Target_arm::do_finalize_sections): Add parameter for symbol table
11545         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11546         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11547         parameter for symbol table pointer.
11548         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11549         an additional parameter for a pointer to symbol table.
11550         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11551         parameter for a symbol table pointer.
11552         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11553         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11554         Ditto.
11555         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11556         parameter for a symbol table pointer.
11557
11558 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11559
11560         * incremental.cc (Incremental_inputs_header)
11561         (Incremental_inputs_header_write, Incremental_inputs_entry)
11562         (Incremental_inputs_entry_write): Move ...
11563         * incremental.h (Incremental_inputs_header)
11564         (Incremental_inputs_header_write, Incremental_inputs_entry)
11565         (Incremental_inputs_entry_write): here.
11566
11567 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11568
11569         * incremental.cc (make_sized_incremental_binary): Set the target.
11570         Error if it is incompatible.
11571         * output.h (Output_file): Add filename method.
11572
11573 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11574
11575         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11576         from the get_* methods.
11577
11578 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11579
11580         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11581         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11582         Write 0 for the data_offset of scripts.
11583
11584 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11585
11586         * testsuite/Makefile.am: Add the incremental_test.sh test.
11587         * testsuite/incremental_test.sh: New.
11588         * testsuite/incremental_test_1.c: New.
11589         * testsuite/incremental_test_2.c: New.
11590
11591 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11592
11593         * incremental-dump.cc (main): Fix typos.
11594
11595 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11596
11597         PR gold/11025
11598         * incremental-dump.cc (main): Use llu to print 64 bit values.
11599
11600 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11601             H.J. Lu  <hongjiu.lu@intel.com>
11602
11603         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11604         $(LIBDL).
11605         (incremental_dump_LDADD): Likewise.
11606         * Makefile.in: Regenerated.
11607
11608 2009-11-25  Doug Kwan  <dougkwan@google.com>
11609
11610         Revert:
11611
11612         2009-11-25  Doug Kwan  <dougkwan@google.com>
11613
11614                 * arm.cc (Target_arm::Target_arm): Move method definition
11615                 outside of class definition.  Add code to handle
11616                 --target1-rel, --target1-abs and --target2= options.
11617                 (Target_arm::get_reloc_reloc_type): Change method to be
11618                 non-static and const.
11619                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11620                 New data member declaration.
11621                 (Target_arm::Scan::local, Target_arm::Scan::global,
11622                 Target_arm::Relocate::relocate,
11623                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11624                 Adjust call to Target_arm::get_real_reloc_type.
11625                 (Target_arm::get_real_reloc_type): Use command line options
11626                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11627                 * options.h (--target1-rel, --target1-abs, --target2): New
11628                 ARM-only options.
11629
11630 2009-11-25  Doug Kwan  <dougkwan@google.com>
11631
11632         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11633         class definition.  Add code to handle --target1-rel, --target1-abs
11634         and --target2= options.
11635         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11636         and const.
11637         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11638         member declaration.
11639         (Target_arm::Scan::local, Target_arm::Scan::global,
11640         Target_arm::Relocate::relocate,
11641         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11642         call to Target_arm::get_real_reloc_type.
11643         (Target_arm::get_real_reloc_type): Use command line options to
11644         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11645         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11646         options.
11647
11648 2009-11-25  Doug Kwan  <dougkwan@google.com>
11649
11650         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11651         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11652         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11653         formatting.
11654         (Arm_relocate_functions::thm_call): Replace body with a call to
11655         Arm_relocate_functions::thumb_branch_common.
11656         (Arm_relocate_functions::thm_jump24,
11657         Arm_relocate_functions::thm_xpc22): New method definitions.
11658         (Arm_relocate_functions::thumb_branch_common): New method definition.
11659         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11660         operator.
11661         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11662         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11663
11664 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11665
11666         * Makefile.am: Build incremental-dump
11667         * Makefile.in: Regenerate.
11668         * incremental-dump.cc: New.
11669         * incremental.cc (Incremental_inputs_header_data,
11670         Incremental_inputs_entry_data): Move to incremental.h
11671         * incremental.h: (Incremental_inputs_header_data,
11672         Incremental_inputs_entry_data): Move from incremental.cc
11673
11674 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11675
11676         * incremental.cc (Incremental_inputs_header,
11677         Incremental_inputs_header_write, Incremental_inputs_entry,
11678         Incremental_inputs_entry_write): Add a typedef with the data type.
11679
11680 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11681
11682         * incremental.cc (Incremental_inputs_header,
11683         Incremental_inputs_header_write, Incremental_inputs_entry,
11684         Incremental_inputs_entry_write): Update comment about which
11685         type has the filed descriptions.
11686
11687 2009-11-15  Doug Kwan  <dougkwan@google.com>
11688
11689         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11690         (Arm_relocate_functions::arm_branch_common): Change method defintion
11691         in class definition to a method declaration and update list of formal
11692         parameters.
11693         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11694         Arm_relocation_functions::jump24): Adjust call to
11695         Arm_relocate_functions::arm_branch_common.  Update list of formal
11696         parameters.
11697         (Arm_relocate_functions::xpc25): New method definition.
11698         (Arm_relocate_functions::arm_branch_common): Move method defintion
11699         out from class definition.  Use stubs for mode-switching and extending
11700         branch ranges.
11701         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11702         specially.  Change code to enable use of stubs in ARM branches.
11703
11704 2009-11-10  Doug Kwan  <dougkwan@google.com>
11705
11706         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11707         in method declaration.
11708         (Target_arm::relocate_stub): New method declaration.
11709         (Target_arm::default_target): Change to return a pointer instead of
11710         a const reference.
11711         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11712         Target_arm::default_target.
11713         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11714         method definition.
11715         (Target_arm::relocate_section): Adjust view.
11716         (Target_arm::relocate_stub): New method definition.
11717
11718 2009-11-10  Doug Kwan  <dougkwan@google.com>
11719
11720         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11721         a format warning.
11722         * incremental.cc (open_incremental_binary): Initialized local
11723         variables to avoid warnings.
11724         * object.cc (make_elf_object): Ditto.
11725         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11726         a format warning.
11727
11728 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11729
11730         PR gold/10930
11731         * testsuite/plugin_test.c: Include "config.h".
11732
11733 2009-11-09  Doug Kwan  <dougkwan@google.com>
11734
11735         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11736         (arm_symbol_value): Remove.
11737         (Arm_relocate_functions::arm_branch_common,
11738         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11739         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11740         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11741         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11742         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11743         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11744         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11745         Arm_relocate_functions::thm_mobw_abs_nc,
11746         Arm_relocate_functions::thm_mov_abs,
11747         Arm_relocate_functions::movw_prel_nc,
11748         Arm_relocate_functions::thm_movt_abs,
11749         Arm_relocate_functions::movt_prel,
11750         Arm_relocate_functions::thm_movw_prel_nc,
11751         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11752         (Target_arm::Relocate::relocate): Only decompose address into two
11753         parts if relocation type uses the thumb-bit and pass the actual
11754         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11755         calls to methods in Arm_relocate_functions for this change.
11756
11757 2009-11-08  Ian Lance Taylor  <iant@google.com>
11758
11759         PR 10925
11760         * reloc.cc: Instantiate
11761         Sized_relobj::initialize_input_to_output_maps and
11762         Sized_relobj:free_input_to_output_maps.
11763
11764 2009-11-06  Ian Lance Taylor  <iant@google.com>
11765
11766         PR 10876
11767         * defstd.cc (in_segment): Set only_if_ref true for "end".
11768
11769 2009-11-06  Doug Kwan  <dougkwan@google.com>
11770
11771         * arm.cc (class Reloc_stub): Correct a comment.
11772         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11773         (Target_arm::scan_section_for_stubs): New method declaration.
11774         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11775         Change methods from private to protected.
11776         (Target_arm::do_may_relax): New method definition.
11777         (Target_arm::do_relax, Target_arm::group_sections,
11778         Target_arm::scan_reloc_for_stub,
11779         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11780         (Target_arm::arm_input_section_map_): New data member declaration.
11781         (Target_arm::scan_reloc_for_stub,
11782         Target_arm::scan_reloc_section_for_stubs,
11783         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11784         Target_arm::do_relax): New method definitions.
11785
11786 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11787
11788         * configure.ac: Check for (struct stat)::st_mtim
11789         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11790         * config.in: Regenerate.
11791         * configure: Regenerate.
11792
11793 2009-11-05  Ian Lance Taylor  <iant@google.com>
11794
11795         PR 10910
11796         * output.cc (Output_segment::add_output_section): Add missing
11797         return statement.
11798
11799 2009-11-04  Ian Lance Taylor  <iant@google.com>
11800
11801         PR 10880
11802         * object.h (class Object): Add is_needed and set_is_needed
11803         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11804         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11805         defined in a dynamic object and referenced by a regular object,
11806         set is_needed for the dynamic object.
11807         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11808         if the file is marked with as_needed and it is not needed.
11809
11810 2009-11-04  Ian Lance Taylor  <iant@google.com>
11811
11812         PR 10887
11813         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11814         tags if data is discarded by linker script.
11815         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11816         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11817         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11818         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11819
11820 2009-11-04  Ian Lance Taylor  <iant@google.com>
11821
11822         * layout.cc (Layout::get_output_section): Add is_interp and
11823         is_dynamic_linker_section parameters.  Change all callers.
11824         (Layout::choose_output_section): Likewise.
11825         (Layout::make_output_section): Likewise.
11826         (Layout::add_output_section_data): Add is_dynamic_linker_section
11827         parameter.  Change all callers.
11828         * layout.h (class Layout): Update declarations.
11829         * output.h (class Output_section): Add is_interp, set_is_interp,
11830         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11831         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11832         generate_code_fills_at_write_ to a bitfield.
11833         * output.cc (Output_section::Output_sections): Initialize new
11834         fields.
11835         (Output_segment::add_output_section): Add do_sort parameter.
11836         Change all callers.
11837
11838 2009-11-03  Ian Lance Taylor  <iant@google.com>
11839
11840         PR 10860
11841         * options.h (class General_options): Add --warn-common.
11842         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11843         merging two common symbols.
11844         (Symbol_table::should_override): Handle --warn-common when merging
11845         a common symbol with a defined symbol.  Use report_resolve_problem
11846         for multiple definitions.
11847         (Symbol_table::report_resolve_problem): New function.
11848         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11849
11850 2009-11-03  Doug Kwan  <dougkwan@google.com>
11851
11852         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11853         stub_factory_.
11854         (Target_arm::stub_factory): New method definition.
11855         (Target_arm::new_arm_input_section,
11856         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11857         Target_arm::reloc_uses_thumb_bit): New method declarations.
11858         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11859         New type definitions.
11860         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11861         member declarations.
11862         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11863         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11864         New method definitions.
11865
11866 2009-11-03  Ian Lance Taylor  <iant@google.com>
11867
11868         * options.h (class General_options): Add --warn_constructors.
11869
11870 2009-11-03  Ian Lance Taylor  <iant@google.com>
11871
11872         PR 10893
11873         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11874         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11875
11876 2009-11-03  Ian Lance Taylor  <iant@google.com>
11877
11878         PR 10895
11879         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11880         --msgid-bugs-address.
11881         (install-pdf): New target.
11882         (install-data_yes): Look up one directory to find mkinstalldirs.
11883
11884 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11885
11886         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11887         tree.
11888
11889 2009-10-30  Doug Kwan  <dougkwan@google.com>
11890
11891         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11892
11893 2009-10-30  Doug Kwan  <dougkwan@google.com>
11894
11895         * arm.cc (Stub_addend_reader): New struct template definition
11896         and partial specializations.
11897         (Stub_addend_reader::operator()): New method definition for a
11898         partially specialized template.
11899
11900 2009-10-30  Doug Kwan  <dougkwan@google.com>
11901
11902         * arm.cc (Arm_relobj::processor_specific_flags): New method
11903         definition.
11904         (Arm_relobj::do_read_symbols): New method declaration.
11905         (Arm_relobj::processor_specific_flags_): New data member declaration.
11906         (Arm_dynobj): New class definition.
11907         (Target_arm::do_finalize_sections): Add input_objects parameter.
11908         (Target_arm::do_adjust_elf_header): New method declaration.
11909         (Target_arm::are_eabi_versions_compatible,
11910         (Target_arm::merge_processor_specific_flags): New method declaration.
11911         (Target_arm::do_make_elf_object): New overloaded method definitions
11912         and declaration.
11913         (Arm_relobj::do_read_symbols): New method definition.
11914         (Arm_dynobj::do_read_symbols): Ditto.
11915         (Target_arm::do_finalize_sections): Add input_objects parameters.
11916         Merge processor-specific flags from all input objects.
11917         (Target_arm::are_eabi_versions_compatible,
11918         Target_arm::merge_processor_specific_flags,
11919         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11920         New method definitions.
11921         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11922         Input_objects pointer type parameter.
11923         * layout.cc (Layout::finalize): Pass input objects to target's.
11924         finalize_sections function.
11925         * output.cc (Output_file_header::do_sized_write): Set ELF file
11926         header's processor-specific flags.
11927         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11928         Input_objects pointer type parameter.
11929         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11930         * target.h (Input_objects): New forward class declaration.
11931         (Target::processor_specific_flags,
11932         Target::are_processor_specific_flags_sect): New method definitions.
11933         (Target::finalize_sections): Add input_objects parameter.
11934         (Target::Target): Initialize processor_specific_flags_ and
11935         are_processor_specific_flags_set_.
11936         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11937         parameter.
11938         (Target::set_processor_specific_flags): New method definition.
11939         (Target::processor_specific_flags_,
11940         Target::are_processor_specific_flags_set_): New data member
11941         declarations.
11942         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11943         Input_objects pointer type parameter.
11944
11945 2009-10-30  Doug Kwan  <dougkwan@google.com>
11946
11947         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11948
11949 2009-10-28  Ian Lance Taylor  <iant@google.com>
11950
11951         * object.h (class Relobj): Drop options parameter from
11952         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11953         do_scan_relocs, do_relocate.  Change all callers.
11954         (class Sized_relobj): Drop options parameters from
11955         do_gc_process_relocs, do_scan_relocs, do_relocate,
11956         do_relocate_sections, relocate_sections, emit_relocs_scan,
11957         emit_relocs_scan_reltype.  Change all callers.
11958         (struct Relocate_info): Remove options field and all references to
11959         it.
11960         * reloc.h (class Read_relocs): Remove options constructor
11961         parameter and options_ field.  Change all callers.
11962         (class Gc_process_relocs, class Scan_relocs): Likewise.
11963         (class Relocate_task): Likewise.
11964         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11965         all callers.
11966         (scan_relocatable_relocs): Likewise.
11967         * target.h (class Sized_target): Remove options parameter from
11968         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11969         all callers.
11970         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11971         callers.
11972         * arm.cc: Update functions to remove options parameters.
11973         * i386.cc: Likewise.
11974         * powerpc.cc: Likewise.
11975         * sparc.cc: Likewise.
11976         * x86_64.cc: Likewise.
11977         * testsuite/testfile.cc: Likewise.
11978
11979 2009-10-28  Doug Kwan  <dougkwan@google.com>
11980
11981         * arm.cc (Arm_relobj): New class definition.
11982         (Arm_relobj::scan_sections_for_stubs,
11983         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11984         New method definitions.
11985
11986 2009-10-28  Cary Coutant  <ccoutant@google.com>
11987
11988         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11989         (Plugin::cleanup_done_): New member.
11990         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11991         (Plugin_manager::cleanup_done_): Remove.
11992         (Plugin_manager::add_input_file): Edit error message.
11993         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11994         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11995
11996 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11997
11998         * fileread.cc: (File_read::View::~View): Use the new
11999         data_ownership_ filed.
12000         (File_read::~File_read): Dispose the new whole_file_view_.
12001         (File_read::open): Mmap the whole file if needed.
12002         (File_read::open): Use whole_file_view_ instead of contents_.
12003         (File_read::find_view): Use whole_file_view_ if applicable.
12004         (File_read::do_read): Use whole_file_view_ instead of contents_.
12005         (File_read::make_view): Use whole_file_view_ instead of contents_,
12006         update File_read::View::View call.
12007         (File_read::find_or_make_view): Update File_read::View::View
12008         call.
12009         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12010         remove contents_
12011         (File_read::View::Data_ownership): New enum.
12012         (File_read::View::View): Replace bool mapped_ with Data_ownership
12013         argument.
12014         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12015         (File_read::View::data_ownership_): New field.
12016         (File_read::contents_): Remove (replaced by whole_file_view_).
12017         (File_read::whole_file_view_): New field.
12018         * options.h (class General_options): Add --keep-files-mapped.
12019
12020 2009-10-27  Cary Coutant  <ccoutant@google.com>
12021
12022         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12023         * testsuite/Makefile.am (plugin_test_5): New test case.
12024         * testsuite/Makefile.in: Regenerate.
12025
12026 2009-10-25  Doug Kwan  <dougkwan@google.com>
12027
12028         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12029         from private to protected to allow access by child class.
12030         (Sized_relobj::do_relocate_sections): New method declaration.
12031         (Sized_relobj::relocate_sections): Virtualize.
12032         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12033         Sized_relobj::relocate_sections.  Instantiate template explicitly
12034         for different target sizes and endianity.
12035
12036 2009-10-24  Doug Kwan  <dougkwan@google.com>
12037
12038         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12039         (Arm_input_section::as_arm_input_section): New method.
12040         (Arm_output_section): New class definition.
12041         (Arm_output_section::create_stub_group,
12042         Arm_output_section::group_sections): New method definitions.
12043
12044 2009-10-22  Doug Kwan  <dougkwan@google.com>
12045
12046         * arm.cc (Arm_input_section): New class definition.
12047         (Arm_input_section::init, Arm_input_section:do_write,
12048         Arm_input_section::set_final_data_size,
12049         Arm_input_section::do_reset_address_and_file_offset): New method
12050         definitions.
12051
12052 2009-10-21  Doug Kwan  <dougkwan@google.com>
12053
12054         * arm.cc (Stub_table, Arm_input_section): New forward class
12055         declarations.
12056         (Stub_table): New class defintion.
12057         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12058         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12059         New method definition.
12060
12061 2009-10-21  Doug Kwan  <dougkwan@google.com>
12062
12063         * arm.cc: Update copyright comments.
12064         (Target_arm): New forward class template declaration.
12065         (Arm_address): New type.
12066         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12067         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12068         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12069         constants.
12070         (Insn_template): Same.
12071         (DEF_STUBS): New macro.
12072         (Stub_type): New enum type.
12073         (Stub_template): New class definition.
12074         (Stub): Same.
12075         (Reloc_stub): Same.
12076         (Stub_factory): Same.
12077         (Target_arm::Target_arm): Initialize may_use_blx_ and
12078         should_force_pic_veneer_.
12079         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12080         Target_arm::should_force_pic_veneer,
12081         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12082         Target_arm::using_thumb_only, Target_arm:;default_target): New
12083         method defintions.
12084         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12085         New data member declarations.
12086         (Insn_template::size, Insn_template::alignment): New method defintions.
12087         (Stub_template::Stub_template): New method definition.
12088         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12089         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12090         (Stub_factory::Stub_factory): New method definition.
12091         * gold.h (string_hash): New template.
12092         * output.h (Input_section_specifier::hash_value): Use
12093         gold::string_hash.
12094         (Input_section_specifier::string_hash): Remove.
12095         * stringpool.cc (Stringpool_template::string_hash): Use
12096         gold::string_hash.
12097
12098 2009-10-20  Doug Kwan  <dougkwan@google.com>
12099
12100         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12101         symbols of relaxed input sections.
12102         * output.h (Output_section::find_relaxed_input_section): Make
12103         method public.
12104
12105 2009-10-16  Doug Kwan  <dougkwan@google.com>
12106
12107         * dynobj.cc (Versions::Versions): Initialize version_script_.
12108         Only insert base version symbol definition for a shared object
12109         if version script defines any version versions.
12110         (Versions::define_base_version): New method definition.
12111         (Versions::add_def): Check that base version is not needed.
12112         (Versions::add_need): Define base version lazily.
12113         * dynobj.h (Versions::define_base_version): New method declaration.
12114         (Versions::needs_base_version_): New data member declaration.
12115         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12116         (check_DATA): Add no_version_test.stdout.
12117         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12118         New make rules.
12119         * testsuite/Makefile.in: Regenerate.
12120         * testsuite/no_version_test.c: New file.
12121         * testsuite/no_version_test.sh: Ditto.
12122
12123 2009-10-16  Doug Kwan  <dougkwan@google.com>
12124
12125         * expression.cc (class Segment_start_expression): New class definition.
12126         (Segment_start_expression::value): New method definition.
12127         (script_exp_function_segment_start): Return a new
12128         Segment_start_expression.
12129         * gold/script-c.h (script_saw_segment_start_expression): New function
12130         prototype.
12131         * script-sections.cc (Script_sections::Script_sections): Initialize
12132         SAW_SEGMENT_START_EXPRESSION_ to false.
12133         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12134         and -Tbbs options to specify section addresses if given in
12135         command line and no SEGMENT_START expression is seen in a script.
12136         * script-sections.h (Script_sections::saw_segment_start_expression,
12137         Script_sections::set_saw_segment_start_expression): New method
12138         definition.
12139         (Script_sections::saw_segment_start_expression_): New data member
12140         declaration.
12141         * script.cc (script_saw_segment_start_expression): New function.
12142         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12143         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12144         script_test_7.sh and script_test_8.sh.
12145         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12146         script_test_8.stdout.
12147         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12148         (script_test_6, script_test_6.stdout, script_test_7,
12149         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12150         * Makefile.in: Regenerate.
12151         * testsuite/script_test_6.sh: New file.
12152         * testsuite/script_test_6.t: Same.
12153         * testsuite/script_test_7.sh: Same.
12154         * testsuite/script_test_7.t: Same.
12155         * testsuite/script_test_8.sh: Same.
12156
12157 2009-10-16  Doug Kwan  <dougkwan@google.com>
12158
12159         * output.cc (Output_segment::set_section_list_address): Cast
12160         expressions to unsigned long long type to avoid format warnings.
12161
12162 2009-10-15  Ian Lance Taylor  <iant@google.com>
12163
12164         * script.cc (Script_options::add_symbol_assignment): Always add a
12165         dot assignment to script_sections_.
12166         * script-sections.cc (Script_sections::add_dot_assignment):
12167         Initialize if necessary.
12168
12169         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12170         program headers with no load segment if there is a linker script.
12171
12172         * layout.cc (Layout::set_segment_offsets): Align the file offset
12173         to the segment aligment for -N or -n with no load segment.
12174         * output.cc (Output_segment::add_output_section): Don't crash if
12175         the first section is a TLS section.
12176         (Output_segment::set_section_list_addresses): Print an error
12177         message if the address moves backward in a linker script.
12178         * script-sections.cc
12179         (Output_section_element_input::set_section_addresses): Don't
12180         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12181         (Orphan_output_section::set_section_addresses): Likewise.
12182
12183 2009-10-15  Doug Kwan  <dougkwan@google.com>
12184
12185         * layout.cc (Layout::finish_dynamic_section): Generate tags
12186         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12187         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12188         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12189
12190 2009-10-14  Ian Lance Taylor  <iant@google.com>
12191
12192         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12193         fields.
12194         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12195         data_shdr fields of relinfo.
12196         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12197         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12198         R_386_TLS_LDO_32, adjust based on section flags.
12199         (Target_i386::Relocate::fix_up_ldo): Remove.
12200
12201 2009-10-13  Ian Lance Taylor  <iant@google.com>
12202
12203         Add support for -pie.
12204         * options.h (class General_options): Add -pie and
12205         --pic-executable.
12206         (General_options::output_is_position_independent): Test -pie.
12207         (General_options::output_is_executable): Return true if not shared
12208         and not relocatable.
12209         (General_options::output_is_pie): Remove.
12210         * options.cc (General_options::finalize): Reject incompatible uses
12211         of -pie.
12212         * gold.cc (queue_middle_tasks): A -pie link is not static.
12213         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12214         * symtab.cc (Symbol::final_value_is_known): Return false if
12215         output_is_position_independent.
12216         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12217         output_is_position_independent.
12218         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12219         output_is_position_independent.
12220         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12221         output_is_position_independent.
12222         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12223         two_file_pie_test.
12224         (basic_pie_test.o, basic_pie_test): New targets.
12225         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12226         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12227         (two_file_pie_test): New target.
12228         * testsuite/Makefile.in: Rebuild.
12229         * README: Remove note saying that -pie is not supported.
12230
12231 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
12232
12233         * options.h (class General_options): Add -init and -fini.
12234         * layout.cc (Layout::finish_dynamic_section): Emit
12235         given init and fini functions.
12236
12237 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
12238
12239         * gc.h (gc_process_relocs): Check if icf is enabled using new
12240         function.
12241         * gold.cc (queue_initial_tasks): Likewise.
12242         (queue_middle_tasks): Likewise.
12243         * object.cc (do_layout): Likewise.
12244         * symtab.cc (is_section_folded): Likewise.
12245         * main.cc (main): Likewise.
12246         * reloc.cc (Read_relocs::run): Likewise.
12247         (Sized_relobj::do_scan_relocs): Likewise.
12248         * icf.cc (is_function_ctor_or_dtor): New function.
12249         (Icf::find_identical_sections): Check if function is ctor or dtor when
12250         safe icf is chosen.
12251         * options.h (General_options::icf): Change option to be an enum.
12252         (Icf_status): New enum.
12253         (icf_enabled): New method.
12254         (icf_safe_folding): New method.
12255         (set_icf_status): New method.
12256         (icf_status_): New variable.
12257         * (options.cc) (General_options::finalize): Set icf_status_.
12258         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12259         icf_test and icf_keep_unique_test to use the --icf enum flag.
12260         * testsuite/icf_safe_test.sh: New file.
12261         * testsuite/icf_safe_test.cc: New file.
12262
12263 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
12264
12265         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12266         includes to gc.h and icf.h.
12267         * arm.cc: Include gc.h.
12268         * gold.cc: Likewise.
12269         * i386.cc: Likewise.
12270         * powerpc.cc: Likewise.
12271         * sparc.cc: Likewise.
12272         * x86_64.cc: Likewise.
12273         * gc.h: Include icf.h.
12274
12275 2009-10-11  Ian Lance Taylor  <iant@google.com>
12276
12277         * plugin.cc: Include "gold.h" before other header files.
12278
12279 2009-10-10  Chris Demetriou  <cgd@google.com>
12280
12281         * options.h (Input_file_argument::Input_file_type): New enum.
12282         (Input_file_argument::is_lib_): Replace with...
12283         (Input_file_argument::type_): New member.
12284         (Input_file_argument::Input_file_argument): Take Input_file_type
12285         'type' rather than boolean 'is_lib' as second argument.
12286         (Input_file_argument::is_lib): Use type_.
12287         (Input_file_argument::is_searched_file): New function.
12288         (Input_file_argument::may_need_search): Handle is_searched_file.
12289         * options.cc (General_options::parse_library): Support -l:filename.
12290         (General_options::parse_just_symbols): Update for Input_file_argument
12291         changes.
12292         (Command_line::process): Likewise.
12293         * archive.cc (Archive::get_file_and_offset): Likewise.
12294         * plugin.cc (Plugin_manager::release_input_file): Likewise.
12295         * script.cc (read_script_file, script_add_file): Likewise.
12296         * fileread.cc (Input_file::Input_file): Likewise.
12297         (Input_file::will_search_for): Handle is_searched_file.
12298         (Input_file::open): Likewise.
12299         * readsyms.cc (Read_symbols::get_name): Likewise.
12300         * testsuite/Makefile.am (searched_file_test): New test.
12301         * testsuite/Makefile.in: Regenerate.
12302         * testsuite/searched_file_test.cc: New file.
12303         * testsuite/searched_file_test_lib.cc: New file.
12304
12305 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12306             Ian Lance Taylor  <iant@google.com>
12307
12308         * descriptor.cc: Include <cstdio> and "binary-io.h".
12309         (Descriptors::open): Open the files in binary mode always.
12310         * script.cc (Lex::get_token): Treat \r as whitespace.
12311
12312 2009-10-09  Ian Lance Taylor  <iant@google.com>
12313
12314         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12315
12316 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12317             Ian Lance Taylor  <iant@google.com>
12318
12319         * configure.ac: Check for readv function also.
12320         * fileread.cc (readv): Define if not HAVE_READV.
12321         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12322         does not exist.
12323         * config.in: Regenerate.
12324         * configure: Regenerate.
12325
12326 2009-10-09  Doug Kwan  <dougkwan@google.com>
12327
12328         * layout.cc (Layout::make_output_section): Call target hook to make
12329         ordinary output section.
12330         (Layout::finalize): Adjust parameter list of call the
12331         Target::may_relax().
12332         * layout.h (class Layout::section_list): New method.
12333         * merge.h (Output_merge_base::entsize): Change visibility to public.
12334         (Output_merge_base::is_string, Output_merge_base::do_is_string):
12335         New methods.
12336         (Output_merge_string::do_is_string): New method.
12337         * object.cc (Sized_relobj::do_setup): renamed from
12338         Sized_relobj::set_up.
12339         * object.h (Sized_relobj::adjust_shndx,
12340         Sized_relobj::initializ_input_to_output_maps,
12341         Sized_relobj::free_input_to_output_maps): Change visibilities to
12342         protected.
12343         (Sized_relobj::setup): Virtualize.
12344         (Sized_relobj::do_setup): New method declaration.
12345         (Sized_relobj::invalidate_section_offset,
12346         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12347         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12348         * options.cc (parse_int): New function.
12349         * options.h (parse_int): New declaration.
12350         (DEFINE_int): New macro.
12351         (stub_group_size): New option.
12352         * output.cc (Output_section::Output_section): Initialize memebers
12353         merge_section_map_, merge_section_by_properties_map_,
12354         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12355         (Output_section::add_input_section): Handled deferred code-fill
12356         generation and remove an old comment.
12357         (Output_section::add_relaxed_input_section): New method definition.
12358         (Output_section::add_merge_input_section): Use merge section by
12359         properties map to speed to search.  Update merge section maps
12360         as appropriate.
12361         (Output_section::build_relaxation_map): New method definition.
12362         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12363         Same.
12364         (Output_section::relax_input_section): Renamed to
12365         Output_section::convert_input_sections_to_relaxed_sections and change
12366         interface to take a vector of pointers to relaxed sections.
12367         (Output_section::find_merge_section,
12368         Output_section::find_relaxed_input_section): New method definitions.
12369         (Output_section::is_input_address_mapped,
12370         Output_section::output_offset, Output_section::output_address):
12371         Use output section data maps to speed up searching.
12372         (Output_section::find_starting_output_address): Add comments.
12373         (Output_section::do_write,
12374         Output_section::write_to_postprocessing_buffer): Do code-fill
12375         generation as appropriate.
12376         (Output_section::get_input_sections): Invalidate relaxed input section
12377         map.
12378         (Output_section::restore_states): Adjust type of checkpoint .
12379         Invalidate relaxed input section map.
12380         * output.h (Output_merge_base): New class declaration.
12381         (Input_section_specifier): New class defintion.
12382         (class Output_relaxed_input_section) Change base class to
12383         Output_section_data_build.
12384         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12385         base class initializer.
12386         (Output_section::add_relaxed_input_section): New method declaration.
12387         (Output_section::Input_section): Change visibility to protected.
12388         (Output_section::Input_section::relobj,
12389         Output_section::Input_section::shndx): Handle relaxed input sections.
12390         Output_section::input_sections) Change visibility to protected.  Also
12391         define overload to return a non-const pointer.
12392         (Output_section::Merge_section_properties): New class defintion.
12393         (Output_section::Merge_section_by_properties_map,
12394         Output_section::Output_section_data_by_input_section_map,
12395         Output_section::Relaxation_map): New types.
12396         (Output_section::relax_input_section): Rename method to
12397         Output_section::convert_input_sections_to_relaxed_sections and change
12398         interface to take a vector of relaxed section pointers.
12399         (Output_section::find_merge_section,
12400         Output_section::find_relaxed_input_section,
12401         Output_section::build_relaxation_map,
12402         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12403         New method declarations.
12404         (Output_section::merge_section_map_
12405         Output_section::merge_section_by_properties_map_,
12406         Output_section::relaxed_input_section_map_,
12407         Output_section::is_relaxed_input_section_map_valid_,
12408         Output_section::generate_code_fills_at_write_): New data members.
12409         * script-sections.cc
12410         (Output_section_element_input::set_section_addresses): Call
12411         current_data_size and addralign methods of relaxed input sections.
12412         (Orphan_output_section::set_section_addresses): Call current_data_size
12413         and addralign methods of relaxed input sections.
12414         * symtab.cc (Symbol_table::compute_final_value): Extract template
12415         from the body of Symbol_table::sized_finalize_symbol.
12416         (Symbol_table::sized_finalized_symbol): Call
12417         Symbol_table::compute_final_value.
12418         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12419         (Symbol_table::compute_final_value): New templated method declaration.
12420         * target.cc (Target::do_make_output_section): New method defintion.
12421         * target.h (Target::make_output_section): New method declaration.
12422         (Target::relax): Add more parameters for input objects, symbol table
12423         and layout.  Adjust call to do_relax.
12424         (Target::do_make_output_section): New method declaration.
12425         (Target::do_relax): Add parameters for input objects, symbol table
12426         and layout.
12427
12428 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12429
12430         * pread.c: Include stdio.h.
12431
12432 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12433
12434         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12435         defined.
12436
12437 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12438
12439         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12440         Change read_shndx type to unsigned int.
12441         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12442         int.
12443         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12444         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12445         Change read_shndx type to unsigned int.
12446         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12447         int.
12448         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12449         * layout.cc (Layout::create_symtab_sections): Cast the result of
12450         local_symcount * symsize to off_t in the gold_assert.
12451
12452 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12453
12454         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12455         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12456         R_ARM_BASE_ABS.
12457         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12458         (Arm_relocate_functions::thm_abs5): New function.
12459         (Arm_relocate_functions::abs12): New function.
12460         (Arm_relocate_functions::abs16): New function.
12461         (Arm_relocate_functions::base_abs): New function.
12462         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12463         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12464         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12465         R_ARM_BASE_ABS.
12466         (Scan::global): Likewise.
12467         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12468         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12469         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12470         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12471         R_ARM_BASE_ABS.
12472
12473 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12474
12475         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12476         (Arm_relocate_functions::movt_prel): New function.
12477         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12478         (Arm_relocate_functions::thm_movt_prel): New function.
12479         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12480         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12481         (Scan::global, Relocate::relocate): Likewise.
12482         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12483
12484 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12485
12486         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12487         Incremental_checker.
12488         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12489         unsigned int.
12490         (class Incremental_inputs_header): New class.
12491         (Incremental_inputs_header_writer): Edit comment.
12492         (Incremental_inputs_entry): New class.
12493         (Incremental_inputs_entry_writer): Edit comment.
12494         (Sized_incremental_binary::do_find_incremental_inputs_section):
12495         Add *strtab_shndx parameter, fill it.
12496         (Sized_incremental_binary::do_check_inputs): New method.
12497         (Incremental_checker::can_incrementally_link_output_file): Use
12498         Sized_incremental_binary::check_inputs.
12499         (Incremental_inputs::report_command_line): Save command line in
12500         command_line_.
12501         * incremental.h:
12502         (Incremental_binary::find_incremental_inputs_section): New
12503         method.
12504         (Incremental_binary::do_find_incremental_inputs_section): Add
12505         strtab_shndx parameter.
12506         (Incremental_binary::do_check_inputs): New pure virtual method.
12507         (Sized_incremental_binary::do_check_inputs): Declare.
12508         (Incremental_checker::Incremental_checker): Add incremental_inputs
12509         parameter, use it to initialize incremental_inputs_.
12510         (Incremental_checker::incremental_inputs_): New field.
12511         (Incremental_checker::command_line): New method.
12512         (Incremental_checker::inputs): New method.
12513         (Incremental_checker::command_line_): New field.
12514
12515 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12516
12517         * incremental.cc: Include <cstdarg> and "target-select.h".
12518         (vexplain_no_incremental): New function.
12519         (explain_no_incremental): New function.
12520         (Incremental_binary::error): New method.
12521         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12522         method.
12523         (make_sized_incremental_binary): New function.
12524         (open_incremental_binary): New function.
12525         (can_incrementally_link_file): Add checks if output is ELF and has
12526         inputs section.
12527         * incremental.h: Include "elfcpp_file.h" and "output.h".
12528         (Incremental_binary): New class.
12529         (Sized_incremental_binary): New class.
12530         (open_incremental_binary): Declare.
12531         * object.cc (is_elf_object): Use
12532         elfcpp::Elf_recognizer::is_elf_file.
12533         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12534         * output.h (Output_file::filesize): New method.
12535
12536 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12537
12538         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12539         New function.
12540         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12541         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12542         function.
12543         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12544         function.
12545         (Arm_relocate_functions::movw_abs_nc): New function.
12546         (Arm_relocate_functions::movt_abs): New function.
12547         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12548         (Arm_relocate_functions::thm_movt_abs): New function.
12549         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12550         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12551         (Scan::global): Likewise.
12552         (Relocate::relocate): Likewise.
12553         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12554
12555 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12556
12557         * arm.cc (Arm_relocate_functions::got_prel) New function.
12558         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12559         (Relocate::relocate): Likewise.
12560         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12561
12562 2009-10-06  Ian Lance Taylor  <iant@google.com>
12563
12564         * options.h (class General_options): Define
12565         split_stack_adjust_size parameter.
12566         * object.h (class Object): Add uses_split_stack_ and
12567         has_no_split_stack_ fields.  Add uses_split_stack and
12568         has_no_split_stack accessor functions.  Declare
12569         handle_split_stack_section.
12570         (class Reloc_symbol_changes): Define.
12571         (class Sized_relobj): Define Function_offsets.  Declare
12572         split_stack_adjust, split_stack_adjust_reltype, and
12573         find_functions.
12574         * object.cc (Object::handle_split_stack_section): New function.
12575         (Sized_relobj::do_layout): Call handle_split_stack_section.
12576         * dynobj.cc (Sized_dynobj::do_layout): Call
12577         handle_split_stack_section.
12578         * reloc.cc (Sized_relobj::relocate_sections): Call
12579         split_stack_adjust for executable sections in split_stack
12580         objects.  Pass reloc_map to relocate_section.
12581         (Sized_relobj::split_stack_adjust): New function.
12582         (Sized_relobj::split_stack_adjust_reltype): New function.
12583         (Sized_relobj::find_functions): New function.
12584         * target-reloc.h: Include "object.h".
12585         (relocate_section): Add reloc_symbol_changes parameter.  Change
12586         all callers.
12587         * target.h (class Target): Add calls_non_split method.  Declare
12588         do_calls_non_split virtual method.  Declare match_view and
12589         set_view_to_nop.
12590         * target.cc: Include "elfcpp.h".
12591         (Target::do_calls_non_split): New function.
12592         (Target::match_view): New function.
12593         (Target::set_view_to_nop): New function.
12594         * gold.cc (queue_middle_tasks): Give an error if mixing
12595         split-stack and non-split-stack objects with -r.
12596         * i386.cc (Target_i386::relocate_section): Add
12597         reloc_symbol_changes parameter.
12598         (Target_i386::do_calls_non_split): New function.
12599         * x86_64.cc (Target_x86_64::relocate_section): Add
12600         reloc_symbol_changes parameter.
12601         (Target_x86_64::do_calls_non_split): New function.
12602         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12603         parameter.
12604         * powerpc.cc (Target_powerpc::relocate_section): Add
12605         reloc_symbol_changes parameter.
12606         * sparc.cc (Target_sparc::relocate_section): Add
12607         reloc_symbol_changes parameter.
12608         * configure.ac: Call AM_CONDITIONAL for the default target.
12609         * configure: Rebuild.
12610         * testsuite/Makefile.am (TEST_AS): New variable.
12611         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12612         (check_DATA): Add split_i386 and split_x86_64 files.
12613         (SPLIT_DEFSYMS): Define.
12614         (split_i386_[1234n].o): New targets.
12615         (split_i386_[124]): New targets.
12616         (split_i386_[1234r].stdout): New targets.
12617         (split_x86_64_[1234n].o): New targets.
12618         (split_x86_64_[124]): New targets.
12619         (split_x86_64_[1234r].stdout): New targets.
12620         (MOSTLYCLEANFILES): Add new executables.
12621         * testsuite/split_i386.sh: New file.
12622         * testsuite/split_x86_64.sh: New file.
12623         * testsuite/split_i386_1.s: New file.
12624         * testsuite/split_i386_2.s: New file.
12625         * testsuite/split_i386_3.s: New file.
12626         * testsuite/split_i386_4.s: New file.
12627         * testsuite/split_i386_n.s: New file.
12628         * testsuite/split_x86_64_1.s: New file.
12629         * testsuite/split_x86_64_2.s: New file.
12630         * testsuite/split_x86_64_3.s: New file.
12631         * testsuite/split_x86_64_4.s: New file.
12632         * testsuite/split_x86_64_n.s: New file.
12633         * testsuite/testfile.cc (Target_test): Update relocation_section
12634         function.
12635         * testsuite/Makefile.in: Rebuild.
12636
12637 2009-10-06  Ian Lance Taylor  <iant@google.com>
12638
12639         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12640         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12641         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12642         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12643         the address on ldo_addrs_.
12644         (Target_i386::Relocate::fix_up_ldo): New function.
12645
12646 2009-10-06   Rafael Espindola  <espindola@google.com>
12647
12648         * plugin.cc (add_input_library): New.
12649         (Plugin::load): Add add_input_library to tv.
12650         (Plugin_manager::add_input_file): Add the is_lib argument.
12651         (add_input_file): Update call to Plugin_manager::add_input_file.
12652         (add_input_library): New.
12653         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12654
12655 2009-09-30  Doug Kwan  <dougkwan@google.com>
12656
12657         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12658         symbol and call Symbol::may_need_copy_reloc to determine if
12659         a copy reloc is needed.
12660         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12661         nocopyreloc is given in command line.
12662         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12663         given in command line.
12664         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12665         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12666         of the removed Target_i386::may_need_copy_reloc.
12667         * options.h (copyreloc): New option with default value false.
12668         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12669         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12670         instead of the removed Target_powerpc::may_need_copy_reloc.
12671         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12672         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12673         instead of the removed Target_sparc::may_need_copy_reloc.
12674         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12675         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12676         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12677         instead of the removed Target_x86_64::may_need_copy_reloc.
12678
12679 2009-09-30  Ian Lance Taylor  <iant@google.com>
12680
12681         * object.h (class Object): Remove target_ field, and target,
12682         sized_target, and set_target methods.
12683         (Object::sized_target): Remove.
12684         (class Sized_relobj): Update declarations.  Remove sized_target.
12685         * object.cc (Sized_relobj::setup): Remove target parameter.
12686         Change all callers.
12687         (Input_objects::add_object): Don't do anything with the target.
12688         (make_elf_sized_object): Add punconfigured parameter.  Change all
12689         callers.  Set or test parameter target.
12690         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12691         Change all callers.
12692         * parameters.cc (Parameters::set_target): Change parameter type to
12693         be non-const.
12694         (Parameters::default_target): Remove.
12695         (set_parameters_target): Change parameter type to be non-const.
12696         (parameters_force_valid_target): New function.
12697         (parameters_clear_target): New function.
12698         * parameters.h (class Parameters): Update declarations.  Remove
12699         default_target method.  Add sized_target and clear_target
12700         methods.  Change target_ to be non-const.
12701         (set_parameters_target): Update declaration.
12702         (parameters_force_valid_target): Declare.
12703         (parameters_clear_target): Declare.
12704         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12705         as NULL if we aren't searching.
12706         (Add_symbols::run): Don't check for compatible target.
12707         * fileread.cc (Input_file::open_binary): Call
12708         parameters_force_valid_target.
12709         * gold.cc (queue_middle_tasks): Likewise.
12710         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12711         set_target on object.
12712         * dynobj.h (class Sized_dynobj): Update declarations.
12713         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12714         make_elf_object returns NULL.
12715         (Archive::include_member): Don't check whether object target is
12716         compatible.
12717         * output.cc (Output_section::add_input_section): Get target from
12718         parameters.
12719         (Output_section::relax_input_section): Likewise.
12720         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12721         parameters.
12722         (Sized_relobj::do_scan_relocs): Likewise.
12723         (Sized_relobj::relocate_sections): Likewise.
12724         * resolve.cc (Symbol_table::resolve): Likewise.
12725         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12726         parameter.  Change all callers.
12727         (Symbol_table::add_from_object): Get target from parameters.
12728         (Symbol_table::add_from_relobj): Don't check object target.
12729         (Symbol_table::add_from_dynobj): Likewise.
12730         (Symbol_table::define_special_symbol): Get target from
12731         parameters.
12732         * symtab.h (class Symbol_table): Update declaration.
12733         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12734         parameter.  Change all callers.  Clear parameter target.
12735         (Binary_test): Test target here.
12736         * testsuite/object_unittest.cc (gold_testsuite): Remove
12737         target_test_pointer parameter.  Change all callers.
12738         (Object_test): Test target here.
12739
12740 2009-09-26  Ian Lance Taylor  <iant@google.com>
12741
12742         * testsuite/initpri1.c: Don't try to use constructor priorities if
12743         compiling with gcc before 4.3.
12744
12745 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12746
12747         * testsuite/retain_symbols_file_test.sh (check_present): Change
12748         output file name to retain_symbols_file_test.stdout.
12749         (check_absent): Likewise.
12750
12751 2009-09-18  Craig Silverstein  <csilvers@google.com>
12752
12753         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12754         * options.cc: Include <cerrno> and <fstream>.
12755         (General_options::finalize): Parse -retain-symbols-file tag.
12756         * options.h: New flag.
12757         (General_options): New method should_retain_symbol, new
12758         variable symbols_to_retain.
12759         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12760         should_retain_symbol map.
12761         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12762         * testsuite/Makefile.in: Regenerate.
12763         * testsuite/retain_symbols_file_test.sh: New file.
12764
12765 2009-09-18  Nick Clifton  <nickc@redhat.com>
12766
12767         * po/es.po: Updated Spanish translation.
12768
12769 2009-09-17  Doug Kwan  <dougkwan@google.com>
12770
12771         * debug.h (DEBUG_RELAXATION): New constant.
12772         (DEBUG_ALL): Add DEBUG_RELAXATION.
12773         (debug_string_to_enum): Add relaxation debug option.
12774         * layout.cc
12775         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12776         Layout::Relaxation_debug_check::read_sections,
12777         Layout::Relaxation_debug_check::read_sections): New method definitions.
12778         (Layout::Layout): Initialize data members
12779         record_output_section_data_from_scrips_,
12780         script_output_section_data_list_ and relaxation_debug_check_.
12781         (Layout::save_segments, Layout::restore_segments,
12782         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12783         Layout::relaxation_loop_body): New method definitions.
12784         (Layout::finalize): Support relaxation.  Move section layout code to
12785         Layout::relaxation_loop_body.
12786         (Layout::set_asection_address_from_script): Move code for orphan
12787         section placement out.
12788         (Layout::place_orphan_sections_in_script): New method definition.
12789         * layout.h (Output_segment_headers, Output_file_header):
12790         New forward class declarations.
12791         (Layout::~Layout): Define.
12792         (Layout::new_output_section_data_from_script): New method definition.
12793         (Layout::place_orphan_sections_in_script): New method declaration.
12794         (Layout::Segment_states): New type declaration.
12795         (Layout::save_segments, Layout::restore_segments,
12796         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12797         Layout::relaxation_loop_body): New method declarations.
12798         (Layout::Output_section_data_list): New type declaration.
12799         (Layout::Relaxation_debug_check): New class definition.
12800         (Layout::record_output_section_data_from_script_,
12801         Layout::script_output_section_data_list_, Layout::segment_states_,
12802         Layout::relaxation_debug_check_): New data members.
12803         * output.cc: (Output_section_headers::do_size): New method definition.
12804         (Output_section_headers::Output_section_headers): Move size
12805         computation to Output_section_headers::do_size.
12806         (Output_segment_headers::do_size): New method definition.
12807         (Output_file_header::Output_file_header): Move size computation to
12808         Output_file_header::do_size and call it.
12809         (Output_file_header::do_size): New method definition.
12810         (Output_data_group::Output_data_group): Adjust call to
12811         Output_section_data.
12812         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12813         (Output_symtab_xindex::do_write): Add array bound check.
12814         (Output_section::Input_section::print_to_mapfile): Handle
12815         RELAXED_INPUT_SECTION_CODE.
12816         (Output_section::Output_section): Initialize data member checkpoint_.
12817         (Output_section::~Output_section): Delete checkpoint object pointed
12818         by checkpoint_.
12819         (Output_section::add_input_section): Always add an Input_section if
12820         relaxing.
12821         (Output_section::add_merge_input_section): Add assert.
12822         (Output_section::relax_input_section): New method definition.
12823         (Output_section::set_final_data_size): Set load address to zero for
12824         an unallocated section.
12825         (Output_section::do_address_and_file_offset_have_reset_values):
12826         New method definition.
12827         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12828         Handle relaxed input section.
12829         (Output_section::sort_attached_input_sections): Checkpoint input
12830         section list lazily.
12831         (Output_section::get_input_sections): Change type of input_sections to
12832         list of Simple_input_section pointers.  Checkpoint input section list
12833         lazily.  Also handle relaxed input sections.
12834         (Output_section::add_input_section_for_script): Take a reference to
12835         a Simple_input_section object instead of Relobj pointer and section
12836         index as parameter.  Handle relaxed input sections.
12837         (Output_section::save_states, Output_section::restore_states): New
12838         method definitions.
12839         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12840         (Output_data::is_data_size_fixed): New method definition.
12841         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12842         if it is fixed.
12843         (Output_data::address_and_file_offset_have_reset_values): New method
12844         definition.
12845         (Output_data::do_address_and_file_offset_have_reset_values): New method
12846         definition.
12847         (Output_data::set_data_size): Check that data size is not fixed.
12848         (Output_data::fix_data_size): New method definition.
12849         (Output_data::is_data_size_fixed_): New data member.
12850         (Output_section_headers::set_final_data_size): New method definition.
12851         (Output_section_headers::do_size): New method declaration.
12852         (Output_segment_headers::set_final_data_size): New method definition.
12853         (Output_segment_headers::do_size): New method declaration.
12854         (Output_file_header::set_final_data_size)::New method definition.
12855         (Output_file_header::do_size)::New method declaration.
12856         (Output_section_data::Output_section_data): Add new parameter
12857         is_data_size_fixed and use it to fix data size.
12858         (Output_data_const::Output_data_const): Adjust call to base class
12859         constructor and fix data size.
12860         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12861         base class constructor and fix data size.
12862         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12863         base class constructor and fix data size.
12864         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12865         class constructor and fix data size.
12866         (Output_data_group::set_final_data_size): New method definition.
12867         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12868         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12869         class constructor and fix data size.
12870         (Output_relaxed_input_section): New class definition.
12871         (Output_section::Simple_input_section): New class definition.
12872         (Output_section::get_input_sections): Adjust parameter list.
12873         (Output_section::add_input_section_for_script): Same.
12874         (Output_section::save_states, Output_section::restore_states,
12875         Output_section::do_address_and_file_offset_have_reset_values,
12876         (Output_section::Input_section::Input_section): Handle
12877         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12878         Output_relaxed_input_section.
12879         (Output_section::Input_section::is_input_section,
12880         Output_section::Input_section::set_output_section): Handle relaxed
12881         input section.
12882         (Output_section::Input_section::is_relaxed_input_section,
12883         Output_section::Input_section::output_section_data,
12884         Output_section::Input_section::relaxed_input_section): New method
12885         definitions.
12886         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12887         value.
12888         (Output_section::Input_section::u1_): Update comments.
12889         (Output_section::Input_section::u2_): Add new union member poris.
12890         (Output_section::Checkpoint_output_section): New classs definition.
12891         (Output_section::relax_input_section): New method declaration.
12892         (Output_section::checkpoint_): New data member.
12893         (Output_segment): Update comments.
12894         (Output_segment::Output_segment): Un-privatize copy constructor.
12895         (Output_segment::operator=): Un-privatize.
12896         * script-sections.cc (Output_section_element::Input_section_list):
12897         Change element type to Output_section::Simple_input_section.
12898         (Output_section_element_dot_assignment::set_section_addresses):
12899         Register output section data for relaxation clean up.
12900         (Output_data_exression::Output_data_expression): Adjust call to base
12901         constructor to fix data size.
12902         (Output_section_element_data::set_section_addresses): Register
12903         Output_data_expression object for relaxation clean up.
12904         (struct Input_section_info): Replace Relobj pointer and section index
12905         pair with Output_section::Simple_input_section and Convert struct to a
12906         class.
12907         (Input_section_sorter::operator()): Adjust access to
12908         Input_section_info data member to use accessors.
12909         (Output_section_element_input::set_section_addresses): Use layout
12910         parameter.  Adjust code to use Output_section::Simple_input_section
12911         and Input_secction_info classes.  Register filler for relaxation
12912         clean up.
12913         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12914         and section index pair with Output_section::Simple_input_section
12915         class.  Adjust code accordingly.
12916         (Phdrs_element::release_segment): New method definition.
12917         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12918         segment list.
12919         (Script_sections::release_segments): New method definition.
12920         * gold/script-sections.h (Script_sections::release_segments): New
12921         method declaration.
12922         * gold/target.h (Target::may_relax, Target::relax,
12923         Target::do_may_relax, Target::do_relax): New method definitions.
12924
12925 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12926
12927         * arm.cc (has_signed_unsigned_overflow): New function.
12928         (Arm_relocate_functions::abs8): New function.
12929         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12930         (Target_arm::Scan::global): Likewise.
12931         (Target_arm::relocate::relocate): Likewise.
12932         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12933         Likewise.
12934
12935 2009-09-16  Cary Coutant  <ccoutant@google.com>
12936
12937         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12938         * testsuite/Makefile.in: Regenerate.
12939
12940 2009-09-11  Nick Clifton  <nickc@redhat.com>
12941
12942         * po/gold.pot: Updated by the Translation project.
12943
12944 2009-09-08  Cary Coutant  <ccoutant@google.com>
12945
12946         * output.cc (Output_file::open): Add execute permission to empty file.
12947         * testsuite/Makefile.am (permission_test): New test.
12948         * testsuite/Makefile.in: Regenerate.
12949
12950 2009-09-02  Ian Lance Taylor  <iant@google.com>
12951
12952         * output.cc (Output_file::resize): Call map_no_anonymous rather
12953         than map.
12954
12955 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12956
12957         * gold.cc: Include "incremental.h".
12958         (queue_initial_tasks): Call Incremental_checker methods.
12959         * incremental.cc: Include "output.h".
12960         (Incremental_checker::can_incrementally_link_output_file): New
12961         method.
12962         * incremental.h (Incremental_checker): New class.
12963
12964         * output.cc (Output_file::open_for_modification): New method.
12965         (Output_file::map_anonymous): Changed return type to bool.  Record
12966         map in base_ field.
12967         (Output_file::map_no_anonymous): New method, broken out of map.
12968         (Output_file::map): Use map_no_anonymous and map_anonymous.
12969         * output.h (class Output_file): Update declarations.
12970
12971 2009-08-24  Cary Coutant  <ccoutant@google.com>
12972
12973         * options.h (Command_line::Pre_options): New class.
12974         (Command_line::pre_options): New member.
12975         * options.cc (gold::options::ready_to_register): New variable.
12976         (One_option::register_option): Do nothing if not registering options.
12977         Assert if same short option registered twice.
12978         (General_options::General_options): Turn off option registration when
12979         done constructing.
12980         (Command_line::Pre_options::Pre_options): New constructor.
12981
12982 2009-08-24  Cary Coutant  <ccoutant@google.com>
12983
12984         * options.h (General_options::no_keep_memory): Remove incorrect
12985         short option.
12986
12987 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12988
12989         * Makefile.am (am__skiplex, am__skipyacc): New.
12990         * Makefile.in: Regenerate.
12991
12992 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12993
12994         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12995         (INCLUDES): ... this.
12996         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12997         (AM_CPPFLAGS): Renamed from ...
12998         (INCLUDE): ... this.
12999         * Makefile.in, testsuite/Makefile.in: Regenerate.
13000
13001         * Makefile.in: Regenerate.
13002         * aclocal.m4: Likewise.
13003         * config.in: Likewise.
13004         * configure: Likewise.
13005         * testsuite/Makefile.in: Likewise.
13006
13007         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13008         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13009         * Makefile.in: Regenerate.
13010         * testsuite/Makefile.in: Regenerate.
13011
13012 2009-08-19  Cary Coutant  <ccoutant@google.com>
13013
13014         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13015         symbols in shared libraries overridden by hidden or internal symbols
13016         in the main program.
13017
13018 2009-08-19  Chris Demetriou  <cgd@google.com>
13019
13020         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13021         checking source file names in error messages.
13022
13023 2009-08-18  Doug Kwan  <dougkwan@google.com>
13024
13025         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13026         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13027         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13028         an elfcpp::Ehdr as parameter.
13029         * object.cc (Object::set_target): Remove the version that looks up
13030         a target and sets it.
13031         (Sized_relobj::setup): Take a Target object instead of
13032         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13033         (make_elf_sized_object): Find target and ask target to
13034         make an ELF object.
13035         * object.h: (Object::set_target): Remove the version that looks up
13036         a target and sets it.
13037         (Sized_relobj::setup): Take a Target object instead of
13038         an elfcpp:Ehdr as parameter.
13039         * target.cc: Include dynobj.h.
13040         (Target::do_make_elf_object_implementation): New.
13041         (Target::do_make_elf_object): New.
13042         * target.h (Target::make_elf_object): New template declaration.
13043         (Target::do_make_elf_object): New method declarations.
13044         (Target::do_make_elf_object_implementation): New template declaration.
13045
13046 2009-08-14  Ian Lance Taylor  <iant@google.com>
13047
13048         * gold.h (FUNCTION_NAME): Define.
13049         (gold_unreachable): Use FUNCTION_NAME.
13050
13051 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13052
13053         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13054         symbol in the --keep-unique list is not found.
13055
13056 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13057
13058         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13059         been maked as --keep-unique.
13060         (Icf::unfold_section): New function.
13061         * icf.h (Icf::unfold_section): New function.
13062         * options.h (General_options::keep_unique): New option.
13063         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13064         * testsuite/Makefile.in: Regenerate.
13065         * testsuite/icf_keep_unique_test.sh: New file.
13066         * testsuite/icf_keep_unique_test.cc: New file.
13067
13068 2009-08-12  Cary Coutant  <ccoutant@google.com>
13069
13070         PR 10471
13071         * resolve.cc (Symbol_table::resolve): Check for references from
13072         dynamic objects to hidden and internal symbols.
13073         * testsuite/Makefile.am (hidden_test.sh): New test.
13074         * testsuite/Makefile.in: Regenerate.
13075         * testsuite/hidden_test.sh: New script.
13076         * testsuite/hidden_test_1.c: New test source.
13077         * testsuite/hidden_test_main.c: New test source.
13078
13079 2009-08-11  Doug Kwan  <dougkwan@google.com>
13080
13081         * arm.cc: Update comments.
13082         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13083         segment to locate the .ARM.exidx section if present.
13084
13085 2009-08-09  Doug Kwan  <dougkwan@google.com>
13086
13087         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13088         patch.
13089
13090 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13091         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13092         compiler warnings.
13093
13094 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13095
13096         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13097         valid tls_segment only for non-debug-section relocations.
13098         * testsuite/Makefile.am: Add gc_tls_test.
13099         * testsuite/Makefile.in: Regenerate.
13100         * testsuite/gc_tls_test.cc: New file.
13101         * testsuite/gc_tls_test.sh: New file.
13102
13103 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13104
13105         * icf.cc: New file.
13106         * icf.h: New file.
13107         * Makefile.am (CCFILES): Add icf.cc.
13108         (HFILES): Add icf.h
13109         * Makefile.in: Regenerate.
13110         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13111         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13112         section, symbol and addend information for the relocs.
13113         * gold.cc (queue_middle_tasks): Call identical code folding.
13114         * gold.h: Add defines for multimap.
13115         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13116         to the call of finalize_local_symbols.
13117         * main.cc (main): Create object of class Icf.
13118         * object.cc (Sized_relobj::do_layout): Allow this function to be
13119         called twice during icf.
13120         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13121         to sections marked as identical by icf.
13122         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13123         when available.
13124         (Sized_relobj::do_section_entsize): New function.
13125         * object.h (Object::section_entsize): New function.
13126         (Object::do_section_entsize): New pure virtual function.
13127         (Relobj::finalize_local_symbols): Add new parameter.
13128         (Relobj::do_section_entsize): New function.
13129         * options.h (General_options::icf): New option.
13130         (General_options::icf_iterations): New option.
13131         (General_options::print_icf_sections): New option.
13132         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13133         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13134         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13135         icf.
13136         * symtab.cc (Symbol_table::is_section_folded): New function.
13137         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13138         to sections marked as identical by icf.
13139         * symtab.h (Symbol_table::set_icf): New function.
13140         (Symbol_table::icf): New function.
13141         (Symbol_table::is_section_folded): New function.
13142         (Symbol_table::icf_): New data member.
13143         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13144         * testsuite/Makefile.am: Add commands to build icf_test.
13145         * testsuite/Makefile.in: Regenerate.
13146         * testsuite/icf_test.sh: New file.
13147         * testsuite/icf_test.cc: New file.
13148
13149 2009-07-24  Chris Demetriou  <cgd@google.com>
13150
13151         * layout.cc (is_compressible_debug_section): Fix incorrect
13152         comment about compressed section names.
13153
13154 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13155
13156         PR 10419
13157         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13158
13159 2009-07-16  Ian Lance Taylor  <iant@google.com>
13160
13161         PR 10400
13162         * layout.h: #include <map>.
13163         (class Kept_section): Change from struct to class.  Add accessors
13164         and setters.  Add section size to Comdat_group mapping.  Change
13165         Comdat_group to std::map.  Add is_comdat_ field.  Add
13166         linkonce_size field in union.
13167         (class Layout): Update declaration of find_or_add_kept_section.
13168         Don't declare find_kept_object.
13169         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13170         parameter.  Add object, shndx, is_comdat, and is_group_name
13171         parameters.  Change all callers.  Adjust for new Kept_section.
13172         (Layout::find_kept_object): Remove.
13173         * object.cc (Sized_relobj::include_section_group): Update use of
13174         Kept_section.  Rename secnum to shndx.  Only record
13175         Kept_comdat_section if sections are the same size.
13176         (Sized_relobj::include_linkonce_section): Update use of
13177         Kept_section.  Only record Kept_comdat_section if sections are the
13178         same size.  Set size of linkonce section.
13179         (Sized_relobj::map_to_kept_section): Update call to
13180         get_kept_comdat_section.
13181         * object.h (class Sized_relobj): Rename fields in
13182         Kept_comdat_section to drop trailing underscores; change object
13183         field to Relobj*.  Change Kept_comdat_section_table to store
13184         struct rather than pointer.
13185         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13186         Add kept_object and kept_shndx parameters.  Change all callers.
13187         (Sized_relobj::get_kept_comdat_section): Change return type to
13188         bool.  Add kept_object and kept_shndx parameters.  Change all
13189         callers.
13190         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13191         Layout::find_or_add_kept_section.
13192
13193 2009-07-09  Ian Lance Taylor  <iant@google.com>
13194
13195         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13196         Reserve space in the hash table.
13197
13198 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13199
13200         * fileread.cc (File_read::get_mtime): New method.
13201         * fileread.h (Timespec): New structure.
13202         (File_read::get_mtime): New method.
13203         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13204         Renamed from timestamp_nsec.
13205         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13206         Elf_Xword.
13207         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13208         timestamp_nsec.
13209         (Incremental_inputs::report_archive): Save mtime; style fix.
13210         (Incremental_inputs::report_obejct): Save mtime; style fix.
13211         (Incremental_inputs::report_script): Save mtime; style fix.
13212         (Incremental_inputs::finalize_inputs): Style fix.
13213         (Incremental_inputs::finalize): Style fix.
13214         (Incremental_inputs::create_input_section_data): Store inputs
13215         mtime.
13216         * incremental.h (Incremental_inputs::report_script): Add mtime
13217         argument.
13218         (Incremental_inputs::Input_info::Input_info): Intialize only one
13219         union member.
13220         (Incremental_inputs::Input_info::archive): Move to nameless
13221         union.
13222         (Incremental_inputs::Input_info::obejct): Move to nameless union.
13223         (Incremental_inputs::Input_info::script): Move to nameless union.
13224         (Incremental_inputs::mtime): New field.
13225         * script.cc (read_input_script): Pass file mtime to
13226         Incremental_input.
13227         * script.h (Script_info::inputs): Style fix.
13228
13229 2009-07-01  Ian Lance Taylor  <ian@airs.com>
13230
13231         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13232         instead of 32.
13233
13234 2009-06-24  Ian Lance Taylor  <iant@google.com>
13235
13236         PR 10156
13237         * layout.cc (Layout::choose_output_section): If we find an
13238         existing section, update the flags.
13239         (Layout::create_notes): New function, broken out of
13240         Layout::finalize.
13241         (Layout::finalize): Don't create note sections.
13242         (Layout::create_note): Don't crash if linker script discards
13243         section.
13244         (Layout::create_gold_note): Likewise.
13245         (Layout::create_build_id): Likewise.  Don't set
13246         after_input_sections on the section.
13247         (Layout::create_executable_stack_info): Remove target parameter.
13248         Change caller.
13249         * layout.h (class Layout): Declare create_notes.  Update
13250         declaration of create_executable_stack_info.
13251         * gold.cc (queue_middle_tasks): Call create_notes.
13252         * output.cc (Output_section::update_flags_for_input_section): Move
13253         here from output.h.  If SHF_ALLOC flag is newly set, mark address
13254         invalid.
13255         * output.h (Output_data::mark_address_invalid): New function.
13256         (class Output_section): Only declare, not define,
13257         update_flags_for_input_section.  Remove set_flags.
13258
13259 2009-06-24  Ian Lance Taylor  <iant@google.com>
13260
13261         * script-sections.cc (Output_section_definition::
13262         set_section_addresses): Rename shadowing local load_address to
13263         laddr.
13264
13265 2009-06-24  Ian Lance Taylor  <iant@google.com>
13266
13267         PR 10244
13268         * reloc.cc (relocate_sections): Skip empty relocation sections.
13269
13270 2009-06-23  Ian Lance Taylor  <iant@google.com>
13271
13272         PR 10156
13273         * layout.cc (Layout::create_note): Use choose_output_section
13274         rather than make_output_section.
13275
13276 2009-06-23  Ian Lance Taylor  <iant@google.com>
13277
13278         PR 10237
13279         * options.cc (General_options::parse_V): Set printed_version_.
13280         (General_options::General_options): Initialize printed_version_.
13281         * options.h (class General_options): Add printed_version_ field.
13282         * gold.cc (queue_initial_tasks): If there are no input files,
13283         don't give a fatal error if we printed the version information.
13284         (queue_middle_tasks): If using -r with a shared object, give a
13285         fatal error rather than an ordinary error.
13286
13287 2009-06-23  Ian Lance Taylor  <iant@google.com>
13288
13289         PR 10219
13290         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13291         (Layout::make_output_section): Set have_stabstr_section_ if we see
13292         a .stab*str section.
13293         (Layout::finalize): Call link_stabs_sections.
13294         (Layout::link_stabs_sections): New file.
13295         * layout.h (class Layout): Add have_stabstr_section_ field.
13296         Declare link_stabs_sections.
13297
13298 2009-06-23  Doug Kwan  <dougkwan@google.com>
13299
13300         * Makefile.am (libgold_a_LIBADD): New.
13301         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13302         * Makefile.in: Regenerate.
13303         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13304         * configure: Regenerate.
13305         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13306         * fileread.cc: Include sys/state.h
13307         * gold.h: Declare memmem and strndup if found missing.
13308         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13309
13310 2009-06-23  Ian Lance Taylor  <iant@google.com>
13311
13312         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13313         * configure: Rebuild.
13314
13315 2009-06-23  Ian Lance Taylor  <iant@google.com>
13316
13317         PR 10147
13318         * object.cc (Object::section_contents): Don't try to get a view if
13319         the section has length zero.
13320         (Object::handle_gnu_warning_section): If the section is empty, use
13321         the name of the section as the warning.
13322
13323 2009-06-23  Ian Lance Taylor  <iant@google.com>
13324
13325         PR 10133
13326         * stringpool.h (class Stringpool_template): Add optimize_ field.
13327         (Stringpool_template::set_optimize): New function.
13328         * stringpool.cc (Stringpool_template::Stringpool_template):
13329         Initialize optimize_ field.
13330         (Stringpool_template::set_string_offsets): Test local optimize
13331         fild rather than parameter.
13332         * layout.cc (Layout::Layout): Call set_optimize on the section
13333         name stringpool.
13334
13335 2009-06-22  Ian Lance Taylor  <iant@google.com>
13336
13337         PR 10030
13338         * yyscript.y: Parse TARGET.
13339         * script.cc (script_set_target): New function.
13340         * script-c.h (script_set_target): Declare.
13341         * options.cc (General_options::string_to_object_format): Rename
13342         from string_to_object_format in anonymous namespace.  Change
13343         callers.
13344         * options.h (class General_options): Declare
13345         string_to_object_format.
13346
13347 2009-06-22  Ian Lance Taylor  <iant@google.com>
13348
13349         * script-sections.cc (Script_sections::create_segments): Don't put
13350         program headers in a PT_LOAD segment if -n or -N.
13351
13352 2009-06-22  Ian Lance Taylor  <iant@google.com>
13353
13354         PR 10141
13355         * options.h (class General_options): Add -z lazy and -z now.  Sort
13356         -z options into alphabetical order.
13357         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13358
13359 2009-06-21  Ian Lance Taylor  <iant@google.com>
13360
13361         * layout.cc (Layout::make_output_section): Call
13362         Target::new_output_section.
13363         (Layout::attach_allocated_section_to_segment): Put large section
13364         sections in a separate load segment with the large segment flag
13365         set.
13366         (Layout::segment_precedes): Sort large data segments after other
13367         load segments.
13368         (align_file_offset): New static function.
13369         (Layout::set_segment_offsets): Use align_file_offset.
13370         * output.h (class Output_section): Add is_small_section_ and
13371         is_large_section_ fields.
13372         (Output_section::is_small_section): New function.
13373         (Output_section::set_is_small_section):  New function.
13374         (Output_section::is_large_section): New function.
13375         (Output_section::set_is_large_section): New function.
13376         (Output_section::is_large_data_section): New function.
13377         (class Output_segment): Add is_large_data_segment_ field.
13378         (Output_segment::is_large_data_segment): New function.
13379         (Output_segment::set_is_large_data_segment): New function.
13380         * output.cc (Output_section::Output_section): Initialize new
13381         fields.
13382         (Output_segment::Output_segment): Likewise.
13383         (Output_segment::add_output_section): Add assertion that large
13384         data sections always go in large data segments.  Force small data
13385         sections to the end of the list of data sections.  Force small BSS
13386         sections to the start of the list of BSS sections.  For large BSS
13387         sections to the end of the list of BSS sections.
13388         * symtab.h (class Symbol): Declare is_common_shndx.
13389         (Symbol::is_defined): Check Symbol::is_common_shndx.
13390         (Symbol::is_common): Likewise.
13391         (class Symbol_table): Define enum Commons_section_type.  Update
13392         declarations.  Add small_commons_ and large_commons_ fields.
13393         * symtab.cc (Symbol::is_common_shndx): New function.
13394         (Symbol_table::Symbol_table): Initialize new fields.
13395         (Symbol_table::add_from_object): Put small and large common
13396         symbols in the right list.
13397         (Symbol_table::sized_finalized_symbol): Check
13398         Symbol::is_common_shndx.
13399         (Symbol_table::sized_write_globals): Likewise.
13400         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13401         common symbol lists.  Don't call do_allocate_commons_list if the
13402         list is empty.
13403         (Symbol_table::do_allocate_commons_list): Remove is_tls
13404         parameter.  Add comons_section_type parameter.  Change all
13405         callers.  Handle small and large common symbols.
13406         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13407         Symbol::is_common_shndx.
13408         * resolve.cc (symbol_to_bits): Likewise.
13409         * target.h (Target::small_common_shndx): New function.
13410         (Target::small_common_section_flags): New function.
13411         (Target::large_common_shndx): New function.
13412         (Target::large_common_section_flags): New function.
13413         (Target::new_output_section): New function.
13414         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13415         small_common_section_flags, and large_common_section_flags
13416         fields.
13417         (Target::do_new_output_section): New virtual function.
13418         * arm.cc (Target_arm::arm_info): Initialize new fields.
13419         * i386.cc (Target_i386::i386_info): Likewise.
13420         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13421         Likewise.
13422         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13423         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13424         (Target_x86_64::do_new_output_section): New function.
13425         * configure.ac: Define conditional MCMODEL_MEDIUM.
13426         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13427         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13428         (large_LDFLAGS): Define.
13429         * testsuite/large.c: New file.
13430         * testsuite/testfile.cc (Target_test::test_target_info):
13431         Initialize new fields.
13432         * configure, testsuite/Makefile.in: Rebuild.
13433
13434 2009-06-05  Doug Kwan  <dougkwan@google.com>
13435
13436         * Makefile.am (CCFILES): Add target.cc.
13437         * Makefile.in: Regenerate.
13438         * i386.cc (class Target_i386): Define new virtual method to
13439         override do_is_local_label_name in parent.
13440         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13441         local symbols if --discard-locals or -X is given.
13442         * options.h (class General_options): Declare new options
13443         '--discard-locals' and '-X' for discarding locals.
13444         * target.h (class Target): Define new methods is_local_label_name.
13445         Declare new virtual method do_is_local_label_name.
13446         * target.cc: New file.
13447         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13448         (check_SCRIPTS): Add discard_locals_test.sh.
13449         (check_DATA): Add discard_local_tests.syms.
13450         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13451         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13452         * testsuite/Makefile.in: Regenerate.
13453         * testsuite/discard_locals_test.c: New file.
13454         * testsuite/discard_locals_test.sh: Same.
13455
13456 2009-06-05  Doug Kwan  <dougkwan@google.com>
13457
13458         * object.cc (Sized_relobj::Sized_relobj): Initialize
13459         discarded_eh_frame_shndx_ to -1U.
13460         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13461         section.
13462         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13463         a discarded .eh_frame section.
13464         (Sized_relobj::do_finalize_local_symbols): Ditto.
13465         * object.h (class Sized_relobj): Declare new member
13466         discarded_eh_frame_shndx_.
13467         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13468         (local_labels_test.o, local_labels_test): New rules.
13469         * testsuite/Makefile.in: Regenerate.
13470
13471 2009-06-04  Doug Kwan  <dougkwan@google.com>
13472
13473         * layout.cc (Layout::section_name_mapping): Add mapping for
13474         special ARM sections.
13475
13476 2009-06-03  Doug Kwan  <dougkwan@google.com>
13477
13478         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13479         (utils::has_overflow): Same.
13480
13481 2009-06-03  Ian Lance Taylor  <iant@google.com>
13482
13483         * layout.cc (Layout::section_name_mapping): New array, replacing
13484         Layout::linkonce_mapping.
13485         (Layout::section_name_mapping_count): New variable, replacing
13486         Layout::linkonce_mapping_count.
13487         (Layout::linkonce_output_name): Remove.
13488         (Layout::output_section_name): Rewrite.
13489         * layout.h (class Layout): Rename Linkonce_mapping to
13490         Section_name_mapping, linkonce_mapping to section_name_mapping,
13491         linkonce_mapping_count to section_name_mapping_count.  Don't
13492         declare linkonce_output_name.
13493
13494 2009-06-03  Doug Kwan  <dougkwan@google.com>
13495
13496         * gold/arm.cc (namespace utils): New.
13497         (Target_arm::reloc_is_non_pic): Define new method.
13498         (class Arm_relocate_functions): New.
13499         (Target_arm::Relocate::relocate): Handle relocation types used by
13500         Android.
13501
13502 2009-06-03  Ian Lance Taylor  <iant@google.com>
13503
13504         * arm.cc (Target_arm::scan::global): Use || instead of |.
13505
13506 2009-06-02  Doug Kwan  <dougkwan@google.com>
13507
13508         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13509         issued_non_pic_error_.
13510         (class Target_arm::Scan): Declare new method check_non_pic.
13511         Define new method symbol_needs_plt_entry.
13512         Declare new data member issued_non_pic_error_.
13513         (class Target_arm::Relocate): Declare new method
13514         should_apply_static_reloc.
13515         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13516         (Target_arm::Scan::check_non_pic): Define new method.
13517         (Target_arm::Scan::local): Handle a small subset of reloc types used
13518         by Android.
13519         (Target_arm::Scan::local): Same.
13520         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13521
13522 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13523
13524         * incremental.cc (Incremental_inputs::report_command_line): Filter
13525         out --incremental-* options.
13526
13527 2009-05-29  Doug Kwan  <dougkwan@google.com>
13528
13529         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13530         template class.
13531         (class Target_arm): Update comment.
13532         (Target_arm::Target_arm): Initialize new data members GOT_,
13533         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13534         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13535         and Target_arm::rel_dyn_section.
13536         Declare new_enum Target_arm::Got_type.
13537         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13538         and DYNBSS_.
13539         Update commments for member do_dynsym_value.
13540         (Target_arm::got_size, Target_arm::plt_section,
13541         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13542         new methods inside class defintion.
13543         (Target_arm::got_section): Define new method.
13544         (Target_arm::rel_dyn_section): Same.
13545         (Output_data_plt_arm): New template class.
13546         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13547         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13548         (Output_data_plt_arm::add_entry): Same.
13549         (Output_data_plt_arm::first_plt_entry): Define new
13550         static data member for PLT instruction template.
13551         (Output_data_plt_arm::plt_entry): Same.
13552         (Output_data_plt_arm::do_write): Define new method.
13553         (Target_arm::make_plt_entry): Same.
13554         (Target_arm::do_finalize_sections): Same.
13555         (Target_arm::do_dynsym_value): Same.
13556
13557 2009-05-28  Doug Kwan  <dougkwan@google.com>
13558
13559         * Makefile.am (TARGETSOURCES): Add arm.cc.
13560         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13561         * Makefile.in: Regenerate.
13562         * arm.cc: New file.
13563         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13564
13565 2009-05-26  Doug Kwan  <dougkwan@google.com>
13566
13567         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13568         (General_options::check_excluded_libs): Strip off directories in
13569         archive name before matching like GNU ld does.
13570         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13571         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13572         (exclude_libs_test_LDFLAGS): Add linker option
13573         -Wl,--exclude-libs,libexclude_libs_test_3
13574         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13575         an explicit archive without using -l.
13576         (alt/libexclude_libs_test_3.a): New make rule.
13577         * testsuite/Makefile.in: Regenerate.
13578         * testsuite/exclude_libs_test.c : Declare lib3_default().
13579         (main): Call it.
13580         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13581         * exclude_libs_test_3.c: New file.
13582
13583 2009-05-26  Nick Clifton  <nickc@redhat.com>
13584
13585         * po/id.po: New Indonesian translation.
13586         * po/gold.pot: Updated template file.
13587
13588 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13589
13590         * testsuite/Makefile.am: Add -ffunction-sections to compile
13591         gc_comdat_test files.  Add -Wl,--gc-sections to build
13592         gc_comdat_test.
13593         * testsuite/Makefile.in: Regenerate.
13594         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13595
13596 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13597
13598         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13599         kept comdat section was garbage collected.
13600         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13601         * testsuite/Makefile.in: Regenerate.
13602         * testsuite/gc_comdat_test.sh: New file.
13603         * testsuite/gc_comdat_test_1.cc: New file.
13604         * testsuite/gc_comdat_test_2.cc: New file.
13605
13606 2009-05-19  Doug Kwan  <dougkwan@google.com>
13607
13608         * archive.cc (Archive::Archive): Move constructor from archive.h
13609         to here.  Initialize no_export_.
13610         (Archive::get_elf_object_for_member): Set no_export flag of object.
13611         * archive.h (Archive::Archive): Move constructor body to
13612         archive.cc.
13613         (Archive::no_export): New method.
13614         (Archive::no_export_): New field.
13615         * object.h (Object::Object): Initialize no_export_ to false.
13616         (Object::no_export, Object::set_no_export): New methods.
13617         (Object::no_export_): New field.
13618         * options.cc (General_options::parse_exclude_libs): New method.
13619         (General_options::check_excluded_libs) Same.
13620         * options.h (exclude_libs): New option.
13621         (General_options::check_excluded_libs): New method declaration.
13622         (General_options::excluded_libs_): New field.
13623         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13624         default or protected visibility if an object has no-export flag set.
13625         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13626         (check_SCRIPTS): Add exclude_libs_test.sh.
13627         (check_DATA): Add exclude_libs_test.syms.
13628         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13629         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13630         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13631         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13632         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13633         libexclude_libs_test_2.a): New rules.
13634         * testsuite/Makefile.in: Regenerate.
13635         * testsuite/exclude_libs_test.c: New file.
13636         * testsuite/exclude_libs_test.sh: Ditto.
13637         * testsuite/exclude_libs_test_1.c: Ditto.
13638         * testsuite/exclude_libs_test_2.c: Ditto.
13639
13640 2009-05-15  Ian Lance Taylor  <iant@google.com>
13641
13642         * configure.ac: Check for declarations for cases where libiberty.h
13643         checks HAVE_DECL_xxx.
13644         * configure, config.in: Rebuild.
13645
13646 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13647
13648         * gold.h (Incremental_argument_list): Remove (invalid) forward
13649         declaration.
13650         * incremental.cc (Incremental_inputs::report_achive): New method.
13651         (Incremental_inputs::report_object): New method.
13652         (Incremental_inputs::report_script): New method.
13653         (Incremental_inputs::finalize_inputs): New method.
13654         (Incremental_inputs::finalize): Call finalize_inputs().
13655         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13656         Create inputs entries.
13657         * incremental.h (Incremental_input_type): New enum.
13658         (Incremental_inputs::Incremental_input): Initialize new fields.
13659         (Incremental_inputs::report_inputs): New method.
13660         (Incremental_inputs::report_achive): New method.
13661         (Incremental_inputs::report_object): New method.
13662         (Incremental_inputs::report_script): New method.
13663         (Incremental_inputs::finalize_inputs): New method.
13664         (Incremental_inputs::Input_info): New struct.
13665         (Incremental_inputs::Input_info_map): New typedef.
13666         (Incremental_inputs::lock_): New field.
13667         (Incremental_inputs::Inputs_): New field.
13668         (Incremental_inputs::Inputs_map): New field.
13669         * main.cc (main): Call Incremental_input::report_inputs.
13670         * options.h (Input_argument_list): Typedef moved from
13671         Input_arguments.
13672         (Input_file_group::Files): Remove, use ::Input_argument_list.
13673         (Input_file_group::Input_argument_list): Remove, use
13674         ::Input_argument_list.
13675         * plugin.cc (Plugin_manager::add_input_file): Add error in
13676         incremental build.
13677         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13678         functions.
13679         * script.cc (read_input_script): Call
13680         Incremental_input::report_script.
13681         * script.h (Script_info): New class.
13682
13683 2009-04-27  Ian Lance Taylor  <iant@google.com>
13684
13685         * x86_64.cc (do_adjust_output_section): Set entsize to
13686         plt_entry_size.
13687
13688 2009-04-23  Elliott Hughes  <enh@google.com>
13689
13690         * output.cc (Output_file::close): After short writes, continue
13691         writing from the correct offset in the buffer being written.
13692
13693 2009-04-23  Chris Demetriou  <cgd@google.com>
13694
13695         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13696         * configure: Regenerate.
13697         * config.in: Regenerate.
13698         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13699         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13700
13701 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13702
13703         * incremental.cc (Incremental_inputs_header_data): Renamed from
13704         Incremental_input_header_data.
13705         (Incremental_inputs_header_data::data_size): New field.
13706         (Incremental_inputs_header_data::put_input_file_count): Renamed
13707         from input_file_count.
13708         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13709         from command_line_offset.
13710         (Incremental_inputs_header_data::put_reserved): Renamed from
13711         put_reserved.
13712         (Incremental_inputs_entry_data): Renamed from
13713         Incremental_input_entry_data.
13714         (Incremental_inputs_entry_data::data_size): New field.
13715         (Incremental_inputs::report_command_line): New method.
13716         (Incremental_inputs::finalize): New method.
13717         (Incremental_inputs::create_incremental_inputs_data): New method.
13718         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13719         * incremental.h: New file.
13720         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13721         (Layout::finalize): Create incremental inputs section in
13722         incremental builds.
13723         (Layout::create_incremental_info_sections): New method.
13724         * layout.h (Layout::incremental_inputs): New method.
13725         (Layout::create_incremental_info_sections): New method.
13726         (Layout::incremental_inputs_): New field.
13727         * main.cc (main): Notify Incremental_input of the command line.
13728
13729 2009-04-01  Ian Lance Taylor  <iant@google.com>
13730             Mikolaj Zalewski  <mikolajz@google.com>
13731
13732         * gold.h (reserve_unordered_map): Define, three versions, one for
13733         each version of Unordered_map.
13734         * layout.cc (Layout::Layout): Remove options parameter.  Add
13735         number_of_input_files parameter.  Don't initialize options_.
13736         Initialize number_of_input_files_ and resized_signatures_.  Move
13737         sections_are_attached_.
13738         (Layout::layout_group): Reserve space for group_signatures_.
13739         (Layout::find_or_add_kept_section): Change name parameter to be a
13740         reference.  Resize signatures_ map when it gets large enough.
13741         (Layout::layout_eh_frame): Use parameters->options() instead of
13742         this->options_.
13743         (Layout::make_output_section): Likewise.
13744         (Layout::attach_allocated_section_to_segment): Likewise.
13745         (Layout::finalize, Layout::create_executable_stack): Likewise.
13746         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13747         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13748         * layout.h (class Layout): Update declarations.  Remove options_
13749         field.  Add number_of_input_files_ and resized_signatures_
13750         fields.  Move sections_are_attached_ field.
13751         * main.cc (main): Pass number of input files to Layout
13752         constructor.  Don't pass options.
13753
13754 2009-03-30  Ian Lance Taylor  <iant@google.com>
13755
13756         * ffsll.c (ffsll): Correct implementation.
13757
13758 2009-03-27  Ian Lance Taylor  <iant@google.com>
13759
13760         * ffsll.c: New file.
13761         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13762         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13763         * ftruncate.c (ftruncate): Declare before definition.
13764         * mremap.c (mremap): Likewise.
13765         * pread.c (pread): Likewise.
13766         * configure, Makefile.in, config.in: Rebuild.
13767
13768         * mremap.c: New file.
13769         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13770         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13771         (mremap): Declare if HAVE_MREMAP is not defined.
13772         * configure, Makefile.in, config.in: Rebuild.
13773
13774 2009-03-27  Cary Coutant  <ccoutant@google.com>
13775
13776         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13777         position independent.
13778         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13779         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13780
13781 2009-03-24  Cary Coutant  <ccoutant@google.com>
13782
13783         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13784         an executable.
13785         (needs_dynamic_reloc): Likewise.
13786
13787 2009-03-24  Ian Lance Taylor  <iant@google.com>
13788
13789         * yyscript.y (file_cmd): Recognize EXTERN.
13790         (extern_name_list, extern_name_list_body): New nonterminals.
13791         * script.cc (script_add_extern): Define.
13792         * script-c.h (script_add_extern): Declare.
13793
13794 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13795
13796         * object.cc (is_elf_object): Define.
13797         * object.h (is_elf_object): Declare.
13798         * archive.cc (Archive::get_elf_object_for_member): Call
13799         is_elf_object.
13800         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13801
13802 2009-03-24  Elliott Hughes  <enh@google.com>
13803
13804         * output.cc (Output_file::map_anonymous): Define.
13805         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13806         try an anonymous one.  Report the size if the mmap fails.
13807         * output.h (class Output_file): Declare map_anonymous.
13808
13809 2009-03-24  Ian Lance Taylor  <iant@google.com>
13810
13811         * target-select.cc (instantiate_target): Don't acquire the lock if
13812         the instantiated_target_ field has already been set.
13813
13814 2009-03-23  Ian Lance Taylor  <iant@google.com>
13815
13816         * gold-threads.h (class Initialize_lock): Define.
13817         * gold-threads.cc (class Initialize_lock_once): Define.
13818         (initialize_lock_control): New static variable.
13819         (initialize_lock_pointer): New static variable.
13820         (initialize_lock_once): New static function.
13821         (Initialize_lock::Initialize_lock): Define.
13822         (Initialize_lock::initialize): Define.
13823         * target-select.h: Include "gold-threads.h".
13824         (class Target_selector): Add lock_ and initialize_lock_ fields.
13825         Don't define instantiate_target, just declare it.
13826         * target-select.cc (Target_selector::Target_selector): Initialize
13827         new fields.
13828         (Target_selector::instantiate_target): Define.
13829         * descriptors.h: Include "gold-threads.h".
13830         (class Descriptors): Add initialize_lock_ field.
13831         * descriptors.cc (Descriptors::Descriptors): Initialize new
13832         field.
13833         (Descriptors::open): Use initialize_lock_ field
13834         * errors.h (class Errors): Add initialize_lock_ field.
13835         * errors.cc (Errors::Errors): Initialize new field.
13836         (Errors::initialize_lock): Use initialize_lock_ field.
13837         * powerpc.cc (class Target_selector_powerpc): Remove
13838         instantiated_target_ field.  In do_recognize call
13839         instantiate_target rather than do_instantiate_target.  In
13840         do_instantiate_target just allocate a new target.
13841         * sparc.cc (class Target_selector_sparc): Likewise.
13842
13843         * freebsd.h: New file.
13844         * i386.cc: Include "freebsd.h".
13845         (Target_i386): Derive from Target_freebsd rather than
13846         Sized_target.
13847         (Target_selector_i386): Derive from Target_selector_freebsd rather
13848         than Target_selector.
13849         * x86_64.cc: Include "freebsd.h".
13850         (Target_x86_64): Derive from Target_freebsd rather than
13851         Sized_target.
13852         (Target_selector_x86_64): Derive from Target_selector_freebsd
13853         rather than Target_selector.
13854         * target.h (class Target): Add adjust_elf_header and
13855         do_adjust_elf_header.
13856         * output.cc (Output_file_header:: do_sized_write): Call target
13857         adjust_elf_header routine.
13858         * configure.tgt: Set targ_osabi.
13859         * configure.ac: Define GOLD_DEFAULT_OSABI.
13860         * parameters.cc (Parameters::default_target): Pass
13861         GOLD_DEFAULT_OSABI to select_target.
13862         * target-select.h (class Target_selector): Make instantiate_target
13863         protected rather than private.
13864         * Makefile.am (HFILES): Add freebsd.h.
13865         * configure, Makefile.in, config.in: Rebuild.
13866
13867         * merge.cc (do_add_input_section): Correct pend value.  Change
13868         message about last entry not being null terminated from error to
13869         warning.
13870
13871 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13872
13873         * incremental.cc: New file.
13874         * Makefile.am (CCFILES): Add incremental.cc.
13875         * Makefile.in: Rebuild.
13876
13877 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13878
13879         * layout.cc (Layout::output_section_name): Preserve names
13880         of '.note.' sections.
13881
13882 2009-03-19  Ian Lance Taylor  <iant@google.com>
13883
13884         * descriptors.cc (Descriptors::open): Check that the options are
13885         valid before using them.
13886
13887 2009-03-18  Ian Lance Taylor  <iant@google.com>
13888
13889         * script-sections.h: Include <list>.
13890         (class Script_sections): Change Sections_elements from std::vector
13891         to std::list.  Typedef public Elements_iterator.  Add
13892         orphan_section_placement_, data_segment_align_start_, and
13893         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13894         field.
13895         * script-sections.cc (class Orphan_section_placement): New class.
13896         (class Sections_element): Add virtual functions is_relro and
13897         orphan_section_init.  Remove virtual function place_orphan_here.
13898         (class Output_section_definition): Add is_relro and
13899         orphan_section_init.  Remove place_orphan_here.
13900         (class Orphan_output_section): Likewise.
13901         (Script_sections::Script_sections): Update for field changes.
13902         (Script_sections::data_segment_align): Set saw_data_segment_align_
13903         and data_segment_align_start_, not data_segment_align_index.
13904         (Script_sections::data_segment_relro_end): Check
13905         saw_data_segment_align_.  Use data_segment_align_start_ rather
13906         than data_segment_align_index_.
13907         (Script_sections::place_orphan): Rewrite to use
13908         Orphan_section_placement.
13909
13910 2009-03-17  Ian Lance Taylor  <iant@google.com>
13911
13912         * archive.cc (Archive::add_symbols): Check for a version attached
13913         to the symbol name in the archive map.
13914         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13915         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13916         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13917         (ver_test_11.a): New target.
13918         * testsuite/Makefile.in: Rebuild.
13919
13920         * configure.ac: Check for chsize and posix_fallocate.  Replace
13921         ftruncate.
13922         * ftruncate.c: New file, from gnulib.
13923         * output.cc (posix_fallocate): Define dummy version if not
13924         HAVE_POSIX_FALLOCATE.
13925         (Output_file::map): Call posix_fallocate rather than lseek and
13926         write.
13927         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13928         * configure, Makefile.in, config.in: Rebuild.
13929
13930 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13931
13932         * layout.h (Layout::create_note): Add section_name parameter.
13933         * layout.cc (Layout::create_note): Likewise.
13934         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13935
13936 2009-03-17  Ian Lance Taylor  <iant@google.com>
13937
13938         * descriptors.cc: Include "options.h".
13939         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13940         (Descriptors::open): Always use O_CLOEXEC when opening a new
13941         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13942         then set FD_CLOEXEC.
13943
13944         * sparc.cc (class Target_sparc): Add has_got_section.
13945         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13946         make sure we have a GOT section.
13947
13948         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13949         (Target_sparc::Scan::local): Likewise.
13950         (Target_sparc::Scan::global): Likewise.
13951         (Target_sparc::Relocate::relocate): Likewise.
13952         (Target_sparc::Relocate::relocate_tls): Likewise.
13953
13954         * symtab.cc (Symbol_table::define_default_version): New function,
13955         broken out of add_from_object.
13956         (Symbol_table::add_from_object): Call define_default_version.
13957         (Symbol_table::define_special_symbol): Add resolve_oldsym
13958         parameter.  Change all callers.  If the version for a symbol comes
13959         from a version script, resolve it with the symbol with the same
13960         name with no version.  Also add the symbol without a version if
13961         appropriate.
13962         (do_define_in_output_data): If resolving with oldsym, don't delete
13963         sym.
13964         (do_define_in_output_segment): Likewise.
13965         (do_define_as_constant): Likewise.
13966         * symtab.h (class Symbol_table): Update declarations.
13967
13968 2009-03-13  Ian Lance Taylor  <iant@google.com>
13969
13970         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13971         (Read_symbols::requeue): New function.
13972         (Read_symbols::do_read_symbols): If make_elf_object fails because
13973         the target type is not configured, and the file was searched for,
13974         issue a warning and retry with the next directory.
13975         (Add_symbols::run): If the file has an incompatible format, and
13976         it was searched for, requeue the Read_symbols task.  On error,
13977         release the object.
13978         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13979         dirindex parameter to constructor.  Change all callers.  Declare
13980         incompatible_warning and requeue.
13981         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13982         input_argument_ and input_group_ fields.  Add them to
13983         constructor.  Change all callers.
13984         (class Read_script): Add dirindex_ field.  Add it to constructor.
13985         Change all callers.
13986         * archive.cc (Archive::setup): Remove input_objects parameter.
13987         Change all callers.
13988         (Archive::get_file_and_offset): Likewise.
13989         (Archive::read_all_symbols): Likewise.
13990         (Archive::read_symbols): Likewise.
13991         (Archive::get_elf_object_for_member): Remove input_objects
13992         parameter.  Add punconfigured parameter.  Change all callers.
13993         (Archive::add_symbols): Change return type to bool.  Check return
13994         value of include_member.
13995         (Archive::include_all_members): Likewise.
13996         (Archive::include_member): Change return type to bool.  Return
13997         false if first included object has incompatible target.  Set
13998         included_member_ field.
13999         (Add_archive_symbols::run): If add_symbols returns false, requeue
14000         Read_symbols task.
14001         * archive.h (class Archive): Add included_member_ field.
14002         Initialize it in constructor.  Add input_file and searched_for
14003         methods.  Update declarations.
14004         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14005         input_argument_ fields.  Add them to constructor.  Change all
14006         callers.
14007         * script.cc: Include "target-select.h".
14008         (class Parser_closure): Add skip_on_incompatible_target_ and
14009         found_incompatible_target_ fields.  Add
14010         skip_on_incompatible_target parameter to constructor.  Change all
14011         callers.  Add methods skip_on_incompatible_target,
14012         clear_skip_on_incompatible_target, found_incompatible_target, and
14013         set_found_incompatible_target.
14014         (read_input_script): Add dirindex parameter.  Change all callers.
14015         If parser finds an incompatible target, requeue Read_symbols
14016         task.
14017         (script_set_symbol): Clear skip_on_incompatible_target in
14018         closure.
14019         (script_add_assertion, script_parse_option): Likewise.
14020         (script_start_sections, script_add_phdr): Likewise.
14021         (script_check_output_format): New function.
14022         * script.h (read_input_script): Update declaration.
14023         * script-c.h (script_check_output_format): Declare.
14024         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14025         (ignore_cmd): Remove OUTPUT_FORMAT.
14026         * fileread.cc (Input_file::Input_file): Add explicit this.
14027         (Input_file::will_search_for): New function.
14028         (Input_file::open): Add pindex parameter.  Change all callers.
14029         * fileread.h (class Input_file): Add input_file_argument method.
14030         Declare will_search_for.  Update declarations.
14031         * object.cc (make_elf_object): Add punconfigured parameter.
14032         Change all callers.
14033         * object.h (class Object): Make input_file public.  Add
14034         searched_for method.
14035         (make_elf_object): Update declaration.
14036         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14037         restart search.
14038         * dirsearch.h (class Dirsearch): Update declaration.
14039         * options.h (class General_options): Add --warn-search-mismatch.
14040         * parameters.cc (Parameters::is_compatible_target): New function.
14041         * parameters.h (class Parameters): Declare is_compatible_target.
14042         * workqueue.cc (Workqueue::add_blocker): New function.
14043         * workqueue.h (class Workqueue): Declare add_blocker.
14044
14045         * fileread.cc (Input_file::open): Remove options parameter.
14046         Change all callers.
14047         (Input_file::open_binary): Likewise.
14048         * script.cc (read_input_script): Likewise.
14049         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14050         options parameter from constructor.  Change all callers.
14051         (class Read_script): Likewise.
14052         * fileread.h (class Input_file): Update declarations.
14053         * script.h (read_input_script): Update declaration.
14054
14055 2009-03-10  Nick Clifton  <nickc@redhat.com>
14056
14057         * po/es.po: New Spanish translation.
14058
14059 2009-03-06  Cary Coutant  <ccoutant@google.com>
14060
14061         * options.cc (parse_short_option): Keep dash_z from registering itself.
14062
14063 2009-03-03  Ian Lance Taylor  <iant@google.com>
14064
14065         PR 9918
14066         * target-reloc.h (relocate_section): Pass output_section to
14067         relocate.
14068         * i386.cc (Target_i386::should_apply_static_reloc): Add
14069         output_section parameter.  Change all callers.
14070         (Target_i386::Relocate::relocate): Add output_section parameter.
14071         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14072         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14073         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14074         * testsuite/two_file_shared.sh: New script.
14075         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14076         (check_DATA): Add two_file_shared.dbg.
14077         (two_file_shared.dbg): New target.
14078         * testsuite/Makefile.in: Rebuild.
14079
14080 2009-03-01  Ian Lance Taylor  <iant@google.com>
14081
14082         * configure.ac: Check for byteswap.h.
14083         * configure: Rebuild.
14084         * config.in: Rebuild.
14085
14086 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14087
14088         * layout.cc (Layout::find_or_add_kept_section): New function.
14089         (Layout::add_comdat): Removed.
14090         * layout.h (struct Kept_section): Move out of class Layout.
14091         Remove trailing underscores from field names.  Add group_sections
14092         field.  Rename group_ field to is_group.  Change all uses.
14093         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14094         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14095         comdat_groups_ field.
14096         (Sized_relobj::include_section_group): Use
14097         find_or_add_kept_section and Kept_section::group_sections.
14098         (Sized_relobj::include_linkonce_section): Likewise.
14099         * object.cc (class Sized_relobj): Don't define Comdat_group or
14100         Comdat_group_table.  Remove find_comdat_group and
14101         add_comdat_group.  Remove comdat_groups_ field.
14102         * plugin.cc (include_comdat_group): Use
14103         Layout::find_or_add_kept_section.
14104
14105 2009-02-28  Ian Lance Taylor  <iant@google.com>
14106
14107         * README: --gc-sections and map files are now supported.  Document
14108         some build requirements.
14109
14110         PR 6992
14111         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14112         relocatable link set the value of the section symbol to zero.
14113         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14114         relocatable link don't include the section address in the local
14115         symbol value.
14116
14117 2009-02-27  Ian Lance Taylor  <iant@google.com>
14118
14119         PR 6811
14120         * options.h (class Search_directory): Add is_system_directory.
14121         (class General_options): Declare is_in_system_directory.
14122         * options.cc (get_relative_sysroot): Make static.
14123         (get_default_sysroot): Make static.
14124         (General_optoins::is_in_system_directory): New function.
14125         * fileread.cc (Input_file::is_in_system_directory): New function.
14126         * fileread.h (class Input_file): Declare is_in_system_directory.
14127         * object.h (class Object): Add is_in_system_directory.
14128         (class Input_objects): Remove system_library_directory_ field.
14129         * object.cc (Input_objects::add_object): Don't set
14130         system_library_directory_.
14131         (input_objects::found_in_system_library_directory): Remove.
14132         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14133         parameter.  Change all callers.
14134         (Symbol_table::sized_write_globals): Likewise.
14135         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14136         Call Object::is_in_system_directory.
14137         * symtab.h (class Symbol_table): Update declarations.
14138
14139         PR 5990
14140         * descriptors.h (Open_descriptor): Add is_on_stack field.
14141         * descriptors.cc (Descriptors::open): If the descriptor is on the
14142         top of the stack, remove it.  Initialize is_on_stack field.
14143         (Descriptors::release): Only add pod to stack if it is not on the
14144         stack already.
14145         (Descriptors::close_some_descriptor): Clear stack_next and
14146         is_on_stack fields.
14147
14148         PR 7091
14149         * output.cc (Output_section::find_starting_output_address): Rename
14150         from starting_output_address; add PADDR parameter; change return
14151         type.
14152         * output.h (class Output_section): Declare
14153         find_starting_output_address instead of starting_output_address.
14154         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14155         section symbol for which we can't find a merge section.
14156
14157         PR 9836
14158         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14159         hidden or internal, force the symbol to be local.
14160         * resolve.cc (Symbol::override_visibility): Define.
14161         (Symbol::override_base): Use override_visibility.
14162         (Symbol_table::resolve): Likewise.
14163         (Symbol::override_base_with_special): Likewise.
14164         (Symbol_table::override_with_special): If the visibility is hidden
14165         or internal, force the symbol to be local.
14166         * symtab.h (class Symbol): Add set_visibility and
14167         override_visibility.
14168         * testsuite/ver_test_1.sh: New file.
14169         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14170         (check_DATA): Add ver_test_1.syms.
14171         (ver_test_1.syms): New target.
14172         * testsuite/Makefile.in: Rebuild.
14173
14174 2009-02-25  Cary Coutant  <ccoutant@google.com>
14175
14176         * layout.cc (Layout::choose_output_section): Don't rename sections
14177         when using a linker script that has a SECTIONS clause.
14178         * Makefile.in: Regenerate.
14179
14180         * testsuite/Makefile.am (script_test_5.sh): New test case.
14181         * testsuite/Makefile.in: Regenerate.
14182         * testsuite/script_test_5.cc: New file.
14183         * testsuite/script_test_5.sh: New file.
14184         * testsuite/script_test_5.t: New file.
14185
14186 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14187
14188         * archive.cc (Archive::include_member): Update calls to add_symbols.
14189         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14190         the Layout argument.
14191         * dynobj.h (do_add_symbols): Add the Layout argument.
14192         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14193         Layout argument.
14194         * object.h (Object::add_symbols): Add the Layout argument.
14195         (Object::do_add_symbols): Add the Layout argument.
14196         (Sized_relobj::do_add_symbols): Add the Layout argument.
14197         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14198         Unify the two versions.
14199         (Add_plugin_symbols): Remove.
14200         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14201         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14202         (Add_plugin_symbols): Remove.
14203         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14204         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14205         (Add_symbols::run): Make it work with Pulginobj.
14206
14207 2009-02-06  Ian Lance Taylor  <iant@google.com>
14208
14209         * object.cc (Sized_relobj::do_layout): Make info message start
14210         with lower case letter.
14211
14212 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14213
14214         * binary.cc: Fix file comment.
14215
14216         * options.h (enum Incremental_disposition): Define.
14217         (class General_options): Add new options: --incremental,
14218         --incremental_changed, --incremental_unchanged,
14219         --incremental_unknown.  Add incremental_disposition_ and
14220         implicit_incremental_ fields.
14221         (General_options::incremental_disposition): New function.
14222         (class Position_dependent_options): Add incremental_disposition
14223         option.
14224         (Position_dependent_options::copy_from_options): Set incremental
14225         dispositions.
14226         * options.cc (General_options::parse_incremental_changed): New
14227         function.
14228         (General_options::parse_incremental_unchanged): New function.
14229         (General_options::parse_incremental_unknown): New function.
14230         (General_options::General_options): Initialize new fields
14231         incremental_disposition_ and implicit_incremental_.
14232         (General_options::finalize): Check for uasge of --incremental-*
14233         without --incremental.
14234
14235 2009-02-06  Chris Demetriou  <cgd@google.com>
14236
14237         * gold.h (gold_undefined_symbol): Change to take only a Symbol
14238         pointer and to report location as the file name associated with
14239         the symbol.
14240         (gold_undefined_symbol_at_location): New function to replace the
14241         old gold_undefined_symbol functionality.
14242         * target-reloc.h (relocate_section): Update to use
14243         gold_undefined_symbol_at_location.
14244         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14245         Call gold_undefined_symbol function rather than gold_error.
14246         * errors.h (Errors::undefined_symbol): Take location as a
14247         string, rather than calculating it from a relocation.
14248         * errors.cc (Errors::fatal): Print "fatal error:" before the
14249         formatted message.
14250         (Errors::error, Errors::error_at_location): Print "error: "
14251         before the formatted message.
14252         (Errors::undefined_symbol): Take location as a string, rather
14253         than calculating it from a relocation.
14254         (gold_undefined_symbol_at_location): New function akin to
14255         old gold_undefined_symbol, calculates location from relocation.
14256         (gold_undefined_symbol): Change to take only a Symbol pointer
14257         and to report location as the file name associated with the symbol.
14258         * testsuite/debug_msg.sh: Update for changed error messages.
14259         * testsuite/undef_symbol.sh: Likewise.
14260
14261 2009-02-04  Duncan Sands  <baldrick@free.fr>
14262
14263         PR 9812
14264         * reduced_debug_output.h
14265         (Output_reduced_debug_abbrev_section::failed): Use format for
14266         gold_warning.
14267         (Output_reduced_debug_info_section::faild): Likewise.
14268
14269 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
14270
14271         * script.cc (Lazy_demangler): New class.
14272         (Version_script_info::get_symbol_version_helper): Demangle a
14273         symbol only once.
14274
14275 2009-01-29  Cary Coutant  <ccoutant@google.com>
14276
14277         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14278         to __tls_get_addr.
14279         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14280
14281 2009-01-28  Ian Lance Taylor  <iant@google.com>
14282
14283         * version.cc (version_string): Bump to 1.9.
14284
14285         * gold.h: Include <cstring> and <stdint.h>.
14286         * version.cc: Include <cstdio>.
14287         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14288         warning.
14289         * reduced_debug_output.cc (insert_into_vector): Rename from
14290         Insert_into_vector; change all callers.  Use Swap_unaligned to
14291         avoid aliasing issue; remove union since it is unnecessary.
14292
14293 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
14294
14295         * Makefile.am (CCFILES): Add gc.cc.
14296         (HFILES): Add gc.h.
14297         * Makefile.in: Regenerate.
14298         * gold.cc (Gc_runner): New class.
14299         (queue_initial_tasks): Call garbage collection related tasks
14300         when corresponding options are invoked.
14301         (queue_middle_gc_tasks): New function.
14302         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14303         processed early before laying out sections during garbage collection.
14304         * gold.h (queue_middle_gc_tasks): New function.
14305         (is_prefix_of): Move from "layout.cc".
14306         * i386.cc (Target_i386::gc_process_relocs): New function.
14307         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14308         * main.cc (main): Create object of class "Garbage_collection".
14309         * object.cc (Relobj::copy_symbols_data): New function.
14310         (Relobj::is_section_name_included): New function.
14311         (Sized_relobj::do_layout): Allow this function to be called twice
14312         during garbage collection and defer layout of section during the
14313         first call.
14314         * object.h (Relobj::get_symbols_data): New function.
14315         (Relobj::is_section_name_included): New function.
14316         (Relobj::copy_symbols_data): New function.
14317         (Relobj::set_symbols_data): New function.
14318         (Relobj::get_relocs_data): New function.
14319         (Relobj::set_relocs_data): New function.
14320         (Relobj::is_output_section_offset_invalid): New pure virtual function.
14321         (Relobj::gc_process_relocs): New function.
14322         (Relobj::do_gc_process_relocs): New pure virtual function.
14323         (Relobj::sd_): New data member.
14324         (Sized_relobj::is_output_section_offset_invalid): New function.
14325         (Sized_relobj::do_gc_process_relocs): New function.
14326         * options.h (General_options::gc_sections): Modify to not be a no-op.
14327         (General_options::print_gc_sections): New option.
14328         * plugin.cc (Plugin_finish::run): Remove function call to
14329         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
14330         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14331         * reloc.cc (Read_relocs::run): Add task to process relocs and
14332         determine unreferenced sections when doing garbage collection.
14333         (Gc_process_relocs): New class.
14334         (Sized_relobj::do_gc_process_relocs): New function.
14335         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14336         sections that are garbage collected.
14337         * reloc.h (Gc_process_relocs): New class.
14338         * sparc.cc (Target_sparc::gc_process_relocs): New function.
14339         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14340         symbols whose corresponding sections are garbage collected.
14341         (Symbol_table::Symbol_table): Add new parameter for the garbage
14342         collection object.
14343         (Symbol_table::gc_mark_undef_symbols): New function.
14344         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14345         (Symbol_table::gc_mark_dyn_syms): New function.
14346         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14347         as garbage.
14348         (Symbol_table::add_from_object): Likewise.
14349         (Symbol_table::add_from_relobj): When building shared objects, do not
14350         treat externally visible symbols as garbage.
14351         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14352         table information for static and relocatable links.
14353         * symtab.h (Symbol_table::set_gc): New function.
14354         (Symbol_table::gc): New function.
14355         (Symbol_table::gc_mark_undef_symbols): New function.
14356         (Symbol_table::gc_mark_symbol_for_shlib): New function.
14357         (Symbol_table::gc_mark_dyn_syms): New function.
14358         (Symbol_table::gc_): New data member.
14359         * target.h (Sized_target::gc_process_relocs): New pure virtual
14360         function.
14361         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14362         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14363
14364 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
14365
14366         * options.h (General_options::gc_sections): Define as a no-op for now.
14367         (General_options::no_keep_memory): Ditto.
14368         (General_options::Bshareable): Define.
14369         * options.cc (General_options::finalize): Honor -Bshareable.
14370
14371 2009-01-20  Andreas Schwab  <schwab@suse.de>
14372
14373         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14374         read the value in the contents, since we don't use it.  Use the
14375         template endianness when writing.
14376         (Relocate::relocate): Use it for R_PPC_REL16_HA.
14377
14378 2009-01-19  Andreas Schwab  <schwab@suse.de>
14379
14380         * configure.tgt (powerpc64-*): Fix targ_obj.
14381
14382 2009-01-15  Ian Lance Taylor  <iant@google.com>
14383
14384         * object.cc (Sized_relobj::write_local_symbols): Don't write out
14385         local symbols when stripping all symbols.
14386
14387 2009-01-14  Cary Coutant  <ccoutant@google.com>
14388
14389         * output.cc (Output_reloc): Add explicit instantiations.
14390
14391 2009-01-14  Cary Coutant  <ccoutant@google.com>
14392
14393         * archive.cc (Archive::get_elf_object_for_member): Remove call
14394         to File_read::claim_for_plugin.
14395         * descriptors.cc (Descriptors::open): Remove reference to
14396         is_claimed.
14397         (Descriptors::claim_for_plugin): Remove.
14398         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14399         (Descriptors::is_claimed): Remove.
14400         (claim_descriptor_for_plugin): Remove.
14401         * fileread.cc (File_read::claim_for_plugin): Remove.
14402         * fileread.h (File_read::claim_for_plugin): Remove.
14403         (File_read::descriptor): Reopen descriptor if necessary.
14404         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14405         (Plugin_manager::all_symbols_read): Add task parameter. Change
14406         all callers.
14407         (Plugin_manager::get_input_file): New function.
14408         (Plugin_manager::release_input_file): New function.
14409         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14410         corresponding data member.
14411         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14412         and pass to base constructor. Change all callers.
14413         (get_input_file, release_input_file): New functions.
14414         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14415         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14416         (Plugin_manager::all_symbols_read): Add task parameter.
14417         (Plugin_manager::get_input_file): New function.
14418         (Plugin_manager::release_input_file): New function.
14419         (Plugin_manager::task_): New data member.
14420         (Pluginobj::Pluginobj): Add filesize parameter.
14421         (Pluginobj::filename): New function.
14422         (Pluginobj::descriptor): New function.
14423         (Pluginobj::filesize): New function.
14424         (Pluginobj::filesize_): New data member.
14425         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14426         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14427         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14428
14429         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14430         with archive libraries.
14431         * testsuite/Makefile.in: Regenerate.
14432         * testsuite/plugin_test.c (struct sym_info): New type.
14433         (get_input_file, release_input_file): New static variables.
14434         (onload): Capture new transfer vector entries.
14435         (claim_file_hook): Stop reading at end of file according to filesize.
14436         Factor out parsing of readelf output into separate function.
14437         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14438         APIs and get the source file name from the symbol table.  Convert
14439         source file name to corresponding object file name.  Print info
14440         message when adding new input files.
14441         (parse_readelf_line): New function.
14442         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14443         * testsuite/plugin_test_2.sh: Likewise.
14444         * testsuite/plugin_test_3.sh: Likewise.
14445         * testsuite/plugin_test_4.sh: New test case.
14446
14447 2009-01-07  Ian Lance Taylor  <iant@google.com>
14448
14449         * version.cc (version_string): Bump to 1.8.
14450
14451 2008-12-23  Cary Coutant  <ccoutant@google.com>
14452
14453         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14454         * plugin.cc (Plugin_manager::finish): Rename as
14455         layout_deferred_objects.  Move cleanup to separate function.
14456         (Plugin_manager::cleanup): New function.
14457         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14458         separately.
14459         * plugin.h (Plugin_manager::finish): Rename as
14460         layout_deferred_objects.
14461         (Plugin_manager::cleanup): New function.
14462         (Plugin_manager::cleanup_done): New field.
14463
14464 2008-12-23  Cary Coutant  <ccoutant@google.com>
14465
14466         * plugin.cc (is_visible_from_outside): New function.
14467         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14468         so we don't return "IR only" status for exported symbols or -r links.
14469
14470         * testsuite/Makefile.am (plugin_test_3): New test case.
14471         * testsuite/Makefile.in: Regenerate.
14472         * testsuite/plugin_test_3.sh: New file.
14473
14474 2008-12-22  Cary Coutant  <ccoutant@google.com>
14475
14476         * object.cc (Sized_relobj::layout_section): New function.
14477         (Sized_relobj::do_layout): Defer layout of input sections until after
14478         plugin has provided replacement files.
14479         (Sized_relobj::do_layout_deferred_sections): New function.
14480         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14481         (Relobj::layout_deferred_sections): New function.
14482         (Relobj::do_layout_deferred_sections): New function.
14483         (Sized_relobj::do_layout_deferred_sections): New function.
14484         (Sized_relobj::layout_section): New function.
14485         (Sized_relobj::Deferred_layout): New structure.
14486         (Sized_relobj::deferred_layout_): New field.
14487         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14488         Change all callers.  Layout deferred sections.
14489         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14490         references.
14491         (Plugin_hook::run): Move code from do_plugin_hook inline.
14492         (Plugin_hook::do_plugin_hook): Remove.
14493         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14494         (Plugin_manager::finish): Renamed, was cleanup.
14495         (Plugin_manager::should_defer_layout): New function.
14496         (Plugin_manager::add_deferred_layout_object): New function.
14497         (Plugin_manager::Deferred_layout_list): New type.
14498         (Plugin_manager::deferred_layout_objects_): New field.
14499         (Plugin_hook::do_plugin_hook): Remove.
14500
14501 2008-12-17  Ian Lance Taylor  <iant@google.com>
14502
14503         * options.h (class General_options): Add --no case for
14504         --export-dynamic.
14505
14506 2008-12-16  Cary Coutant  <ccoutant@google.com>
14507
14508         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14509         vector.
14510         (Plugin_manager::claim_file): Create plugin object even if
14511         plugin did not call the add_symbols callback.
14512         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14513         asking for more symbols than were added.
14514         * testsuite/Makefile.am (plugin_test_1): Add test case with
14515         no global symbols.
14516         (empty.syms): New target.
14517         * testsuite/Makefile.in: Regenerate.
14518         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14519         message. Don't call add_symbols if no globals.
14520         (all_symbols_read_hook): Don't provide replacement for empty
14521         claimed file.
14522
14523 2008-12-12  Ian Lance Taylor  <iant@google.com>
14524
14525         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14526         r_type == 0 for a local symbol with r_sym == 0.
14527         (scan_relocatable_relocs): Pass r_sym to
14528         local_non_section_strategy.
14529         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14530         r_sym parameter.
14531
14532         * configure.ac: Update test for TLS descriptors: they are
14533         supported as of glibc 2.9.
14534         * configure: Rebuild.
14535
14536 2008-12-11  Ian Lance Taylor  <iant@google.com>
14537
14538         PR 7091
14539         * target-reloc.h (Default_scan_relocatable_relocs): For each
14540         function, map r_type == 0 to RELOC_DISCARD.
14541
14542 2008-12-10  Cary Coutant  <ccoutant@google.com>
14543
14544         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14545         object to override a kept COMDAT group from a plugin object.
14546
14547 2008-12-09  Ian Lance Taylor  <iant@google.com>
14548
14549         PR 7088
14550         * yyscript.y (file_cmd): Handle INPUT.
14551
14552         * testsuite/initpri1.c: Change all declarations to be full
14553         prototypes by adding void, to avoid compiler warnings.
14554
14555 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14556
14557         * options.cc (General_options::parse_plugin_opt): New.
14558         (General_options::add_plugin): The argument now is just the filename.
14559         (General_options::add_plugin_option): New.
14560         * options.h (plugin_opt): New.
14561         (add_plugin): Change argument name.
14562         (add_plugin_option): New.
14563         * plugin.cc (Plugin::load): Don't parse the plugin option.
14564         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14565         (Plugin::add_option): New.
14566         (Plugin::args_): Change type.
14567         (Plugin::filename_): New.
14568         (Plugin_manager::add_plugin_option): New.
14569         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14570         * testsuite/Makefile.in: Regenerate.
14571
14572 2008-12-05  Cary Coutant  <ccoutant@google.com>
14573
14574         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14575         Handle --strip-lto-sections option.
14576         * options.h (strip_lto_sections): New option.
14577
14578 2008-12-01  Cary Coutant  <ccoutant@google.com>
14579
14580         * plugin.cc (ld_plugin_message): Change format parameter to const.
14581         Fix mismatch between new[] and delete.
14582
14583 2008-11-14  Cary Coutant  <ccoutant@google.com>
14584
14585         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14586         instead of -1U.
14587
14588 2008-11-05  Craig Silverstein  <csilvers@google.com>
14589
14590         * options.cc (General_options::parse_dynamic_list): New function.
14591         * options.h (General_options): New flags dynamic_list,
14592         dynamic_list_data, dynamic_list_cpp_new, and
14593         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14594         (General_options::in_dynamic_list): New function.
14595         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14596         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14597         (Lex::can_continue_name): Likewise.
14598         (yylex): Likewise.
14599         (read_script_file): New parameter script_options.
14600         (read_dynamic_list): New function.
14601         (Script_options::define_dynamic_list): New function.
14602         (dynamic_list_keyword_parsecodes): New variable.
14603         (dynamic_list_keywords): New variable.
14604         * script.h (Script_options::define_dynamic_list): New function
14605         prototype.
14606         (read_dynamic_list): New function prototype.
14607         * symtab.cc (strprefix): New macro.
14608         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14609         dynamic_list_data, dynamic_list_cpp_new, and
14610         dynamic_list_cpp_typeinfo.
14611         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14612         (dynamic_list_expr): New rule.
14613         (dynamic_list_nodes): Likewise.
14614         (dynamic_list_node): Likewise.
14615         * testsuite/Makefile.am (dynamic_list): New test.
14616         * testsuite/Makefile.in: Regenerated.
14617         * testsuite/dynamic_list.t: New file.
14618         * testsuite/dynamic_list.sh: New file.
14619
14620 2008-11-05  Craig Silverstein  <csilvers@google.com>
14621
14622         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14623         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14624         (t11_last): Likewise.
14625         * testsuite/ver_test_6.c (main): Likewise.
14626
14627 2008-10-07  Cary Coutant  <ccoutant@google.com>
14628
14629         * options.c (General_options::finalize): Add check for -static and
14630         -shared.
14631         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14632         is not empty.
14633
14634 2008-10-02  Cary Coutant  <ccoutant@google.com>
14635
14636         * plugin.cc (make_sized_plugin_object): Fix conditional
14637         compilation to work when not all targets are enabled.
14638
14639 2008-09-29  Cary Coutant  <ccoutant@google.com>
14640
14641         * archive.cc (Archive::get_file_and_offset): Use filename instead
14642         of name to get library path.
14643         (Archive::include_member): Unlock external member of a thin archive.
14644
14645         * testsuite/Makefile.am (TEST_AR): New variable.
14646         (thin_archive_test_1): New test.
14647         (thin_archive_test_2): New test.
14648         * testsuite/Makefile.in: Regenerate.
14649         * testsuite/thin_archive_main.cc: New file.
14650         * testsuite/thin_archive_test_1.cc: New file.
14651         * testsuite/thin_archive_test_2.cc: New file.
14652         * testsuite/thin_archive_test_3.cc: New file.
14653         * testsuite/thin_archive_test_4.cc: New file.
14654
14655 2008-09-29  Cary Coutant  <ccoutant@google.com>
14656
14657         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14658         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14659         instead of -1U.
14660         (Sized_relobj::do_finalize_local_symbols): Likewise.
14661         (Sized_relobj::map_to_kept_section): Likewise.
14662         * object.h (Sized_relobj::invalid_address): New constant.
14663         (Sized_relobj::do_output_section_offset): Check for invalid_address
14664         and return -1ULL.
14665         * output.cc (Output_reloc::local_section_offset): Use constant
14666         invalid_address instead of -1U.
14667         (Output_reloc::get_address): Likewise.
14668         (Output_section::output_address): Change -1U to -1ULL.
14669         * output.h (Output_reloc::invalid_address): New constant.
14670         * reloc.cc (Sized_relobj::write_sections): Use constant
14671         invalid_address instead of -1U.
14672         (Sized_relobj::relocate_sections): Likewise.
14673         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14674         values for merge sections.
14675         * target-reloc.h (relocate_for_relocatable): Use constant
14676         invalid_address instead of -1U.
14677
14678 2008-09-19  Cary Coutant  <ccoutant@google.com>
14679
14680         Add plugin functionality for link-time optimization (LTO).
14681         * configure.ac (plugins): Add --enable-plugins option.
14682         * configure: Regenerate.
14683         * config.in: Regenerate.
14684         * Makefile.am (LIBDL): New variable.
14685         (CCFILES): Add plugin.cc.
14686         (HFILES): Add plugin.h.
14687         (ldadd_var): Add LIBDL.
14688         * Makefile.in: Regenerate.
14689
14690         * archive.cc: Include "plugin.h".
14691         (Archive::setup): Don't preread archive symbols when using a plugin.
14692         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14693         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14694         files.
14695         (Archive::include_member): Add symbols from plugin objects.
14696         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14697         * descriptors.cc (Descriptors::open): Check for file descriptors
14698         abandoned by plugins.
14699         (Descriptors::claim_for_plugin): New function.
14700         * descriptors.h (Descriptors::claim_for_plugin): New function.
14701         (Open_descriptor::is_claimed): New field.
14702         (claim_descriptor_for_plugin): New function.
14703         * fileread.cc (File_read::claim_for_plugin): New function.
14704         * fileread.h (File_read::claim_for_plugin): New function.
14705         (File_read::descriptor): New function.
14706         * gold.cc: Include "plugin.h".
14707         (queue_initial_tasks): Add task to call plugin hooks for generating
14708         new object files.
14709         * main.cc: Include "plugin.h".
14710         (main): Load plugin libraries.
14711         * object.h (Pluginobj): Declare.
14712         (Object::pluginobj): New function.
14713         (Object::do_pluginobj): New function.
14714         (Object::set_target): New function.
14715         * options.cc: Include "plugin.h".
14716         (General_options::parse_plugin): New function.
14717         (General_options::General_options): Initialize plugins_ field.
14718         (General_options::add_plugin): New function.
14719         * options.h (Plugin_manager): Declare.
14720         (General_options): Add --plugin option.
14721         (General_options::has_plugins): New function.
14722         (General_options::plugins): New function.
14723         (General_options::add_plugin): New function.
14724         (General_options::plugins_): New field.
14725         * plugin.cc: New file.
14726         * plugin.h: New file.
14727         * readsyms.cc: Include "plugin.h".
14728         (Read_symbols::do_read_symbols): Check for archive before checking
14729         for ELF file.  Call plugin hooks to claim files.
14730         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14731         from a real object file; force override when processing replacement
14732         files.
14733         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14734         (Symbol::init_base_object): Likewise.
14735         (Symbol::init_base_output_data): Likewise.
14736         (Symbol::init_base_output_segment): Likewise.
14737         (Symbol::init_base_constant): Likewise.
14738         (Symbol::init_base_undefined): Likewise.
14739         (Symbol::output_section): Assert that object is not a plugin.
14740         (Symbol_table::add_from_pluginobj): New function.
14741         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14742         undefined.
14743         (Symbol_table::sized_write_globals): Likewise.
14744         (Symbol_table::add_from_pluginobj): Instantiate template.
14745         * symtab.h (Sized_pluginobj): Declare.
14746         (Symbol::in_real_elf): New function.
14747         (Symbol::set_in_real_elf): New function.
14748         (Symbol::in_real_elf_): New field.
14749         (Symbol_table::add_from_pluginobj): New function.
14750
14751         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14752         (LIBDL): New variable.
14753         (LDADD): Add LIBDL.
14754         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14755         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14756         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14757         (MOSTLYCLEANFILES): Likewise.
14758         * testsuite/Makefile.in: Regenerate.
14759         * testsuite/plugin_test.c: New file.
14760         * testsuite/plugin_test_1.sh: New file.
14761         * testsuite/plugin_test_2.sh: New file.
14762
14763 2008-09-16  Ian Lance Taylor  <iant@google.com>
14764
14765         * target-reloc.h (relocate_section): Check whether a symbol is
14766         defined by the ABI before reporting an undefined symbol error.
14767         * target.h (Target::is_defined_by_abi): Make parameter const.
14768         (Target::do_is_defined_by_abi): Likewise.
14769         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14770         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14771         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14772         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14773         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14774         * testsuite/Makefile.in: Rebuild.
14775
14776         * fileread.cc (make_view): Add casts to avoid warning.
14777
14778 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14779
14780         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14781         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14782
14783 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14784
14785         * options.h (General_options::output_is_executable): New.
14786         (General_options::output_is_pie): New.
14787         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14788         for shared libraries.
14789         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14790
14791 2008-09-11  Chris Demetriou  <cgd@google.com>
14792
14793         * options.h (origin): New -z option.
14794         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14795         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14796         in DT_FLAGS_1.
14797
14798 2008-09-05  Cary Coutant  <ccoutant@google.com>
14799
14800         * fileread.cc (File_read::make_view): Add check for attempt to map
14801         beyond end of file.
14802
14803 2008-09-05  Cary Coutant  <ccoutant@google.com>
14804
14805         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14806         explicit instantiations.
14807
14808 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14809
14810         PR gold/6858
14811         * options.cc (General_options::finalize): Allow undefined symbols
14812         in shlibs if linking -shared.
14813
14814         PR gold/6859
14815         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14816         symbols as not needing a dynsym entry.
14817
14818 2008-08-20  Craig Silverstein  <csilvers@google.com>
14819
14820         * fileread.cc (File_read::open): Do not lock the file unless it
14821         was successfully opened.
14822
14823 2008-08-14  Cary Coutant  <ccoutant@google.com>
14824
14825         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14826         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14827         * testsuite/tls_test.cc (struct int128): 128-bit struct
14828         for testing TLS relocs with non-zero addend.
14829         (v12): New TLS variable.
14830         (t12): New test.
14831         (t_last): Add check for v12.
14832         * testsuite/tls_test.h (t12): New function.
14833         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14834
14835 2008-08-13  Ian Lance Taylor  <iant@google.com>
14836
14837         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14838         set tls_segment_ or relro_segment_.
14839         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14840         when appropriate.
14841         * output.h (Output_section::clear_is_relro): New function.
14842         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14843         sections specially even when output_data_ is empty.
14844         (Output_segment::maximum_alignment): When first section is relro,
14845         only force alignment for PT_LOAD segments.
14846         * script.cc (script_data_segment_align): New function.
14847         (script_data_segment_relro_end): New function.
14848         * script-c.h (script_data_segment_align): Declare.
14849         (script_data_segment_relro_end): Declare.
14850         * script-sections.h (class Script_sections): Declare
14851         data_segment_align and data_segment_relro_end.  Add fields
14852         segment_align_index_ and saw_relro_end_.
14853         * script-sections.cc (class Sections_element): Add set_is_relro
14854         virtual function.  Add new bool* parameter to place_orphan_here.
14855         Add get_output_section virtual function.
14856         (class Output_section_definition): Add set_is_relro.  Add new
14857         bool* parameter to place_orphan_here.  Add get_output_section.
14858         Add is_relro_ field.
14859         (Output_section_definition::Output_section_definition): Initialize
14860         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14861         and is_relro_ fields.
14862         (Output_section_definition::place_orphan_here): Add is_relro
14863         parameter.
14864         (Output_section_definition::set_section_addresses): Set relro for
14865         output section.
14866         (Output_section_definition::alternate_constraint): Likewise.
14867         (class Orphan_output_section): Add new bool* parameter to
14868         place_orphan_here.  Add get_output_section.
14869         (Orphan_output_section::place_orphan_here): Add is_relro
14870         parameter.
14871         (Script_sections::Script_sections): Initialize
14872         data_segment_align_index_ and saw_relro_end_.
14873         (Script_sections::data_segment_align): New function.
14874         (Script_sections::data_segment_relro_end): New function.
14875         (Script_sections::place_orphan): Set or clear is_relro.
14876         (Script_sections::set_section_addresses): Force alignment of first
14877         TLS section.
14878         * yyscript.y (exp): Call script_data_segment_align and
14879         script_data_segment_relro_end.
14880         * testsuite/relro_script_test.t: New file.
14881         * testsuite/relro_test.cc (using_script): Declare.
14882         (t1, t2): Test using_script.
14883         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14884         (relro_script_test_SOURCES): Define.
14885         (relro_script_test_DEPENDENCIES): Define.
14886         (relro_script_test_LDFLAGS): Define.
14887         (relro_script_test_LDADD): Define.
14888         (relro_script_test.so): New target.
14889         * testsuite/Makefile.in: Rebuild.
14890
14891 2008-08-06  Cary Coutant <ccoutant@google.com>
14892
14893         * archive.cc (Archive::total_archives, Archive::total_members)
14894         (Archive::total_members_loaded): New variables.
14895         (Archive::setup): Add parameter.  Add option to preread
14896         archive symbols.
14897         (Archive::read_armap): Add counter.
14898         (Archive::get_file_and_offset): New function.
14899         (Archive::get_elf_object_for_member): New function.
14900         (Archive::read_all_symbols): New function.
14901         (Archive::read_symbols): New function.
14902         (Archive::add_symbols): Add counters.
14903         (Archive::include_all_members): Use armap to find members if it's
14904         already built.
14905         (Archive::include_member): Skip reading symbols if already read.
14906         Factored code into Archive::get_file_and_offset and
14907         Archive::get_elf_object_for_member.  Changed call to
14908         Mapfile::report_include_archive_member.
14909         (Archive::print_stats): New function.
14910         * archive.h: Declare Object and Read_symbols_data classes.
14911         (Archive::Archive): Add initializers for new members.
14912         (Archive::setup): Add parameter.
14913         (Archive::print_stats): New function.
14914         (Archive::total_archives, Archive::total_members)
14915         (Archive::total_members_loaded): New variables.
14916         (Archive::get_file_and_offset): New function.
14917         (Archive::get_elf_object_for_member): New function.
14918         (Archive::read_all_symbols): New function.
14919         (Archive::read_symbols): New function.
14920         (Archive::Archive_member): New class.
14921         (Archive::members_): New member.
14922         (Archive::num_members_): New member.
14923         * main.cc: Include archive.h.
14924         (main): Call Archive::print_stats.
14925         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14926         archive parameter; member_name is now the fully-decorated name.
14927         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14928         * options.h: (General_options): Add --preread-archive-symbols option.
14929         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14930         Archive::setup.
14931
14932 2008-08-04  Ian Lance Taylor  <iant@google.com>
14933
14934         * symtab.h (Symbol::use_plt_offset): New function.
14935         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14936         * powerpc.cc (Relocate::relocate): Likewise.
14937         * sparc.cc (Relocate::relocate): Likewise.
14938         * x86_64.cc (Relocate::relocate): Likewise.
14939         * testsuite/weak_plt.sh: New test.
14940         * testsuite/weak_plt_main.cc: New test.
14941         * testsuite/weak_plt_shared.cc: New test.
14942         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14943         (check_PROGRAMS): Add weak_plt.
14944         (check_DATA): Add weak_plt_shared.so.
14945         (weak_plt_main_pic.o, weak_plt): New targets.
14946         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14947         * testsuite/Makefile.in: Rebuild.
14948
14949         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14950         gcctestdir/ld.
14951         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14952         * testsuite/Makefile.in: Rebuild.
14953
14954 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14955
14956         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14957         * Makefile.in: Regenerate.
14958         * po/POTFILES.in: Regenerate.
14959
14960 2008-07-29  Ian Lance Taylor  <iant@google.com>
14961
14962         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14963         symbols before other symbols.
14964         * testsuite/script_test_2.cc (test_addr): Declare.
14965         (test_addr_alias): Declare.
14966         (main): Check that test_addr and test_addr_alias have the right
14967         values.
14968         * testsuite/script_test_2.t: Define test_addr_alias and
14969         test_addr.
14970
14971 2008-07-24  Ian Lance Taylor  <iant@google.com>
14972
14973         PR 5990
14974         * descriptors.cc: New file.
14975         * descriptors.h: New file.
14976         * gold-threads.h (class Hold_optional_lock): New class.
14977         * fileread.cc: Include "descriptors.h".
14978         (File_read::~File_read): Release descriptor rather than closing
14979         it.
14980         (File_read::open) [file]: Call open_descriptor rather than open.
14981         Set is_descriptor_opened_.
14982         (File_read::open) [memory]: Assert that descriptor is not open.
14983         (File_read::reopen_descriptor): New function.
14984         (File_read::release): Release descriptor.
14985         (File_read::do_read): Make non-const.  Reopen descriptor.
14986         (File_read::read): Make non-const.
14987         (File_read::make_view): Reopen descriptor.
14988         (File_read::do_readv): Likewise.
14989         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14990         Update declarations.
14991         * layout.cc: Include "descriptors.h".
14992         (Layout::create_build_id): Use open_descriptor rather than open.
14993         * output.cc: Include "descriptors.h".
14994         (Output_file::open): Use open_descriptor rather than open.
14995         * archive.cc (Archive::const_iterator): Change Archive to be
14996         non-const.
14997         (Archive::begin, Archive::end): Make non-const.
14998         (Archive::count_members): Likewise.
14999         * archive.h (class Archive): Update declarations.
15000         * object.h (Object::read): Make non-const.
15001         * Makefile.am (CCFILES): Add descriptors.cc.
15002         (HFILES): Add descriptors.h.
15003         * Makefile.in: Rebuild.
15004
15005         PR 6716
15006         * gold.h: Always include <clocale>.  Add Solaris workarounds
15007         following code in binutils/sysdep.h.
15008
15009         PR 6048
15010         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15011         this->eh_frame_hdr_ is NULL before using it.
15012
15013         * dynobj.cc (Versions::Versions): Update comment.
15014
15015         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15016         the base version name.
15017
15018         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15019         array size plus one.
15020         (Stringpool_template::set_string_offsets): Subtract one from key
15021         before using it as an array index.
15022         (Stringpool_template::get_offset_with_length): Likewise.
15023         (Stringpool_template::write_to_buffer): Likewise.
15024         * stringpool.h (Stringpool_template::get_offset_from_key):
15025         Likewise.
15026
15027 2008-07-23  Ian Lance Taylor  <iant@google.com>
15028
15029         PR 6658
15030         * object.h (Merged_symbol_value::value): Do our best to handle a
15031         negative addend.
15032
15033         PR 6647
15034         * script.cc (Version_script_info::get_versions): Don't add empty
15035         version tag to return value.
15036         (Version_script_info::get_symbol_version_helper): Change return
15037         type to bool.  Add pversion parameter.  Change all callers.
15038         (script_register_vers_node): Don't require a non-NULL tag.
15039         * script.h (class Version_script_info): Update declarations.
15040         (Version_script_info::get_symbol_version): Change return type to
15041         bool.  Add version parameter.  Change all callers.
15042         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15043         handling.  Handle an empty version from a version script.
15044         (Symbol_table::define_special_symbol): Likewise.
15045         * testsuite/ver_test_10.script: New file.
15046         * testsuite/ver_test_10.sh: New file.
15047         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15048         (check_DATA): Add ver_test_10.syms.
15049         (ver_test_10.syms, ver_test_10.so): New target.
15050         * testsuite/Makefile.in: Rebuild.
15051
15052 2008-07-23  Simon Baldwin  <simonb@google.com>
15053
15054         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15055         to zero for undefined symbols from dynamic libraries.
15056
15057 2008-07-23  Ian Lance Taylor  <iant@google.com>
15058
15059         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15060         Change all callers.
15061         * symtab.h (class Symbol_table): Update declaration.
15062         * testsuite/ver_test_9.cc: New file.
15063         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15064         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15065         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15066         (ver_test_9.so, ver_test_9.o): New targets.
15067         * testsuite/Makefile.in: Rebuild.
15068
15069 2008-07-22  Ian Lance Taylor  <iant@google.com>
15070
15071         * options.h (class General_options): Define --check-sections.
15072         * layout.cc (Layout::set_segment_offsets): Handle
15073         --check-sections.
15074
15075         * options.h (class General_options): Define -n/--nmagic and
15076         -N/--omagic.
15077         * options.cc (General_options::finalize): For -n/--nmagic or
15078         -N/--omagic, set -static.
15079         * layout.cc (Layout::attach_allocated_section_to_segment): If
15080         -N/--omagic, don't put read-only and read-write sections in
15081         different segments.
15082         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15083         finding a read-only segment.
15084         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15085         don't set the minimum segment alignment to the common page size,
15086         and don't set the file offset to the address modulo the page size.
15087         * script-sections.cc (Script_sections::create_segments): If
15088         -n/--omagic, don't put read-only and read-write sections in
15089         different segments.
15090
15091         * cref.cc: New file.
15092         * cref.h: New file.
15093         * options.h (class General_options): Add --print-symbol-counts.
15094         * main.cc (main): Issue defined symbol report if requested.
15095         * archive.cc (Archive::interpret_header): Make into a const member
15096         function.
15097         (Archive::add_symbols): Call Input_objects::archive_start and
15098         archive_stop.
15099         (Archive::const_iterator): Define new class.
15100         (Archive::begin, Archive::end): New functions.
15101         (Archive::include_all_members): Rewrite to use iterator.
15102         (Archive::count_members): New function.
15103         * archive.h (class Archive): Update declarations.
15104         (Archive::filename): New function.
15105         * object.cc: Include "cref.h".
15106         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15107         (Sized_relobj::do_get_global_symbol_counts): New function.
15108         (Input_objects::add_object): Add object to cross-referencer.
15109         (Input_objects::archive_start): New function.
15110         (Input_objects::archive_stop): New function.
15111         (Input_objects::print_symbol_counts): New function.
15112         * object.h: Declare Cref and Archive.
15113         (Object::get_global_symbol_counts): New function.
15114         (Object::do_get_global_symbol_counts): New pure virtual function.
15115         (class Sized_relobj): Add defined_count_ field.  Update
15116         declarations.
15117         (class Input_objects): Add cref_ field.  Update constructor.
15118         Update declarations.
15119         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15120         defined_count_.
15121         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15122         symbol counts.
15123         (Sized_dynobj::do_get_global_symbol_counts): New function.
15124         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15125         defined_count_.  Update declarations.  Define Symbols typedef.
15126         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15127         parameter.  Change all callers.
15128         (Symbol_table::add_from_dynobj): Add sympointers and defined
15129         parameters.  Change all callers.
15130         * symtab.h (class Symbol_table): Update declarations.
15131         * Makefile.am (CCFILES): Add cref.cc.
15132         (HFILES): Add cref.h.
15133         * Makefile.in: Rebuild.
15134
15135 2008-07-22  Simon Baldwin  <simonb@google.com>
15136
15137         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15138         to zero when writing undefined symbols.
15139
15140 2008-07-22  Ian Lance Taylor  <iant@google.com>
15141
15142         * output.cc (Output_section::add_input_section): Don't try to
15143         merge empty merge sections.
15144
15145 2008-07-21  Craig Silverstein  <csilvers@google.com>
15146
15147         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15148         Include symbol version in error message.
15149
15150 2008-07-20  Chris Demetriou  <cgd@google.com>
15151
15152         * configure.ac (gold_cv_c_random_seed): New configured variable.
15153         (RANDOM_SEED_CFLAGS): New substituted variable.
15154         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15155         * configure: Rebuild.
15156         * Makefile.in: Likewise.
15157         * testsuite/Makefile.in: Likewise.
15158
15159 2008-07-18  Ian Lance Taylor  <iant@google.com>
15160
15161         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15162         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15163         * testsuite/ver_test_main.cc (main): Call t4.
15164         (t4, t4_2a): Define.
15165         * testsuite/ver_test_2.cc (t4_2): Define.
15166         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15167         * testsuite/ver_test_4.cc (t4_2a): Define.
15168         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15169         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15170
15171 2008-07-17  Ian Lance Taylor  <iant@google.com>
15172
15173         * dynobj.cc (Versions::add_def): If we give an error about a
15174         missing version, go ahead and create the version anyhow.
15175
15176 2008-07-10  Ian Lance Taylor  <iant@google.com>
15177
15178         Handle output sections with more than 0x7fffffff bytes.
15179         * object.h (class Relobj): Change map_to_output_ to
15180         output_sections_, and just keep a section pointer.  Change all
15181         uses.  Move comdat group support to Sized_relobj.
15182         (Relobj::is_section_specially_mapped): Remove.
15183         (Relobj::output_section): Remove poff parameter.  Change all
15184         callers.
15185         (Relobj::output_section_offset): New function.
15186         (Relobj::set_section_offset): Rewrite.
15187         (Relobj::map_to_output): Remove.
15188         (Relobj::output_sections): New function.
15189         (Relobj::do_output_section_offset): New pure virtual function.
15190         (Relobj::do_set_section_offset): Likewise.
15191         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15192         group support from Relobj.  Update declarations.
15193         (Sized_relobj::get_output_section_offset): New function.
15194         (Sized_relobj::do_output_section_offset): New function.
15195         (Sized_relobj::do_set_section_offset): New function.
15196         * object.cc (Relobj::output_section_address): Remove.
15197         (Sized_relobj::Sized_relobj): Initialize new fields.
15198         (Sized_relobj::include_section_group): Cast find_kept_object to
15199         Sized_relobj.
15200         (Sized_relobj::include_linkonce_section): Likewise.
15201         (Sized_relobj::do_layout): Use separate arrays for output section
15202         and output offset.
15203         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15204         output_sections.
15205         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15206         output_sections and section_offsets.
15207         (Sized_relobj::write_local_symbols): Likewise.
15208         (map_to_kept_section): Compute output address directly.
15209         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15210         output_sections and section_offsets.
15211         (Sized_relobj::write_sections): Likewise.
15212         (Sized_relobj::relocate_sections): Likewise.
15213         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15214         * output.h (class Output_reloc): Update declarations.  Change
15215         u2_.relobj to Sized_relobj*.
15216         (class Output_data_reloc): Change add functions to use
15217         Sized_relobj*.
15218         * output.cc (Output_reloc::Output_reloc): Change relobj to
15219         Sized_relobj*.
15220         (Output_reloc::local_section_offset): Change return type to
15221         Elf_Addr.  Use get_output_section_offset.
15222         (Output_reloc::get_address): Likewise.
15223         (Output_section::is_input_address_mapped): Don't call
15224         is_section_specially_mapped.
15225         (Output_section::output_offset): Likewise.
15226         (Output_section::output_address): Likewise.
15227         (Output_section::starting_output_address): Likewise.
15228         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15229         parameter to Sized_relobj*.
15230         (Copy_relocs::need_copy_reloc): Likewise.
15231         (Copy_relocs::save): Likewise.
15232         * copy-relocs.h (class Copy_relocs): Update declarations.
15233         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15234         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
15235         * target-reloc.h (relocate_for_relocatable): Change
15236         offset_in_output_section type to Elf_Addr.  Change code that uses
15237         it as well.
15238         * layout.cc (Layout::layout): Always set *off.
15239         * mapfile.cc (Mapfile::print_input_section): Use
15240         output_section_offset.
15241         * i386.cc (Target_i386::copy_reloc): Change object parameter to
15242         Sized_relobj*.
15243         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15244         * sparc.cc (Target_sparc::copy_reloc): Likewise.
15245         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15246
15247 2008-07-03  Ian Lance Taylor  <iant@google.com>
15248
15249         * layout.cc (Layout::include_section): Do not discard unrecognized
15250         SHT_STRTAB sections.
15251
15252 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
15253
15254         * script.cc (Lex::can_continue_name): Make '?' allowable in
15255         version-script names.
15256         * testsuite/version_script.map: Change glob pattern to use '?'
15257
15258 2008-06-30  Manish Singh  <yosh@gimp.org>
15259
15260         PR 6585
15261         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15262         Correct typo.
15263
15264 2008-06-30  Ian Lance Taylor  <iant@google.com>
15265
15266         PR 6660
15267         PR 6682
15268         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15269         versions]: Don't try to read the value in the contents, since we
15270         don't use it.  Use the template endianness when writing.
15271
15272 2008-06-25  Cary Coutant  <ccoutant@google.com>
15273
15274         * fileread.cc (File_read::make_view): Assert on zero-length view.
15275         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15276         symbol table when there are no symbols to read.
15277
15278 2008-06-23  Craig Silverstein  <csilvers@google.com>
15279
15280         * version.cc (version_string): Bump to 1.7
15281
15282 2008-06-18  Craig Silverstein  <csilvers@google.com>
15283
15284         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15285         constant 0xFFFF to type Valtype.
15286         (Powerpc_relocate_functions::rel16_ha): Likewise.
15287
15288 2008-06-17  Ian Lance Taylor  <iant@google.com>
15289
15290         * output.h (Output_section::Input_section): Initialize p2align_ to
15291         zero for Output_section_data constructors.
15292         (Output_section::Input_section::addralign): If not an input
15293         section, return the alignment of the Output_section_data.
15294         * testsuite/copy_test.cc: New file.
15295         * testsuite/copy_test_1.cc: New file.
15296         * testsuite/copy_test_2.cc: New file.
15297         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15298         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15299         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15300         (copy_test_1_pic.o, copy_test_1.so): New targets.
15301         (copy_test_2_pic.o, copy_test_2.so): New targets.
15302         * testsuite/Makefile.in: Rebuild.
15303
15304         * script-sections.cc (Script_sections::place_orphan): Initialize
15305         local variable exact.
15306
15307 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
15308
15309         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15310
15311 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
15312             David S. Miller  <davem@davemloft.net>
15313
15314         * powerpc.cc: New file.
15315         * Makefile.am (TARGETSOURCES): Add powerpc.cc
15316         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15317         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15318         * Makefile.in: Rebuild.
15319
15320 2008-06-09  Ian Lance Taylor  <iant@google.com>
15321
15322         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15323         <exception>.
15324         (throwing, orig_terminate): New static variables.
15325         (terminate_handler): New static function.
15326         (t2): Set terminate handler.
15327
15328 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
15329
15330         PR 6584
15331         * binary.cc (Binary_to_elf::sized_convert): Fix .data
15332         alignment.
15333
15334 2008-05-30  Cary Coutant  <ccoutant@google.com>
15335
15336         * archive.cc (Archive::include_all_members) Correct to step
15337         over symbol table and extended name table in thin archives.
15338
15339 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
15340
15341         PR 6407
15342         * target-reloc.h (relocate_for_relocatable): Fix new_offset
15343         calculation.
15344
15345 2008-05-28  Caleb Howe  <cshowe@google.com>
15346
15347         * reduced_debug_output.cc: New file.
15348         * reduced_debug_output.h: New file.
15349         * options.h (class General_options): Add --strip-debug-non-line.
15350         * options.cc (General_options::finalize): Add strip_debug_non_line
15351         to the strip heirarchy.
15352         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15353         fields.
15354         * layout.cc: Include "reduced_debug_output.h".
15355         (Layout::Layout): Initialize new fields.
15356         (line_only_debug_sections): New static array.
15357         (is_lines_only_debug_sections): New static inline function.
15358         (Layout::include_section): Handle --strip-debug-non-line.
15359         (Layout::make_output_section): If --strip-debug-non-line, build
15360         new output sections for .debug_abbrev and .debug_info.
15361         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15362         gold.  Warn about possible overflow.
15363         (read_signed_LEB_128): Likewise.
15364         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15365         (read_signed_LEB_128): Declare.
15366         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15367         (HFILES): Add reduced_debug_output.h.
15368         * Makefile.in: Rebuild.
15369
15370 2008-05-21  Ian Lance Taylor  <iant@google.com>
15371
15372         * mapfile.cc: New file.
15373         * mapfile.h: New file.
15374         * options.h (class General_options): Add -M/--print-map and -Map.
15375         * options.cc (General_options::finalize): Make -M equivalent to
15376         -Map -.
15377         * main.cc: Include <cstdio> and "mapfile.h".
15378         (main): Open mapfile if requested.
15379         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
15380         constructor.  Change caller.
15381         (queue_initial_tasks): Add mapfile parameter.  Change caller.
15382         (queue_middle_tasks): Likewise.
15383         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15384         declarations.
15385         * archive.cc: Include "mapfile.h".
15386         (Archive::add_symbols): Add mapfile parameter.  Change all
15387         callers.  Pass mapfile, symbol, and reason to include_member.
15388         (Archive::include_all_members): Add mapfile parameter.  Change all
15389         callers.
15390         (Archive::include_member): Add mapfile, sym, and why parameters.
15391         Change all callers.  Report inclusion to map file.
15392         * archive.h: Include "fileread.h".
15393         (class Archive): Update declarations.
15394         (Archive::file): New const method.
15395         (class Add_archive_symbols): Add mapfile_ field.  Update
15396         constructor.  Change all callers.
15397         * readsyms.h (class Read_symbols): Likewise.
15398         (class Finish_group): Likewise.
15399         (class Read_script): Likewise.
15400         * common.cc: Include "mapfile.h".
15401         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15402         all callers.
15403         (Symbol_table::do_allocate_commons): Likewise.
15404         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15405         symbol allocation to mapfile.
15406         * common.h (class Allocate_commons_task): Add mapfile_ field.
15407         Update constructor.  Change all callers.
15408         * symtab.h (class Symbol_table): Update declarations.
15409         * layout.cc: Include "mapfile.h".
15410         (Layout_task_runner::run): Print information to mapfile.
15411         (Layout::create_gold_note): Change Output_data_fixed_space to
15412         Output_data_zero_fill.
15413         (Layout::create_build_id): Likewise.
15414         (Layout::print_to_mapfile): New function.
15415         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15416         constructor.  Change caller.
15417         (class Layout): Declare print_to_mapfile.
15418         * output.cc (Output_section::Input_section::print_to_mapfile): New
15419         function.
15420         (Output_section::add_input_section): If producing a map, always
15421         add to input_sections_ list.
15422         (Output_section::do_print_to_mapfile): New function.
15423         (Output_segment::print_sections_to_mapfile): New function.
15424         (Output_segment::print_section_list_to_mapfile): New function.
15425         * output.h: Include "mapfile.h".
15426         (Output_data::print_to_mapfile): New function.
15427         (Output_data::do_print_to_mapfile): New virtual function.
15428         (Output_segment_headers::do_print_to_mapfile): New function.
15429         (Output_file_header::do_print_to_mapfile): New function.
15430         (Output_data_const::do_print_to_mapfile): New function.
15431         (class Output_data_const_buffer): Add map_name_ field.  Update
15432         constructor.  Change all callers.  Add do_print_to_mapfile
15433         function.
15434         (class Output_data_fixed_space): Likewise.
15435         (class Output_data_space): Likewise.
15436         (class Output_data_zero_fill): New class.
15437         (Output_data_strtab::do_print_to_mapfile): New function.
15438         (Output_data_reloc_base::do_print_to_mapfile): New function.
15439         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15440         (Output_data_group::do_print_to_mapfile): New function.
15441         (Output_data_got::do_print_to_mapfile): New function.
15442         (Output_data_dynamic::do_print_to_mapfile): New function.
15443         (Output_symtab_xindex::do_print_to_mapfile): New function.
15444         (class Output_section): Declare do_print_to_mapflie.  Declare
15445         print_to_mapfile in Input_section.
15446         (class Output_segment): Declare new functions.
15447         * object.h (Sized_relobj::symbol_count): New function.
15448         * script-sections.cc
15449         (Output_section_element_dot_assignment::set_section_addresses):
15450         Change Output_data_fixed_space to Output_data_zero_fill.
15451         (Output_data_expression::do_print_to_mapfile): New function.
15452         * script.cc (read_input_script): Add mapfile parameter.  Change
15453         all callers.
15454         * script.h (read_input_script): Update declaration.
15455         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15456         (Eh_frame::do_print_to_mapfile): New function.
15457         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15458         (Output_merge_string::do_print_to_mapfile): New function.
15459         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15460         function.
15461         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15462         function.
15463         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15464         function.
15465         * Makefile.am (CCFILES): Add mapfile.cc.
15466         (HFILES): Add mapfile.h.
15467         * Makefile.in: Rebuild.
15468
15469 2008-05-19  Ian Lance Taylor  <iant@google.com>
15470
15471         * options.h (class General_options): Add -z relro.
15472         * layout.cc (Layout::Layout): Initialize relro_segment_.
15473         (Layout::add_output_section_data): Return the output section.
15474         (Layout::make_output_section): Rcognize relro sections and mark
15475         them appropriately.
15476         (Layout::attach_allocated_section_to_segment): Put relro sections
15477         in a PT_GNU_RELRO segment.
15478         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15479         section as relro.
15480         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15481         PT_TLS segments.
15482         (Layout::linkonce_mapping): Map d.rel.ro.local to
15483         .data.rel.ro.local.
15484         (Layout::output_section_name): Us .data.rel.ro.local for any
15485         section which begins with that.
15486         * layout.h (class Layout): Update add_output_section_data
15487         declaration.  Add relro_segment_ field.
15488         * output.cc (Output_section::Output_section): Initialize is_relro_
15489         and is_relro_local_ fields.
15490         (Output_segment::add_output_section): Group relro sections.
15491         (Output_segment::is_first_section_relro): New function.
15492         (Output_segment::maximum_alignment): If there is a relro section,
15493         align the segment to the common page size.
15494         (Output_segment::set_section_addresses): Track whether we are
15495         looking at relro sections.  If the last section is a relro
15496         section, align to the common page size.
15497         (Output_segment::set_section_list_addresses): Add in_relro
15498         parameter.  Change all callers.  Align to the page size when
15499         moving from relro to non-relro section.
15500         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15501         segment.
15502         * output.h (class Output_section): Add is_relro_ and
15503         is_relro_local_ fields.
15504         (Output_section::is_relro): New function.
15505         (Output_section::set_is_relro): New function.
15506         (Output_section::is_relro_local): New function.
15507         (Output_section::set_is_relro_local): New function.
15508         (class Output_segment): Update declarations.
15509         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15510         * sparc.cc (Target_sparc::got_section): Likewise.
15511         * x86_64.cc (Target_x86_64::got_section): Likewise.
15512         * testsuite/relro_test_main.cc: New file.
15513         * testsuite/relro_test.cc: New file.
15514         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15515         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15516         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15517         (relro_test.so, relro_test_pic.o): New targets.
15518         * testsuite/Makefile.in: Rebuild.
15519
15520 2008-05-16  Ian Lance Taylor  <iant@google.com>
15521
15522         * output.cc (Output_segment::add_output_section): Remove front
15523         parameter.
15524         * output.h (class Output_segment): Remove
15525         add_initial_output_section and overloaded add_output_section.
15526         Update declaration of remaining add_output_section.
15527         * layout.cc (Layout::create_interp): Call add_output_section
15528         rather than add_initial_output_section.
15529         (Layout::finish_dynamic_section): Likewise.
15530
15531         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15532         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15533         know the dynamic type.
15534         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15535         field.  Initialize it in constructor.
15536         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15537         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15538         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15539         reloc.
15540
15541         * output.cc (Output_reloc::get_address): Change return type to
15542         Elf_Addr.
15543         * output.h (class Output_reloc): Update get_address declaration.
15544         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15545         for section addresses.
15546
15547 2008-05-09  Ian Lance Taylor  <iant@google.com>
15548
15549         PR 6493
15550         * gold.cc (gold_nomem): Use return value of write.
15551
15552 2008-05-08  Ian Lance Taylor  <iant@google.com>
15553
15554         * symtab.c (Symbol::init_base_output_data): Add version
15555         parameter.  Change all callers.
15556         (Symbol::init_base_output_segment): Likewise.
15557         (Symbol::init_base_constant): Likewise.
15558         (Symbol::init_base_undefined): Likewise.
15559         (Sized_symbol::init_output_data): Likewise.
15560         (Sized_symbol::init_output_segment): Likewise.
15561         (Sized_symbol::init_constant): Likewise.
15562         (Sized_symbol::init_undefined): Likewise.
15563         (Symbol_table::do_define_in_output_data): If the new symbol has a
15564         version, mark it as the default.
15565         (Symbol_table::do_define_in_output_segment): Likewise.
15566         (Symbol_table::do_define_as_constant): Likewise.
15567         * symtab.h (class Symbol): Update declarations.
15568         (class Sized_symbol): Likewise.
15569         * resolve.cc (Symbol::override_version): New function.
15570         (Symbol::override_base): Call override_version.
15571         (Symbol::override_base_with_special): Likewise.
15572         * testsuite/ver_script_8.script: New file.
15573         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15574         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15575         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15576         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15577
15578 2008-05-06  Ian Lance Taylor  <iant@google.com>
15579
15580         PR 6049
15581         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15582         functions.
15583         (class General_options): Remove existing --undefined, and add
15584         --no-undefined instead.  Add new --undefined as synonym for -u.
15585         * archive.cc (Archive::add_symbols): Check whether symbol was
15586         named with -u.
15587         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15588         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15589         all uses.  Add IS_UNDEFINED.  Update declarations to split
15590         different versions of init_base.  Declare init_base_undefined.
15591         (Symbol::is_defined): Handle IS_UNDEFINED.
15592         (Symbol::is_undefined): Likewise.
15593         (Symbol::is_weak_undefined): Call is_undefined.
15594         (Symbol::is_absolute): Handle IS_CONSTANT.
15595         (class Sized_symbol): Update declarations to split different
15596         versions of init.  Declare init_undefined.
15597         (class Symbol_table): Declare new functions.
15598         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15599         Change all callers.
15600         (Symbol::init_base_output_data): Likewise.
15601         (Symbol::init_base_output_segment): Likewise.
15602         (Symbol::init_base_constant): Likewise.
15603         (Symbol::init_base_undefined): New function.
15604         (Sized_symbol::init_object): Rename from init.  Change all
15605         callers.
15606         (Sized_symbol::init_output_data): Likewise.
15607         (Sized_symbol::init_output_segment): Likewise.
15608         (Sized_symbol::init_constant): Likewise.
15609         (Sized_symbol::init_undefined): New function.
15610         (Symbol_table::add_undefined_symbols_from_command_line): New
15611         function.
15612         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15613         function.
15614         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15615         (Symbol::output_section): Likewise.
15616         (Symbol::set_output_section): Likewise.
15617         (Symbol_table::sized_finalize_symbol): Likewise.
15618         (Symbol_table::sized_write_globals): Likewise.
15619         * resolve.cc (Symbol_table::should_override): Likewise.
15620         (Symbol::override_base_with_special): Likewise.
15621
15622         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15623         symbol, change it to have default visibility.
15624         * testsuite/protected_1.cc: New file.
15625         * testsuite/protected_2.cc: New file.
15626         * testsuite/protected_3.cc: New file.
15627         * testsuite/protected_main_1.cc: New file.
15628         * testsuite/protected_main_2.cc: New file.
15629         * testsuite/protected_main_3.cc: New file.
15630         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15631         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15632         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15633         (protected_1.so): New target.
15634         (protected_1_pic.o, protected_2_pic.o): New targets.
15635         (protected_3_pic.o): New target.
15636         (check_PROGRAMS): Add protected_2.
15637         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15638         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15639         * testsuite/Makefile.in: Rebuild.
15640
15641         * options.h (DEFINE_var): Add set_user_set_##varname__.
15642         (DEFINE_bool_alias): New macro.
15643         (class General_options): Define -Bstatic using DEFINE_bool_alias
15644         rather than DEFINE_special.  Add --undefined as an alias for -z
15645         defs.
15646         * options.cc (General_options::parse_Bstatic): Remove.
15647
15648         * options.h (class General_options): Add --fatal-warnings.
15649         * main.cc (main): Implement --fatal-warnings.
15650         * errors.h (Errors::warning_count): New function.
15651
15652         * options.h (class General_options): Add -Bsymbolic-functions.
15653         * symtab.h (Symbol::is_preemptible): Check for
15654         -Bsymbolic-functions.
15655
15656 2008-05-05  Ian Lance Taylor  <iant@google.com>
15657
15658         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15659         as noVARNAME rather than no-VARNAME.
15660         (class General_options): Add option -z combreloc.
15661         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15662         get_address.
15663         (Output_reloc::sort_before) [SHT_REL]: New function.
15664         (Output_reloc::sort_before) [SHT_RELA]: New function.
15665         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15666         Sort_relocs_comparison.
15667         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15668         parameter.  Change all callers.
15669         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15670         sort_relocs parameter.  Change all callers.
15671         * output.cc (Output_reloc::get_address): New function, broken out
15672         of write_rel.
15673         (Output_reloc::write_rel): Call it.
15674         (Output_reloc::compare): New function.
15675         (Output_data_reloc_base::do_write): Optionally sort relocs.
15676
15677         * configure.ac: If targ_extra_obj is set, link it in.
15678         * configure.tgt: Initialize all variables.
15679         (x86_64*): Set targ_extra_obj and targ_extra_size.
15680         * configure: Rebuild.
15681
15682         * object.cc (Sized_relobj::include_section_group): Adjust section
15683         indexes read from group data.  Build vector to pass to
15684         layout_group.
15685         * layout.cc (Layout::layout_group): Add flags and shndxes
15686         parameters.  Remove contents parameter.  Change caller.  Update
15687         explicit instantiations.
15688         * layout.h (class Layout): Update layout_group declaration.
15689         * output.cc (Output_data_group::Output_data_group): Add flags and
15690         input_shndxes parameters.  Remove contents parameter.  Change
15691         caller.
15692         (Output_data_group::do_write): Change input_sections_ to
15693         input_shndxes_.
15694         * output.h (class Output_data_group): Update constructor
15695         declaration.  Rename input_sections_ to input_shndxes_.
15696         * testsuite/many_sections_test.cc: Add template.
15697
15698 2008-04-30  Cary Coutant  <ccoutant@google.com>
15699
15700         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15701
15702         * layout.cc (Layout::include_section): Refactored check for debug
15703         info section.
15704         (Layout::add_comdat): Add new parameters.  Change type
15705         of signature parameter.  Add object and shndx to signatures table.
15706         (Layout::find_kept_object): New function.
15707         * layout.h: Include <cstring>.
15708         (Layout::is_debug_info_section): New function.
15709         (Layout::add_comdat): Add new parameters.
15710         (Layout::find_kept_object): New function.
15711         (Layout::Kept_section): New struct.
15712         (Layout::Signatures): Change type of map range.
15713         * object.cc (Relobj::output_section_address): New function.
15714         (Sized_relobj::include_section_group): Add new parameters.  Change
15715         calls to Layout::add_comdat.  Change to build table of kept comdat
15716         groups and table mapping discarded sections to kept sections.
15717         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15718         (Sized_relobj::do_layout): Change calls to include_section_group and
15719         include_linkonce_section.
15720         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15721         value to zero when section is discarded.
15722         (Sized_relobj::map_to_kept_section): New function.
15723         * object.h (Relobj::output_section_address): New function.
15724         (Relobj::Comdat_group): New type.
15725         (Relobj::find_comdat_group): New function.
15726         (Relobj::Comdat_group_table): New type.
15727         (Relobj::Kept_comdat_section): New type.
15728         (Relobj::Kept_comdat_section_table): New type.
15729         (Relobj::add_comdat_group): New function.
15730         (Relobj::set_kept_comdat_section): New function.
15731         (Relobj::get_kept_comdat_section): New function.
15732         (Relobj::comdat_groups_): New field.
15733         (Relobj::kept_comdat_sections_): New field.
15734         (Symbol_value::input_value): Update comment.
15735         (Sized_relobj::map_to_kept_section) New function.
15736         (Sized_relobj::include_linkonce_section): Add new parameter.
15737         * target-reloc.h (Comdat_behavior): New type.
15738         (get_comdat_behavior): New function.
15739         (relocate_section): Add code to map a discarded section to the
15740         corresponding kept section when applying a relocation.
15741
15742 2008-04-30  Craig Silverstein  <csilvers@google.com>
15743
15744         * dwarf_reader.cc (next_generation_count): New static var.
15745         (Addr2line_cache_entry): New struct.
15746         (addr2line_cache): New static var.
15747         (Dwarf_line_info::one_addr2line): Added caching.
15748         (Dwarf_line_info::clear_addr2line_cache): New function.
15749         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15750         cache-size parameter.
15751         (Dwarf_line_info::one_addr2line_cache): New function.
15752         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15753         new cache-size argument to one_addr2line(), and clear cache.
15754
15755 2008-04-28  Cary Coutant  <ccoutant@google.com>
15756
15757         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15758         R_386_PC8 relocations.
15759
15760 2008-04-23  Ian Lance Taylor  <iant@google.com>
15761
15762         * object.cc (Sized_relobj::include_section_group): Check for
15763         invalid section group.
15764
15765         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15766         header size.
15767
15768         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15769         than read for file header.
15770         * archive.cc (Archive::include_member): Likewise.
15771
15772 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15773
15774         * aclocal.m4: Regenerate.
15775         * configure: Regenerate.
15776
15777 2008-04-19  Ian Lance Taylor  <iant@google.com>
15778
15779         * version.cc (version_string): Bump to 1.6.
15780
15781         * testsuite/Makefile.am (many_sections_r_test): New target.
15782         (many_sections_r_test_SOURCES): Remove.
15783         (many_sections_r_test_DEPENDENCIES): Remove.
15784         (many_sections_r_test_LDFLAGS): Remove.
15785         (many_sections_r_test_LDADD): Remove.
15786
15787         * object.cc (Sized_relobj::do_add_symbols): Always pass
15788         local_symbol_count_ to add_from_relobj.
15789
15790         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15791         every thousand variables.
15792         * testsuite/Makefile.in: Rebuild.
15793
15794         * object.cc (Xindex::initialize_symtab_xindex): New function.
15795         (Xindex::read_symtab_xindex): New function.
15796         (Xindex::sym_xindex_to_shndx): New function.
15797         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15798         available.
15799         (Sized_relobj::do_initialize_xindex): New function.
15800         (Sized_relobj::do_read_symbols): Adjust section links.
15801         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15802         parameter.  Change all callers.
15803         (Sized_relobj::include_section_group): Adjust section links and
15804         symbol section indexes.
15805         (Sized_relobj::do_layout): Adjust section links.
15806         (Sized_relobj::do_count_local_symbols): Adjust section links and
15807         symbol section indexes.
15808         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15809         ordinary and special symbols.
15810         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15811         dynsym_xindex parameters.  Change all callers.  Adjust section
15812         links.  Use SHN_XINDEX when needed.
15813         (Sized_relobj::get_symbol_location_info): Adjust section links.
15814         Don't get fooled by special symbols.
15815         * object.h (class Xindex): Define.
15816         (class Object): Add xindex_ parameter.  Declare virtual functoin
15817         do_initialize_xindex.
15818         (Object::adjust_sym_shndx): New function.
15819         (Object::set_xindex): New protected function.
15820         (class Symbol_value): Add is_ordinary_shndx_ field.
15821         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15822         (Symbol_value::value): Assert ordinary section.
15823         (Symbol_value::initialize_input_to_output_map): Likewise.
15824         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15825         Change all callers.
15826         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15827         all callers.
15828         (class Sized_relobj): Update declarations.
15829         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15830         parameter.  Change all callers.
15831         (Sized_relobj::adjust_shndx): New function.
15832         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15833         field.
15834         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15835         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15836         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15837         (Sized_dynobj::read_dynsym_section): Adjust section links.
15838         (Sized_dynobj::read_dynamic): Likewise.
15839         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15840         section links.
15841         (Sized_dynobj::do_initialize_xindex): New function.
15842         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15843         do_initialize_xindex.
15844         (Sized_dynobj::adjust_shndx): New function.
15845         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15846         dynsym_xindex_ fields.
15847         (Layout::finalize): Add a call to set_section_indexes before
15848         creating the symtab sections.
15849         (Layout::set_section_indexes): Don't do anything if the section
15850         already has a section index.
15851         (Layout::create_symtab_sections): Add shnum parameter.  Change
15852         caller.  Create .symtab_shndx section if needed.
15853         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15854         caller.
15855         (Layout::allocated_output_section_count): New function.
15856         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15857         needed.
15858         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15859         fields.  Update declarations.
15860         (Layout::symtab_xindex): New function.
15861         (Layout::dynsym_xindex): New function.
15862         (class Write_symbols_task): Add layout_ field.
15863         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15864         Change caller.
15865         * output.cc (Output_section_headers::Output_section_headers): Add
15866         shstrtab_section parameter.  Change all callers.
15867         (Output_section_headers::do_sized_write): Store overflow values
15868         for section count and section string table section index in
15869         section header zero.
15870         (Output_file_header::do_sized_write): Check for overflow of
15871         section count and section string table section index.
15872         (Output_symtab_xindex::do_write): New function.
15873         (Output_symtab_xindex::endian_do_write): New function.
15874         * output.h (class Output_section_headers): Add shstrtab_section_.
15875         Update declarations.
15876         (class Output_symtab_xindex): Define.
15877         (Output_section::has_out_shndx): New function.
15878         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15879         field.
15880         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15881         Change all callers.
15882         (Sized_symbol::init): Likewise.
15883         (Symbol::output_section): Check for ordinary symbol.
15884         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15885         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15886         callers.
15887         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15888         Change all callers.  Simplify handling of symbols from sections
15889         not included in the link.
15890         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15891         distinction.
15892         (Weak_alias_sorter::operator()): Assert that symbols are
15893         ordinary.
15894         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15895         distinction.
15896         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15897         parameters.  Change all callers.
15898         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15899         symbol distinction.  Use SHN_XINDEX when needed.
15900         (Symbol_table::write_section_symbol): Add symtab_xindex
15901         parameter.  Change all callers.
15902         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15903         SHN_XINDEX when needed.
15904         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15905         declarations.
15906         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15907         (Symbol::is_defined): Check is_ordinary.
15908         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15909         (Symbol::is_absolute, Symbol::is_common): Likewise.
15910         (class Sized_symbol): Update declarations.
15911         (class Symbol_table): Update declarations.
15912         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15913         parameters.  Change all callers.
15914         (Sized_symbol::override): Likewise.
15915         (Symbol_table::override): Likewise.
15916         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15917         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15918         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15919         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15920         to be in an ordinary section.
15921         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15922         object and is_ordinary parameters.  Change all callers.
15923         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15924         Change all callers.  Don't add undefined or non-ordinary symbols
15925         to reloc_map_.
15926         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15927         Change all callers.
15928         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15929         declarations.
15930         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15931         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15932         (Sized_relobj::relocate_sections): Likewise.
15933         * target-reloc.h (scan_relocs): Adjust section symbol index.
15934         (scan_relocatable_relocs): Likewise.
15935         * i386.cc (Scan::local): Check for ordinary symbols.
15936         * sparc.cc (Scan::local): Likewise.
15937         * x86_64.cc (Scan::local): Likewise.
15938         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15939         to symbol_section_and_value.
15940         * testsuite/many_sections_test.cc: New file.
15941         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15942         (check_PROGRAMS): Add many_sections_test.
15943         (many_sections_test_SOURCES): Define.
15944         (many_sections_test_DEPENDENCIES): Define.
15945         (many_sections_test_LDFLAGS): Define.
15946         (BUILT_SOURCES): Add many_sections_define.h.
15947         (many_sections_define.h): New target.
15948         (BUILT_SOURCES): Add many_sections_check.h.
15949         (many_sections_check.h): New target.
15950         (check_PROGRAMS): Add many_sections_r_test.
15951         (many_sections_r_test_SOURCES): Define.
15952         (many_sections_r_test_DEPENDENCIES): Define.
15953         (many_sections_r_test_LDFLAGS): Define.
15954         (many_sections_r_test_LDADD): Define.
15955         (many_sections_r_test.o): New target.
15956         * testsuite/Makefile.in: Rebuild.
15957
15958 2008-04-17  Cary Coutant  <ccoutant@google.com>
15959
15960         * errors.cc (Errors::info): New function.
15961         (gold_info): New function.
15962         * errors.h (Errors::info): New function.
15963         * gold.h (gold_info): New function.
15964         * object.cc (Input_objects::add_object): Print trace output.
15965         * options.cc (options::parse_set): New function.
15966         (General_options::parse_wrap): Deleted.
15967         (General_options::General_options): Deleted initializer.
15968         * options.h (options::String_set): New typedef.
15969         (options::parse_set): New function.
15970         (DEFINE_set): New macro.
15971         (General_options::wrap): Changed to use DEFINE_set. Changed
15972         callers of any_wrap_symbols and is_wrap_symbol.
15973         (General_options::trace, General_options::trace_symbol):
15974         New options.
15975         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15976         (General_options::wrap_symbols_): Deleted.
15977         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15978
15979 2008-04-17  David S. Miller  <davem@davemloft.net>
15980
15981         * options.cc (General_options::parse_V): New function.
15982         * options.h: Add entries for -V and -Qy.
15983
15984 2008-04-17  Ian Lance Taylor  <iant@google.com>
15985
15986         * common.cc (Symbol_table::allocate_commons): Remove options
15987         parameter.  Change caller.
15988         (Symbol_table::do_allocate_commons): Remove options parameter.
15989         Change caller.  Just call do_allocate_commons_list twice.
15990         (Symbol_table::do_allocate_commons_list): New function, broken out
15991         of do_allocate_commons.
15992         * common.h (class Allocate_commons_task): Remove options_ field.
15993         Update constructor.
15994         * symtab.cc (Symbol_table::Symbol_table): Initialize
15995         tls_commons_.
15996         (Symbol_table::add_from_object): Put TLS common symbols on
15997         tls_commons_ list.
15998         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15999         which are IN_OUTPUT_DATA.
16000         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16001         allocate_commons and do_allocate_commons declarations.  Declare
16002         do_allocate_commons_list.
16003         * gold.cc (queue_middle_tasks): Update creation of
16004         Allocate_commons_task to not pass options.
16005         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16006         (TLS_TEST_C_FLAGS): New variable.
16007         (tls_test_c_pic.o): New target.
16008         (tls_test_shared.so): Link in tls_test_c_pic.o.
16009         (tls_test_c_pic_ie.o): New target.
16010         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16011         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16012         (tls_test_c.o): New target.
16013         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16014         (tls_pic_test_LDADD): Likewise.
16015         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16016         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16017         (tls_test_c_gnu2.o): New target.
16018         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16019         tls_test_c_gnu2.o.
16020         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16021         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16022         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16023         * testsuite/tls_test.cc: Include "config.h".
16024         (t_last): Call t11_last.
16025         * testsuite/tls_test.h (t11, t11_last): Declare.
16026         * testsuite/tls_test_c.c: New file.
16027         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16028         * configure.ac: Check for OpenMP support.
16029         * configure, config.in, Makefile.in: Rebuild.
16030         * testsuite/Makefile.in: Rebuild.
16031
16032 2008-04-16  Cary Coutant  <ccoutant@google.com>
16033
16034         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16035         (Target_i386::tls_base_symbol_defined_): New field.
16036         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16037         (Target_i386::Scan::global): Likewise.
16038         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16039         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16040         (Target_x86_64::tls_base_symbol_defined_): New field.
16041         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16042         (Target_x86_64::Scan::global): Likewise.
16043
16044 2008-04-16  Cary Coutant  <ccoutant@google.com>
16045
16046         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16047         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16048         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16049         building shared libraries.
16050         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16051         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16052         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16053         * testsuite/Makefile.in: Rebuild.
16054         * testsuite/weak_undef.h: New file.
16055         * testsuite/weak_undef_file1.cc: Add extra test cases.
16056         * testsuite/weak_undef_file2.cc: Likewise.
16057         * testsuite/weak_undef_test.cc: Likewise.
16058
16059 2008-04-16  David S. Miller  <davem@davemloft.net>
16060
16061         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16062         Add issued_non_pic_error_ field.  Declare check_non_pic.
16063         (Target_sparc::Scan::check_non_pic): New function.
16064         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16065         (Target_sparc::Scan::global): Likewise.
16066
16067         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16068         * configure: Rebuild.
16069
16070         * options.h (DEFINE_enable): New macro.
16071         (new_dtags): New enable option.
16072         (initfirst, interpose, loadfltr, nodefaultlib,
16073         nodelete, nodlopen, nodump): New -z options.
16074         * layout.cc (Layout:finish_dynamic_section): If new
16075         dtags enabled, emit DT_RUNPATH.  Also, emit a
16076         DT_FLAGS_1 containing any specified -z flags.
16077
16078 2008-04-16  Ian Lance Taylor  <iant@google.com>
16079
16080         * copy-relocs.cc: New file.
16081         * copy-relocs.h: New file.
16082         * reloc.cc: Remove Copy_relocs code.
16083         * reloc.h: Likewise.
16084         * reloc-types.h (struct Reloc_types) [both versions]: Add
16085         get_reloc_addend_noerror.
16086         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16087         variants of add_global which take an addend which must be zero.
16088         * i386.cc: Include "copy-relocs.h".
16089         (class Target_i386): Change type of copy_relocs_ to variable,
16090         update initializer.
16091         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16092         Change all callers.
16093         (Target_i386::do_finalize_sections): Change handling of
16094         copy_relocs_.
16095         * sparc.cc: Include "copy-relocs.h".
16096         (class Target_sparc): Change type of copy_relocs_ to variable,
16097         update initializer.
16098         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16099         Change all callers.
16100         (Target_sparc::do_finalize_sections): Change handling of
16101         copy_relocs_.
16102         * x86_64.cc: Include "copy-relocs.h".
16103         (class Target_x86_64): Change type of copy_relocs_ to variable,
16104         update initializer.
16105         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16106         class.  Change all callers.
16107         (Target_x86_64::do_finalize_sections): Change handling of
16108         copy_relocs_.
16109         * Makefile.am (CCFILES): Add copy-relocs.cc.
16110         (HFILES): Add copy-relocs.h.
16111
16112         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16113
16114         * testsuite/script_test_4.sh: Permit leading zeroes.
16115
16116 2008-04-15  Ian Lance Taylor  <iant@google.com>
16117
16118         * script-sections.cc (Script_sections::create_segments): Use
16119         header_size_adjustment even when there is enough room for the
16120         headers.
16121         * testsuite/script_test_4.sh: New file.
16122         * testsuite/script_test_4.t: New file.
16123         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16124         (check_DATA): Add script_test_4.stdout.
16125         (MOSTLYCLEANFILES): Likewise.
16126         (script_test_4): New target.
16127         (script_test_4.stdout): New target.
16128         * testsuite/Makefile.in: Rebuild.
16129
16130         * sparc.cc: Add definitions for Output_data_plt_sparc class
16131         constants.
16132
16133 2008-04-14  David S. Miller  <davem@davemloft.net>
16134
16135         * sparc.cc: New file.
16136         * Makefile.am (TARGETSOURCES): Add sparc.cc
16137         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16138         * configure.tgt: Document targ_extra_size and
16139         targ_extra_big_endian.  Add entries for sparc-* and
16140         sparc64-*.
16141         * configure.ac: Handle targ_extra_size and
16142         targ_extra_big_endian.
16143         * Makefile.in: Rebuild.
16144         * configure: Likewise.
16145         * po/POTFILES.in: Likewise.
16146         * po/gold.pot: Likewise.
16147
16148 2008-04-14  Ian Lance Taylor  <iant@google.com>
16149
16150         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16151         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16152         in the name/type/flags to section mapping.  Don't call
16153         allocate_output_section.
16154         (Layout::choose_output_section): Change parameter from adjust_name
16155         to is_input_section.  Don't permit input sections after sections
16156         are attached to segments.  Don't call allocate_output_section.
16157         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16158         not write_enable_output_section.
16159         (Layout::make_output_section): Don't push to
16160         unattached_section_list_ nor call attach_to_segment.  Call
16161         attach_section_to_segment if sections are attached.
16162         (Layout::attach_sections_to_segments): New function.
16163         (Layout::attach_section_to_segment): New function.
16164         (Layout::attach_allocated_section_to_segment): Rename from
16165         attach_to_segment.  Remove flags parameter.
16166         (Layout::allocate_output_section): Remove function.
16167         (Layout::write_enable_output_section): Remove function.
16168         * layout.h (class Layout): Update for above changes.  Add new
16169         field sections_are_attached_.
16170         * output.h (Output_section::update_flags_for_input_section): New
16171         function.
16172         * output.cc (Output_section::add_input_section): Call
16173         update_flags_for_input_section.
16174         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16175
16176 2008-04-11  Cary Coutant  <ccoutant@google.com>
16177
16178         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16179         thought unnecessary.
16180         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16181
16182 2008-04-11  Ian Lance Taylor  <iant@google.com>
16183
16184         * output.h (class Output_section_data): Remove inline definition
16185         of set_addralign.
16186         * output.cc (Output_section_data::set_addralign): New function.
16187
16188 2008-04-11  Cary Coutant  <ccoutant@google.com>
16189
16190         Add support for TLS descriptors for i386 and x86_64.
16191         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16192         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16193         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16194         GOT_TYPE_TLS_DESC.
16195         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16196         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16197         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16198         relocations.
16199         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16200         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16201         Fix problem with initial-exec relocations.
16202         (Target_i386::Relocate::relocate_tls): Likewise.
16203         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16204         relaxation.
16205         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16206         support for section-plus-offset dynamic table entries.
16207         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16208         (Output_data_dynamic::Dynamic_entry): Add support for
16209         section-plus-offset dynamic table entries.
16210         (Output_data_dynamic::Classification): Likewise.
16211         (Output_data_dynamic::classification_): Renamed offset_.
16212         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16213         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16214         (Target_x86_64::make_plt_section): New function.
16215         (Target_x86_64::reserve_tlsdesc_entries): New function.
16216         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16217         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16218         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16219         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16220         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16221         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16222         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16223         add extra PLT entry for TLS descriptors.
16224         (Output_data_plt_x86_64::got_): New field.
16225         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16226         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16227         fields.
16228         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16229         descriptors.
16230         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16231         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16232         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16233         R_386_TLS_DESC_CALL relocations.
16234         (Target_x86_64::Scan::global): Likewise.
16235         (Target_x86_64::do_finalize_sections): Add dynamic table entries
16236         for TLS descriptors.
16237         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16238         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16239         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16240         GD-to-IE relaxation.
16241         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16242         and TLS_DESCRIPTORS.
16243         * Makefile.in: Rebuild.
16244         * configure: Rebuild.
16245         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16246         (tls_test_shared2.so): New target.
16247         (tls_shared_gd_to_ie_test_SOURCES): New variable.
16248         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16249         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16250         (tls_shared_gd_to_ie_test_LDADD): New variable.
16251         (tls_shared_gnu2_gd_to_ie_test): New target.
16252         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16253         New targets.
16254         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16255         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16256         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16257         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16258         (tls_shared_gnu2_test): New target.
16259         (tls_test_gnu2_shared.so): New target.
16260         (tls_shared_gnu2_test_SOURCES): New variable.
16261         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16262         (tls_shared_gnu2_test_LDFLAGS): New variable.
16263         (tls_shared_gnu2_test_LDADD): New variable.
16264         * testsuite/Makefile.in: Rebuild.
16265         * testsuite/Makefile.
16266
16267 2008-04-11  Ian Lance Taylor  <iant@google.com>
16268
16269         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16270         justsyms.t.
16271         * testsuite/Makefile.in: Rebuild.
16272
16273         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16274         long.
16275         * testsuite/script_test_2.cc (main): Adjust test.
16276
16277 2008-04-11  David S. Miller  <davem@davemloft.net>
16278             Ian Lance Taylor  <iant@google.com>
16279
16280         * options.h (General_options): Add entries for '-Y' and
16281         '-relax'.
16282         * options.cc (General_options:finalize): If -Y was used, add those
16283         entries to the library path instead of the default "/lib" and
16284         "/usr/lib".
16285
16286 2008-04-11  David S. Miller  <davem@davemloft.net>
16287
16288         * testsuite/justsyms.t: Start at 0x100.
16289         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16290         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16291         long.
16292         * testsuite/script_test_2.cc: Adjust string and section length
16293         checks.
16294
16295 2008-04-09  Ian Lance Taylor  <iant@google.com>
16296
16297         PR gold/5996
16298         * script-sections.cc (Sections_element::allocate_to_segment): Add
16299         orphan parameter.
16300         (Output_section_definition::allocate_to_segment): Likewise.
16301         (Orphan_output_section::allocate_to_segment): Likewise.
16302         (Script_sections::attach_sections_using_phdrs_clause): Don't
16303         propagate non-PT_LOAD segments to orphan sections.
16304         * testsuite/Makefile.am (script_test_3.stdout): Generate using
16305         readelf rather than objdump.
16306         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
16307         .interp section and PT_INTERP segment are the same size.
16308         * testsuite/Makefile.in: Rebuild.
16309
16310         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16311         aliases for symbols defined in the same object.
16312         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16313         (weak_alias_test_SOURCES): New variable.
16314         (weak_alias_test_DEPENDENCIES): New variable.
16315         (weak_alias_test_LDFLAGS): New variable.
16316         (weak_alias_test_LDADD): New variable.
16317         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16318         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16319         (weak_alias_test_3.o): New target.
16320         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16321         * testsuite/weak_alias_test_main.cc: New file.
16322         * testsuite/weak_alias_test_1.cc: New file.
16323         * testsuite/weak_alias_test_2.cc: New file.
16324         * testsuite/weak_alias_test_3.cc: New file.
16325
16326 2008-04-08  Ian Lance Taylor  <iant@google.com>
16327
16328         * options.h (class General_options): Add --noinhibit-exec option.
16329         * main.cc (main): Check --noinhibit-exec.
16330
16331         * options.h (class General_options): Define --wrap as a special
16332         option.  Add wrap_symbols_ field.
16333         (General_options::any_wrap_symbols): New function.
16334         (General_options::is_wrap_symbol): New function.
16335         * options.cc (General_options::parse_wrap): New function.
16336         (General_options::General_options): Initialize wrap_symbols_.
16337         * symtab.cc (Symbol_table::wrap_symbol): New function.
16338         (Symbol_table::add_from_object): Handle --wrap.
16339         * symtab.h (class Symbol_table): Declare wrap_symbol.
16340         * target.h (Target::wrap_char): New function.
16341         (Target::Target_info): Add wrap_char field.
16342         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16343         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16344         * testsuite/testfile.cc (Target_test::test_target_info):
16345         Likewise.
16346
16347         * errors.cc (Errors::undefined_symbol): Mention symbol version if
16348         there is one.
16349
16350         * layout.h (class Layout): Add added_eh_frame_data_ field.
16351         * layout.cc (Layout::Layout): Initialize new field.
16352         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16353         output section until we find a section we merged successfully.
16354         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16355         that the size be non-zero.
16356
16357         * merge.cc (Object_merge_map::get_output_offset): Remove inline
16358         qualifier.
16359
16360 2008-04-08  Craig Silverstein  <csilvers@google.com>
16361
16362         * configure.ac: Export new conditional variable HAVE_ZLIB.
16363         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16364         on HAVE_ZLIB.
16365         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16366         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16367
16368 2008-04-07  Ian Lance Taylor  <iant@google.com>
16369
16370         * version.cc (version_string): Set to "1.5".
16371
16372         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16373         Add issued_non_pic_error_ field.  Declare check_non_pic.
16374         (Target_x86_64::Scan::check_non_pic): New function.
16375         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16376         (Target_x86_64::Scan::global): Likewise.
16377
16378         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16379         addend parameter.  Change caller.  Handle merge sections.
16380         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16381         Address to Addend.  Don't add in the result of
16382         local_section_offset, pass down the addend and use the returned
16383         value.
16384         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16385         Update declarations of local_section_offset and symbol_value.
16386         * testsuite/two_file_test_1.cc (t18): New function.
16387         * testsuite/two_file_test_2.cc (f18): New function.
16388         * testsuite/two_file_test_main.cc (main): Call t18.
16389         * testsuite/two_file_test.h (t18, f18): Declare.
16390
16391         * configure.ac: Don't test for objdump, c++filt, or readelf.
16392         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16393         conditionals.
16394         (TEST_READELF): New variable.
16395         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16396         (check_PROGRAMS): Add two_file_strip_test.
16397         (two_file_strip_test): New target.
16398         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16399         (two_file_same_shared_strip_test_SOURCES): New variable.
16400         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16401         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16402         (two_file_same_shared_strip_test_LDADD): New variable.
16403         (two_file_shared_strip.so): New target.
16404         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16405         (ver_test_5.syms, ver_test_7.syms): Likewise.
16406         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16407         (strip_test_3.stdout): Use TEST_OBJDUMP.
16408         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16409
16410 2008-04-04  Cary Coutant  <ccoutant@google.com>
16411
16412         * symtab.h (Symbol::is_weak_undefined): New function.
16413         (Symbol::is_strong_undefined): New function.
16414         (Symbol::is_absolute): New function.
16415         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16416         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16417         absolute symbols.
16418         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16419         (weak_undef_test): New target.
16420         * testsuite/Makefile.in: Rebuild.
16421         * testsuite/weak_undef_file1.cc: New file.
16422         * testsuite/weak_undef_file2.cc: New file.
16423         * testsuite/weak_undef_test.cc: New file.
16424
16425 2008-04-03  Craig Silverstein  <csilvers@google.com>
16426
16427         * compressed_output.h (class Output_compressed_section): Use
16428         unsigned buffer.
16429         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16430         add zlib header.
16431         (zlib_compressed_suffix): Removed.
16432         (Output_compressed_section::set_final_data_size): Use unsigned
16433         buffers.
16434         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16435         Fix linker invocation.
16436         (flagstest_o_specialfile_and_compress_debug_sections):
16437         Likewise.
16438         * testsuite/Makefile.in: Regenerated.
16439
16440 2008-04-02  David S. Miller  <davem@davemloft.net>
16441
16442         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16443         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16444
16445 2008-04-02  Craig Silverstein  <csilvers@google.com>
16446
16447         * TODO: New file.
16448
16449 2008-04-02  Ian Lance Taylor  <iant@google.com>
16450
16451         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16452         parameters.  Update for new key type to views_.  Change all
16453         callers.
16454         (File_read::read): Adjust for byteshift in returned view.
16455         (File_read::add_view): New function, broken out of
16456         find_and_make_view.
16457         (File_read::make_view): New function, broken out of
16458         find_and_make_view.
16459         (File_read::find_or_make_view): Add offset and aligned
16460         parameters.  Rewrite accordingly.  Change all callers.
16461         (File_read::get_view): Add offset and aligned parameters.  Adjust
16462         for byteshift in return value.
16463         (File_read::get_lasting_view): Likewise.
16464         * fileread.h (class File_read): Update declarations.
16465         (class File_read::View): Add byteshift_ field.  Add byteshift to
16466         constructor.  Add byteshift method.
16467         * archive.h (Archive::clear_uncached_views): New function.
16468         (Archive::get_view): Add aligned parameter.  Change all callers.
16469         * object.h (Object::get_view): Add aligned parameter.  Change all
16470         callers.
16471         (Object::get_lasting_view): Likewise.
16472
16473         * fileread.cc (File_read::release): Don't call clear_views if
16474         there are multiple objects.
16475         * fileread.h (File_read::clear_uncached_views): New function.
16476         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16477         on the archive.
16478
16479 2008-03-31  Cary Coutant  <ccoutant@google.com>
16480
16481         Add thin archive support.
16482         * archive.cc (Archive::armagt): New const.
16483         (Archive::setup): Remove task parameter and calls to unlock.
16484         (Archive::unlock_nested_archives): New function.
16485         (Archive::read_header): Add nested_off parameter. Change
16486         all callers.
16487         (Archive::interpret_header): Likewise.
16488         (Archive::include_all_members): Change to handle thin
16489         archives.
16490         (Archive::include_member): Likewise.
16491         * archive.h (Archive::Archive): Add new parameters and
16492         initializers.
16493         (Archive::armagt): New const.
16494         (Archive::setup): Remove task parameter.
16495         (Archive::unlock_nested_archives): New function.
16496         (Archive::read_header): Add nested_off parameter.
16497         (Archive::interpret_header): Likewise.
16498         (Archive::Nested_archive_table): New typedef.
16499         (Archive::is_thin_archive_): New field.
16500         (Archive::nested_archives_): New field.
16501         (Archive::options_): New field.
16502         (Archive::dirpath_): New field.
16503         (Archive::task_): New field.
16504         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16505         for thin archives.  Pass additional parameters to
16506         Archive::Archive.  Unlock the archive file after calling
16507         Archive::setup.
16508
16509 2008-03-29  Ian Lance Taylor  <iant@google.com>
16510
16511         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16512         version symbol to be local.
16513         * testsuite/ver_test_4.sh: New file.
16514         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16515         (check_DATA): Add ver_test_4.syms.
16516         (ver_test_4.syms): New target.
16517         * testsuite/Makefile.in: Rebuild.
16518
16519         * output.cc
16520         (Output_section::Input_section_sort_entry::has_priority): New
16521         function.
16522         (Output_section::Input_section_sort_entry::match_file_name): New
16523         function.
16524         (Output_section::Input_section_sort_entry::match_section_name):
16525         Remove.
16526         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16527         Remove.
16528         (Output_section::Input_section_sort_entry::match_section_file):
16529         Remove.
16530         (Output_section::Input_section_sort_compare::operator()): Rewrite
16531         using new Input_section_sort_entry functions.  Sort crtbegin and
16532         crtend first.  Sort sections with no priority before sections with
16533         a priority.
16534         * testsuite/initpri1.c (d3): Check j != 4.
16535         (cd5): New constructor/destructor function.
16536         (main): Check j != 2.
16537
16538         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16539         new symbol when resolving, don't call set_is_default.
16540         * testsuite/ver_test_7.cc: New file.
16541         * testsuite/ver_test_7.sh: New file.
16542         * testsuite/Makefile.am (ver_test_7.so): New target.
16543         (ver_test_7.o): New target.
16544         (check_SCRIPTS): Add ver_test_7.sh.
16545         (check_DATA): Add ver_test_7.syms.
16546         (ver_test_7.syms): New target.
16547
16548 2008-03-28  Ian Lance Taylor  <iant@google.com>
16549
16550         * layout.cc (Layout::layout): If we see an input section with a
16551         name that needs sorting, set the must_sort flag for the output
16552         section.
16553         (Layout::make_output_section): If the name of the output section
16554         indicates that it might require sorting, set the may_sort flag.
16555         * output.h (Output_section::may_sort_attached_input_sections): New
16556         function.
16557         (Output_section::set_may_sort_attached_input_sections): New
16558         function.
16559         (Output_section::must_sort_attached_input_sections): New
16560         function.
16561         (Output_section::set_must_sort_attached_input_sections): New
16562         function.
16563         (class Output_section): Declare Input_section_sort_entry.  Define
16564         Input_section_sort_compare.  Declare
16565         sort_attached_input_sections.  Add new fields:
16566         may_sort_attached_input_sections_,
16567         must_sort_attached_input_sections_,
16568         attached_input_sections_are_sorted_.
16569         * output.cc (Output_section::Output_section): Initialize new
16570         fields.
16571         (Output_section::add_input_section): Add an entry to
16572         input_sections_ if may_sort or must_sort are true.
16573         (Output_section::set_final_data_size): Call
16574         sort_attached_input_sections if necessary.
16575         (Output_section::Input_section_sort_entry): Define new class.
16576         (Output_section::Input_section_sort_compare::operator()): New
16577         function.
16578         (Output_section::sort_attached_input_sections): New function.
16579         * configure.ac: Check whether the compiler supports constructor
16580         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16581         * testsuite/initpri1.c: New file.
16582         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16583         CONSTRUCTOR_PRIORITY.
16584         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16585         (initpri1_LDFLAGS): New variable.
16586         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16587
16588 2008-03-27  Ian Lance Taylor  <iant@google.com>
16589
16590         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16591         * testsuite/common_test_1.c: New file.
16592         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16593         (common_test_1_SOURCES): New variable.
16594         (common_test_1_DEPENDENCIES): New variable.
16595         (common_test_1_LDFLAGS): New variable.
16596
16597         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16598         and commons_ correctly when NAME/VERSION does not override
16599         NAME/NULL.
16600         * testsuite/ver_test_6.c: New file.
16601         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16602         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16603         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16604
16605 2008-03-26  Ian Lance Taylor  <iant@google.com>
16606
16607         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16608         of an undefined symbol from a version script.
16609         * testsuite/Makefile.am (ver_test_5.so): New target.
16610         (ver_test_5.o): New target.
16611         (check_SCRIPTS): Add ver_test_5.sh.
16612         (check_DATA): Add ver_test_5.syms.
16613         (ver_test_5.syms): New target.
16614         * testsuite/ver_test_5.cc: New file.
16615         * testsuite/ver_test_5.script: New file.
16616         * testsuite/ver_test_5.sh: New file.
16617         * Makefile.in, testsuite/Makefile.in: Rebuild.
16618
16619         PR gold/5986
16620         Fix problems building gold with gcc 4.3.0.
16621         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16622         (gold_error_at_location, gold_warning_at_location): Use it.
16623         * configure.ac: Check whether we can compile and use a template
16624         function with a printf attribute.
16625         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16626         when jumping over bytes.
16627         * object.cc: Instantiate Object::read_section_data.
16628         * debug.h: Include <cstring>
16629         * dwarf_reader.cc: Include <algorithm>
16630         * main.cc: Include <cstring>.
16631         * options.cc: Include <cstring>.
16632         * output.cc: Include <cstring>.
16633         * script.cc: Include <cstring>.
16634         * script.h: Include <string>.
16635         * symtab.cc: Include <cstring> and <algorithm>.
16636         * target-select.cc: Include <cstring>.
16637         * version.cc: Include <string>.
16638         * testsuite/testmain.cc: Include <cstdlib>.
16639         * configure, config.in: Rebuild.
16640
16641 2008-03-25  Ian Lance Taylor  <iant@google.com>
16642
16643         * options.cc: Include "../bfd/bfdver.h".
16644         (options::help): Print bug reporting address.
16645
16646         * version.cc (print_version): Adjust output for current value of
16647         BFD_VERSION_STRING.
16648
16649         * NEWS: New file.
16650
16651         * options.cc (options::help): Print list of supported targets.
16652         * target-select.h: Include <vector>.
16653         (class Target_selector): Make machine_, size_, and is_big_endian_
16654         fields const.  Add bfd_name_ and instantiated_target_ fields.
16655         (Target_selector::Target_selector): Add bfd_name parameter.
16656         (Target_selector::recognize): Make non-virtual, call
16657         do_recognize.
16658         (Target_selector::recognize_by_name): Make non-virtual, call
16659         do_recognize_by_name.
16660         (Target_selector::supported_names): New function.
16661         (Target_selector::bfd_name): New function.
16662         (Target_selector::do_instantiate_target): New pure virtual
16663         function.
16664         (Target_selector::do_recognize): New virtual function.
16665         (Target_selector::do_recognize_by_name): New virtual function.
16666         (Target_selector::instantiate_target): New private function.
16667         (supported_target_names): Declare.
16668         * target-select.cc (Target_selector::Target_selector): Update for
16669         new parameter and fields.
16670         (select_target_by_name): Check that the name matches before
16671         calling recognize_by_name.
16672         (supported_target_names): New function.
16673         * i386.cc (class Target_selector_i386): Update Target_selector
16674         constructor call.  Remove recognize and recognize_by_name.  Add
16675         do_instantiate_target.
16676         * x86_64.cc (class Target_selector_x86_64): Likewise.
16677         * testsuite/testfile.cc (class Target_selector_test): Update for
16678         changes to Target_selector.
16679
16680         * README: Rewrite, with some notes on unsupported features.
16681
16682 2008-03-24  Cary Coutant  <ccoutant@google.com>
16683
16684         * i386.cc (Target_i386::Got_type): New enum declaration.
16685         (Target_i386::Scan::local): Updated callers of Output_data_got
16686         member functions.
16687         (Target_i386::Scan::global): Likewise.
16688         (Target_i386::Relocate::relocate): Likewise.
16689         (Target_i386::Relocate::relocate_tls): Likewise.
16690         * object.h (Got_offset_list): New class.
16691         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16692         (Sized_relobj::local_got_offset): Likewise.
16693         (Sized_relobj::set_local_got_offset): Likewise.
16694         (Sized_relobj::local_has_tls_got_offset): Removed.
16695         (Sized_relobj::local_tls_got_offset): Removed.
16696         (Sized_relobj::set_local_tls_got_offset): Removed.
16697         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16698         * output.cc (Output_data_got::add_global): Added got_type parameter.
16699         (Output_data_got::add_global_with_rel): Likewise.
16700         (Output_data_got::add_global_with_rela): Likewise.
16701         (Output_data_got::add_global_pair_with_rel): New function.
16702         (Output_data_got::add_global_pair_with_rela): New function.
16703         (Output_data_got::add_local): Added got_type parameter.
16704         (Output_data_got::add_local_with_rel): Likewise.
16705         (Output_data_got::add_local_with_rela): Likewise.
16706         (Output_data_got::add_local_pair_with_rel): New function.
16707         (Output_data_got::add_local_pair_with_rela): New function.
16708         (Output_data_got::add_global_tls): Removed.
16709         (Output_data_got::add_global_tls_with_rel): Removed.
16710         (Output_data_got::add_global_tls_with_rela): Removed.
16711         (Output_data_got::add_local_tls): Removed.
16712         (Output_data_got::add_local_tls_with_rel): Removed.
16713         (Output_data_got::add_local_tls_with_rela): Removed.
16714         * output.h (Output_data_got::add_global): Added got_type parameter.
16715         (Output_data_got::add_global_with_rel): Likewise.
16716         (Output_data_got::add_global_with_rela): Likewise.
16717         (Output_data_got::add_global_pair_with_rel): New function.
16718         (Output_data_got::add_global_pair_with_rela): New function.
16719         (Output_data_got::add_local): Added got_type parameter.
16720         (Output_data_got::add_local_with_rel): Likewise.
16721         (Output_data_got::add_local_with_rela): Likewise.
16722         (Output_data_got::add_local_pair_with_rel): New function.
16723         (Output_data_got::add_local_pair_with_rela): New function.
16724         (Output_data_got::add_global_tls): Removed.
16725         (Output_data_got::add_global_tls_with_rel): Removed.
16726         (Output_data_got::add_global_tls_with_rela): Removed.
16727         (Output_data_got::add_local_tls): Removed.
16728         (Output_data_got::add_local_tls_with_rel): Removed.
16729         (Output_data_got::add_local_tls_with_rela): Removed.
16730         * resolve.cc (Symbol::override_base_with_special): Removed
16731         reference to has_got_offset_ field.
16732         * symtab.cc (Symbol::init_fields): Replaced initialization
16733         of got_offset_ with got_offsets_.  Removed initialization
16734         of has_got_offset_
16735         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16736         (Symbol::got_offset): Likewise.
16737         (Symbol::set_got_offset): Likewise.
16738         (Symbol::has_tls_got_offset): Removed.
16739         (Symbol::tls_got_offset): Removed.
16740         (Symbol::set_tls_got_offset): Removed.
16741         (Symbol::got_offset_): Removed.
16742         (Symbol::tls_mod_got_offset_): Removed.
16743         (Symbol::tls_pair_got_offset_): Removed.
16744         (Symbol::got_offsets_): New field.
16745         (Symbol::has_got_offset): Removed.
16746         (Symbol::has_tls_mod_got_offset): Removed.
16747         (Symbol::has_tls_pair_got_offset): Removed.
16748         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16749         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16750         member functions.
16751         (Target_x86_64::Scan::global): Likewise.
16752         (Target_x86_64::Relocate::relocate): Likewise.
16753         (Target_x86_64::Relocate::relocate_tls): Likewise.
16754
16755 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16756
16757         * yyscript.y: Fix spelling error in comment.
16758
16759 2008-03-24  Ian Lance Taylor  <iant@google.com>
16760
16761         * options.h (class General_options): Define build_id option.
16762         * layout.h (class Layout): Declare write_build_id, create_note,
16763         create_build_id.  Add build_id_note_ member.
16764         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16765         "libiberty.h", "md5.h", "sha1.h".
16766         (Layout::Layout): Initialize eh_frame_data_,
16767         eh_frame_hdr_section_, and build_id_note_.
16768         (Layout::finalize): Call create_build_id.
16769         (Layout::create_note): New function, broken out of
16770         Layout::create_gold_note.
16771         (Layout::create_gold_note): Call create_note.
16772         (Layout::create_build_id): New function.
16773         (Layout::write_build_id): New function.
16774         (Close_task_runner::run): Call write_build_id.
16775
16776         * x86_64.cc: Correct license to GPLv3.
16777
16778 2008-03-23  Ian Lance Taylor  <iant@google.com>
16779
16780         * options.cc: Include "demangle.h".
16781         (parse_optional_string): New function.
16782         (parse_long_option): Handle takes_optional_argument.
16783         (parse_short_option): Update dash_z initializer.  Handle
16784         takes_optional_argument.
16785         (General_options::General_options): Initialize do_demangle_.
16786         (General_options::finalize): Set do_demangle_.  Handle demangling
16787         style.
16788         * options.h (parse_optional_string): Declare.
16789         (struct One_option): Add optional_arg field.  Update constructor.
16790         Update call constructor calls.  Add takes_optional_argument
16791         function.
16792         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16793         (DEFINE_optional_string): Define.
16794         (General_options::demangle): Change from DEFINE_bool to
16795         DEFINE_optional_string.
16796         (General_options::no_demangle): New function.
16797         (General_options::do_demangle): New function.
16798         (General_options::set_do_demangle): New function.
16799         (General_options::execstack_status_): Move definition to end of
16800         class definition.
16801         (General_options::static_): Likewise.
16802         (General_options::do_demangle_): New field.
16803         * object.cc (big_endian>::get_symbol_location_info): Call
16804         Options::do_demangle, not Options::demangle.
16805         * symtab.cc (demangle): Likewise.
16806
16807 2008-03-22  Ian Lance Taylor  <iant@google.com>
16808
16809         * gold.h: Include <cstddef> and <sys/types.h>
16810         * options.h: Include <cstring>.
16811
16812 2008-03-21  Ian Lance Taylor  <iant@google.com>
16813
16814         * Added source code to GNU binutils.
16815 \f
16816 Copyright (C) 2008-2015 Free Software Foundation, Inc.
16817
16818 Copying and distribution of this file, with or without modification,
16819 are permitted in any medium without royalty provided the copyright
16820 notice and this notice are preserved.
16821
16822 Local Variables:
16823 mode: change-log
16824 left-margin: 8
16825 fill-column: 74
16826 version-control: never
16827 End: