Don't allow COPY relocations for protected symbols.
[external/binutils.git] / gold / ChangeLog
1 2016-05-19  Cary Coutant  <ccoutant@gmail.com>
2
3         PR gold/19823
4         * copy-relocs.cc (Copy_relocs::make_copy_reloc): Add object
5         parameter; check for protected symbol.
6         * copy-relocs.h (Copy_relocs::make_copy_reloc): Add object parameter.
7         * mips.cc (Mips_copy_relocs): Adjust call to make_copy_reloc.
8         * symtab.cc (Symbol::init_fields): Initialize is_protected_.
9         (Symbol_table::add_from_dynobj): Mark protected symbols.
10         * symtab.h (Symbol::is_protected): New method.
11         (Symbol::set_is_protected): New method.
12         (Symbol::is_protected_): New data member.
13
14         * testsuite/Makefile.am (copy_test_protected): New test.
15         * testsuite/Makefile.in: Regenerate.
16         * testsuite/copy_test.cc (main): Add legal reference to protected
17         symbol.
18         * testsuite/copy_test_v1.cc (main): Likewise.
19         * testsuite/copy_test_2.cc (ip): Add protected symbol.
20         * testsuite/copy_test_protected.cc: New test source file.
21         * testsuite/copy_test_protected.sh: New test script.
22
23 2016-05-19  Vladimir Radosavljevic  <vladimir.radosavljevic@imgtec.com>
24
25         * mips.cc (Mips_got_entry::Mips_got_entry): Remove object argument
26         for global got symbols, and set addend to 0.
27         (Mips_got_entry::hash): Change hash algorithm.
28         (Mips_got_entry::equals): Refactor.
29         (Mips_got_entry::object): Return input object for local got symbols
30         from union d.
31         (Mips_got_entry::addend): Change return of the relocation addend.
32         (Mips_got_entry::addend_): Move from union d.
33         (Mips_got_entry::object_): Move into union d.
34         (class Mips_symbol_hash): New class.
35         (Mips_got_info::Global_got_entry_set): New type.
36         (Mips_got_info::global_got_symbols): Change return type to
37         Global_got_entry_set.
38         (Mips_got_info::global_got_symbols_): Change type to
39         Global_got_entry_set.
40         (Mips_symbol::hash): New method.
41         (Mips_output_data_la25_stub::symbols_): Change type to std::vector.
42         (Mips_output_data_mips_stubs::Mips_stubs_entry_set): New type.
43         (Mips_output_data_mips_stubs::symbols_): Change type to
44         Mips_stubs_entry_set.
45         (Mips_got_info::record_global_got_symbol): Don't pass object
46         argument when creating global got symbol.
47         (Mips_got_info::record_got_entry): Remove find before inserting
48         got entries.
49         (Mips_got_info::add_reloc_only_entries): Change type of iterator
50         to Global_got_entry_set.
51         (Mips_got_info::count_got_symbols): Likewise.
52         (Mips_output_data_la25_stub::create_la25_stub): Use push_back
53         for adding entries to symbols_.
54         (Mips_output_data_la25_stub::do_write): Change type of iterator
55         to std::vector.
56         (Mips_output_data_mips_stubs::set_lazy_stub_offsets): Change type
57         of iterator to Mips_stubs_entry_set.
58         (Mips_output_data_mips_stubs::set_needs_dynsym_value): Likewise.
59         (Mips_output_data_mips_stubs::do_write): Likewise.
60
61 2016-05-06  Han Shen  <shenhan@google.com>
62
63         PR gold/19987.
64
65         * aarch64-reloc.def: New relocation type.
66         * aarch64.cc (AArch64_relocate_functions::Page): Changed to public.
67         (Target_aarch64::Scan::local): Add R_AARCH64_LD64_GOTPAGE_LO15.
68         (Target_aarch64::Scan::global): Add R_AARCH64_LD64_GOTPAGE_LO15.
69         (Target_aarch64::Relocate::relocate): Implement R_AARCH64_LD64_GOTPAGE_LO15.
70
71 2016-04-28  Nick Clifton  <nickc@redhat.com>
72
73         * po/zh_CN.po: Updated Chinese (simplified) translation.
74
75 2016-04-15  H.J. Lu  <hongjiu.lu@intel.com>
76
77         * Makefile.in: Regenerated with automake 1.11.6.
78         * aclocal.m4: Likewise.
79         * testsuite/Makefile.in: Likewise.
80
81 2016-03-30  Cary Coutant  <ccoutant@gmail.com>
82
83         PR gold/16979
84         * symtab.cc (Symbol_table::define_default_version): Check for case
85         where symbols are both in different shared objects.
86
87 2016-03-27  Cary Coutant  <ccoutant@gmail.com>
88
89         PR gold/16111
90         * i386.cc (Target_i386): Add check for fully-resolved symbol for
91         R_386_GOTOFF.
92
93 2016-03-22  Nick Clifton  <nickc@redhat.com>
94
95         * configure: Regenerate.
96
97 2016-03-21  Cary Coutant  <ccoutant@gmail.com>
98
99         PR gold/19842
100         * errors.cc (Errors::undefined_symbol): Add info message when
101         symbol should have been provided by a plugin.
102         * target-reloc.h (issue_undefined_symbol_error): Check for
103         placeholder symbols defined in discarded sections.
104         * testsuite/Makefile.am (plugin_test_9b): New test case.
105         * testsuite/Makefile.in: Regenerate.
106         * testsuite/plugin_test_9b_elf.cc: New test source file.
107         * testsuite/plugin_test_9b_ir.cc: New test source file.
108
109 2016-03-20  Cary Coutant  <ccoutant@gmail.com>
110
111         PR gold/19002
112         * ehframe.cc (Eh_frame::read_fde): Check for dropped functions.
113         * testsuite/Makefile.am (eh_test_2): New test.
114         * testsuite/Makefile.in: Regenerate.
115         * testsuite/eh_test_2.sh: New test script.
116         * testsuite/eh_test_a.cc (bar): Make it comdat.
117         * testsuite/eh_test_b.cc (bar): Add a duplicate copy.
118
119 2016-03-18  Vladimir Radosavljevic  <vladimir.radosavljevic@imgtec.com>
120
121         * mips.cc (Mips_relobj::is_n64_): Remove.
122         (Target_mips::ei_class_): Likewise.
123         (Mips_relobj::is_newabi): Call methods.
124         (Mips_relobj::is_n64): Change checking for N64 ABI.
125         (Target_mips::is_output_n64): Likewise.
126         (Target_mips::merge_processor_specific_flags): Remove ei_class
127         argument, and remove comparing ei_class.
128         (Target_mips::do_adjust_elf_header): Remove setting EI_CLASS field
129         of the ELF header.
130         (Target_mips::do_finalize_sections): Don't pass ei_class argument
131         to merge_processor_specific_flags.
132         (Target_mips::elf_mips_abi_name): Remove ei_class argument, and
133         change checking for N64 ABI.
134
135 2016-03-17  Vladimir Radosavljevic  <vladimir.radosavljevic@imgtec.com>
136
137         * mips.cc (enum Special_relocation_symbol): New enum type.
138         (is_readonly_section): New function.
139         (eh_reloc): Likewise.
140         (Mips_got_entry::is_section_symbol_): New member.
141         (Mips_got_entry::is_section_symbol): New method.
142         (Mips_got_info::record_local_got_symbol): Add is_section_symbol
143         argument.
144         (Mips_relobj::mips_elf_options_section_name): New method.
145         (Mips_output_data_got::record_local_got_symbol): Add
146         is_section_symbol argument, and pass it to
147         Mips_got_info::record_local_got_symbol.
148         (Mips_output_data_got::got_offset): Add addend argument, and pass
149         it to Relobj::local_got_offset.
150         (struct Mips_output_reloc_writer): New type.
151         (class Mips_output_data_reloc): New class.
152         (Mips_output_data_plt::Reloc_section): Change type to
153         Mips_output_data_reloc.
154         (Target_mips::Reloc_section): Likewise.
155         (Mips_reloc_types::get_r_addend): Remove unsigned from return type.
156         (Mips_classify_reloc::get_r_type2): New method.
157         (Mips_classify_reloc::get_r_type3): Likewise.
158         (Mips_classify_reloc::get_r_ssym): Likewise.
159         (Target_mips::Reloca_section): Remove.
160         (Relocate::should_apply_static_reloc): Rename from
161         should_apply_r_mips_32_reloc.
162         (Target_mips::copy_reloc): Replace Reltype parameter with r_type
163         and r_offset.
164         (Mips_relocate_functions::Valtype): New type.
165         (Mips_relocate_functions::Valtype64): New type.
166         (Mips_relocate_functions::check_overflow): New method.
167         (Mips_relocate_functions::mips_reloc_unshuffle): Move to public
168         interface.
169         (Mips_relocate_functions::mips_reloc_shuffle): Likewise.
170         (Mips_relocate_functions::rel16): Add support for resolving
171         relocations for Mips64.
172         (Mips_relocate_functions::rel32): Likewise.
173         (Mips_relocate_functions::reljalr): Likewise.
174         (Mips_relocate_functions::relpc32): Likewise.
175         (Mips_relocate_functions::rel26): Likewise.
176         (Mips_relocate_functions::relpc16): Likewise.
177         (Mips_relocate_functions::relmicromips_pc7_s1): Likewise.
178         (Mips_relocate_functions::relmicromips_pc10_s1): Likewise.
179         (Mips_relocate_functions::relmicromips_pc16_s1): Likewise.
180         (Mips_relocate_functions::do_relhi16): Likewise.
181         (Mips_relocate_functions::do_relgot16_local): Likewise.
182         (Mips_relocate_functions::rello16): Likewise.
183         (Mips_relocate_functions::relgot): Likewise.
184         (Mips_relocate_functions::relgotpage): Likewise.
185         (Mips_relocate_functions::relgotofst): Likewise.
186         (Mips_relocate_functions::relgot_hi16): Likewise.
187         (Mips_relocate_functions::relgot_lo16): Likewise.
188         (Mips_relocate_functions::relgprel): Likewise.
189         (Mips_relocate_functions::relgprel32): Likewise.
190         (Mips_relocate_functions::tlsrelhi16): Likewise.
191         (Mips_relocate_functions::tlsrello16): Likewise.
192         (Mips_relocate_functions::tlsrel32): Likewise.
193         (Mips_relocate_functions::relsub): Likewise.
194         (Mips_relocate_functions::releh): New method.
195         (Mips_relocate_functions::rel64): Likewise.
196         (Mips_got_info::record_local_got_symbol): Add is_section_symbol and
197         pass it to Mips_got_entry.
198         (Mips_got_info::add_local_entries): Pass addend argument
199         to code functions, and for STT_SECTION symbols call
200         add_symbolless_local_addend.
201         (Mips_got_info::add_tls_entries): Pass addend argument to code
202         functions.
203         (Mips_relobj::do_read_symbols): Read gp value that was used to
204         create object.
205         (Mips_output_data_plt::plt_entry): Remove opcode from l[wd]
206         instruction. Opcode for instruction will be selected later.
207         (Target_mips::gc_process_relocs): Add case for SHT_RELA.
208         (Target_mips::scan_relocatable_relocs): Likewise.
209         (Target_mips::emit_relocs_scan): Likewise.
210         (Target_mips::relocate_relocs): Likewise.
211         (Target_mips::do_finalize_sections): Skip objects for merging
212         processor specific flags in which all input sections will be
213         discarded.
214         (mips_get_size_for_reloc): Add case for R_MIPS_EH.
215         (Target_mips::Scan::get_reference_flags): Likewise.
216         (Target_mips::relocate_special_relocatable): Call rel26 method with
217         calculate_only and calculated_value arguments.
218         (Target_mips::Scan::local): Add case for R_MIPS_EH. Don't create a
219         dynamic relocation against a readonly sections, and pass
220         is_section_symbol to Mips_got_info::record_local_got_symbol.
221         (Target_mips::Scan::global): Add case for R_MIPS_EH. Don't create a
222         dynamic relocation against a readonly sections, and pass r_type
223         and r_offset to Target_mips::copy_reloc.
224         (Target_mips::Relocate::relocate): Add support for resolving
225         relocations for Mips64.
226         (Target_mips::mips_info): Add case for Mips64 default dynamic
227         linker name.
228         (Target_selector_mips): Correct emulation names.
229
230 2016-03-17  Vladimir Radosavljevic  <vladimir.radosavljevic@imgtec.com>
231
232         * mips.cc (class Mips_output_data_la25_stub): Add
233         do_print_to_mapfile function.
234
235 2016-03-17  Vladimir Radosavljevic  <vladimir.radosavljevic@imgtec.com>
236
237         * mips.cc (Mips_classify_reloc::put_r_info): Call 32bit version of
238         elf_r_info.
239
240 2016-03-09  H.J. Lu  <hongjiu.lu@intel.com>
241
242         * testsuite/plugin_layout_with_alignment.cc: Renamed to ..
243         * testsuite/plugin_layout_with_alignment.c: This.
244         * testsuite/Makefile.am (plugin_layout_with_alignment.o): Updated.
245         (plugin_layout_with_alignment): Likewise.
246         * testsuite/Makefile.in: Regenerated.
247
248 2016-03-08  Cary Coutant  <ccoutant@gmail.com>
249
250         PR 19751
251         * testsuite/Makefile.am (retain_symbols_file_test): Remove check
252         for constructor.
253         * testsuite/Makefile.in: Regenerate.
254         * testsuite/dynamic_list.sh: Likewise.
255         * testsuite/retain_symbols_file_test.sh: Likewise.
256
257 2016-03-08  Cary Coutant  <ccoutant@gmail.com>
258
259         PR 19751
260         * arm.cc (Reloc_stub::Key::name): Add unused attribute.
261         * dirsearch.cc (Dir_caches::~Dir_caches): Likewise.
262
263 2016-03-08  Cary Coutant  <ccoutant@gmail.com>
264             Vladimir Radosavljevic  <vladimir.radosavljevic@imgtec.com>
265
266         * output.cc (Output_reloc_writer): New type.
267         (Output_data_reloc_base::do_write): Move implementation to template
268         in output.h and replace with invocation of template.
269         * output.h (Output_file): Move to top of file.
270         (Output_reloc::get_symbol_index): Move to public interface.
271         (Output_reloc::get_address): Likewise.
272         (Output_data_reloc_base::do_write_generic): New function template.
273
274 2016-03-04  Cary Coutant  <ccoutant@gmail.com>
275
276         PR gold/19019
277         PR gold/19763
278         * symtab.cc: Instantiate Sized_symbol::init_constant and
279         Sized_symbol::init_undefined.
280
281 2016-03-03  Cary Coutant  <ccoutant@gmail.com>
282
283         PR gold/19019
284         * layout.h (Layout::add_target_specific_dynamic_tag): New function.
285         * layout.cc (Layout::add_target_specific_dynamic_tag): New function.
286         * mips.cc (Target_mips::make_symbol): Adjust function signature.
287         * sparc.cc (Target_sparc::Target_sparc): Initialize register_syms_.
288         (Target_sparc::do_is_defined_by_abi): Remove test for
289         STT_SPARC_REGISTER.
290         (Target_sparc::Register_symbol): New struct type.
291         (Target_sparc::register_syms_): New data member.
292         (Target_sparc<64, true>::sparc_info): Set has_make_symbol to true.
293         (Target_sparc::make_symbol): New function.
294         (Target_sparc::do_finalize_sections): Add register symbols and new
295         dynamic table entries.
296         * symtab.h (Sized_symbol::init_undefined): Add value parameter.
297         (Symbol_table::add_target_global_symbol): New function.
298         (Symbol_table::target_symbols_): New data member.
299         * symtab.cc (Sized_symbol::init_undefined): Add value parameter.
300         (Symbol_table::Symbol_table): Initialize target_symbols_.
301         (Symbol_table::add_from_object): Pass additional parameters to
302         Target::make_symbol.
303         (Symbol_table::define_special_symbol): Likewise.
304         (Symbol_table::add_undefined_symbol_from_command_line): Pass 0 for
305         undefined symbol value.
306         (Symbol_table::set_dynsym_indexes): Process target-specific symbols.
307         (Symbol_table::sized_finalize): Likewise.
308         (Symbol_table::sized_write_globals): Likewise.
309         * target.h (Sized_target::make_symbol): Add name, st_type, object,
310         st_shndx, and value parameters.
311
312 2016-03-03  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
313
314         * plugin.cc (do_should_include_member): Ignore LDPK_UNDEF and
315         LDPK_WEAKUNDEF symbols.
316
317 2016-03-03  Than McIntosh  <thanm@google.com>
318
319         * plugin.cc (Plugin::load): Include hooks for get_input_section_size
320         and get_input_section_alignment in transfer vector.
321         (get_input_section_alignment): New function.
322         (get_input_section_size): New function.
323         * testsuite/Makefile.am: Add plugin_layout_with_alignment.sh test.
324         * testsuite/Makefile.in: [Regenerate.]
325         * testsuite/plugin_section_alignment.cc: New test file.
326         * testsuite/plugin_layout_with_alignment.cc: New test file.
327         * testsuite/plugin_layout_with_alignment.sh: New test file.
328
329 2016-03-03  Evgenii Stepanov  <eugenis@google.com>
330
331         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
332         parameter.
333         * plugin.cc (get_symbols_v3): New function.
334         (Plugin::load): Add LDPT_GET_SYMBOLS_V3.
335         (Pluginobj::get_symbol_resolution_info): Return LDPS_NO_SYMS when using
336         new version.
337
338 2016-02-26  Egor Kochetov  <egor.kochetov@intel.com>
339             Cary Coutant  <ccoutant@gmail.com>
340
341         PR gold/19735
342         * ehframe.h (Cie::fde_encoding): New method.
343         * ehframe.cc (Eh_frame::read_fde): Discard FDEs for zero-length
344         address ranges.
345
346 2016-02-15  H.J. Lu  <hongjiu.lu@intel.com>
347
348         * testsuite/Makefile.am (x86_64_mov_to_lea5.o): Pass
349         -mrelax-relocations=yes to $(TEST_AS).
350         (x86_64_mov_to_lea6.o): Likewise.
351         (x86_64_overflow_pc32.o): Remove duplicated target.
352         * testsuite/Makefile.in: Regenerated.
353
354 2016-02-15  Marcin Kościelnicki  <koriakin@0x04.net>
355
356         * s390.cc (Target_s390::match_view_u): New helper method.
357         (Target_s390::do_is_call_to_non_split): New method.
358         (Target_s390::ss_code_st_r14): New const.
359         (Target_s390::ss_code_l_r14): New const.
360         (Target_s390::ss_code_bras_8): New const.
361         (Target_s390::ss_code_l_basr): New const.
362         (Target_s390::ss_code_a_basr): New const.
363         (Target_s390::ss_code_ear): New const.
364         (Target_s390::ss_code_c): New const.
365         (Target_s390::ss_code_larl): New const.
366         (Target_s390::ss_code_brasl): New const.
367         (Target_s390::ss_code_jg): New const.
368         (Target_s390::ss_code_jgl): New const.
369         (Target_s390::ss_match_mcount): New helper method.
370         (Target_s390::ss_match_l): New helper method.
371         (Target_s390::ss_match_ahi): New helper method.
372         (Target_s390::ss_match_alfi): New helper method.
373         (Target_s390::ss_match_cr): New helper method.
374         (Target_s390::do_calls_non_split): New method.
375         * testsuite/Makefile.am: Added new tests.
376         * testsuite/Makefile.in: Regenerate.
377         * testsuite/split_s390.sh: New test.
378         * testsuite/split_s390_1_a1.s: New test.
379         * testsuite/split_s390_1_a2.s: New test.
380         * testsuite/split_s390_1_n1.s: New test.
381         * testsuite/split_s390_1_n2.s: New test.
382         * testsuite/split_s390_1_z1.s: New test.
383         * testsuite/split_s390_1_z2.s: New test.
384         * testsuite/split_s390_1_z3.s: New test.
385         * testsuite/split_s390_1_z4.s: New test.
386         * testsuite/split_s390_2_ns.s: New test.
387         * testsuite/split_s390_2_s.s: New test.
388         * testsuite/split_s390x_1_a1.s: New test.
389         * testsuite/split_s390x_1_a2.s: New test.
390         * testsuite/split_s390x_1_n1.s: New test.
391         * testsuite/split_s390x_1_n2.s: New test.
392         * testsuite/split_s390x_1_z1.s: New test.
393         * testsuite/split_s390x_1_z2.s: New test.
394         * testsuite/split_s390x_1_z3.s: New test.
395         * testsuite/split_s390x_1_z4.s: New test.
396         * testsuite/split_s390x_2_ns.s: New test.
397         * testsuite/split_s390x_2_s.s: New test.
398
399 2016-02-11 Rahul Chaudhry  <rahulchaudhry@google.com>
400
401         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Remove
402         info message for every erratum 843419 found and fixed.
403
404 2016-02-07  Cary Coutant  <ccoutant@gmail.com>
405
406         PR gold/18695
407         * x86_64.cc (Target_x86_64::Relocate::relocate): Add additional
408         information to relocation overflow errors.
409
410 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
411
412         PR gold/18695
413         * x86_64.cc (X86_64_relocate_functions::pcrela32_check): Fix x32
414         overflow checking when symbol value + addend < 0.
415
416 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
417
418         PR gold/19577
419         * reloc.h (Limits): New class.
420         (Bits::has_overflow32): Use min/max values from Limits.
421         (Bits::has_unsigned_overflow32): Likewise.
422         (Bits::has_signed_unsigned_overflow32): Likewise.
423         (Bits::has_overflow): Likewise.
424         (Bits::has_unsigned_overflow): Likewise.
425         (Bits::has_signed_unsigned_overflow64): Likewise.
426
427 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
428
429         PR gold/19567
430         * reloc.h (Relocate_functions::Overflow_check): Add comments.
431         * x86_64.cc (X86_64_relocate_functions): New class.
432         (Target_x86_64::Relocate::relocate): Use the new class.
433         * testsuite/Makefile.am (x86_64_overflow_pc32): Add -Tdata option.
434         (x32_overflow_pc32): New test case.
435         * testsuite/Makefile.in: Regenerate.
436         * testsuite/x32_overflow_pc32.sh: New script.
437         * testsuite/x86_64_overflow_pc32.s: Remove .space directive.
438
439 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
440
441         PR gold/19577
442         * reloc.h (Bits::has_unsigned_overflow32): Fix static_cast.
443         (Bits::has_unsigned_overflow): Remove unnecessary static_cast.
444
445 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
446
447         PR gold/19577
448         * reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed
449         comparison.
450         (Bits::has_unsigned_overflow): Likewise.
451
452 2016-02-06  Marcin Kościelnicki  <koriakin@0x04.net>
453
454         * i386.cc (Target_i386::is_call_to_non_split): Add view and view_size
455         parameters.
456         * reloc.cc (Sized_relobj_file::split_stack_adjust_reltype): Pass view
457         and view_size to is_call_to_non_split.
458         * target.cc (Target::is_call_to_non_split): Add view and view_size
459         parameters.
460         * target.h (class Target): Likewise.
461
462 2016-02-05  Sriraman Tallam  <tmsriram@google.com>
463
464         * icf.cc (get_rel_addend): New function.
465         (get_section_contents):  Move merge section addend computation to a
466         new function.  Ignore negative values for SHT_REL and SHT_RELA addends.
467         Fix bug to not read past the length of the section.
468
469 2016-02-05  Cary Coutant  <ccoutant@gmail.com>
470             Andrew Senkevich  <andrew.senkevich@intel.com>
471
472         PR gold/18695
473         * x86_64.cc (Target_x86_64::Relocate::relocate): Add overflow
474         checking for R_X86_64_32, R_X86_64_32S, R_X86_64_PC32, and
475         R_X86_64_PLT32.
476         * testsuite/Makefile.am (x86_64_overflow_pc32): New test.
477         * testsuite/x86_64_overflow_pc32.sh: New test script.
478         * testsuite/x86_64_overflow_pc32.s: New source file.
479
480 2016-02-05  Cary Coutant  <ccoutant@gmail.com>
481
482         PR gold/18695
483         * reloc.h (Relocate_functions::Address): New typedef.
484         (Relocate_functions::Addendtype): New typedef.
485         (Relocate_functions::Overflow_check): New enum type.
486         (Relocate_functions::Reloc_status): New enum type.
487         (Relocate_functions::check_overflow): New function template.
488         (Relocate_functions::rel): Add check parameter; check for overflow.
489         (Relocate_functions::rel_unaligned): Likewise.
490         (Relocate_functions::rela): Likewise.
491         (Relocate_functions::pcrel): Likewise.
492         (Relocate_functions::pcrel_unaligned): Likewise.
493         (Relocate_functions::pcrela): Likewise.
494         (Relocate_functions::rel8): Adjust parameter types.
495         (Relocate_functions::rela8): Likewise.
496         (Relocate_functions::pcrel8): Likewise.
497         (Relocate_functions::pcrela8): Likewise.
498         (Relocate_functions::rel16): Likewise.
499         (Relocate_functions::rela168): Likewise.
500         (Relocate_functions::pcrel16): Likewise.
501         (Relocate_functions::pcrela16): Likewise.
502         (Relocate_functions::rel32): Likewise.
503         (Relocate_functions::rel32_unaligned): Likewise.
504         (Relocate_functions::rela32): Likewise.
505         (Relocate_functions::pcrel32): Likewise.
506         (Relocate_functions::pcrel32_unaligned): Likewise.
507         (Relocate_functions::pcrela32): Likewise.
508         (Relocate_functions::rel8_check): New function.
509         (Relocate_functions::rela8_check): New function.
510         (Relocate_functions::pcrel8_check): New function.
511         (Relocate_functions::pcrela8_check): New function.
512         (Relocate_functions::rel16_check): New function.
513         (Relocate_functions::rela168_check): New function.
514         (Relocate_functions::pcrel16_check): New function.
515         (Relocate_functions::pcrela16_check): New function.
516         (Relocate_functions::rel32_check): New function.
517         (Relocate_functions::rel32_unaligned_check): New function.
518         (Relocate_functions::rela32_check): New function.
519         (Relocate_functions::pcrel32_check): New function.
520         (Relocate_functions::pcrel32_unaligned_check): New function.
521         (Relocate_functions::pcrela32_check): New function.
522         (Bits::has_unsigned_overflow32): New function.
523         (Bits::has_unsigned_overflow): New function.
524         * testsuite/Makefile.am (overflow_unittest): New test.
525         * testsuite/Makefile.in: Regenerate.
526         * testsuite/overflow_unittest.cc: New source file.
527
528 2016-02-04  Alan Modra  <amodra@gmail.com>
529
530         * powerpc.cc (relocate): Adjust last patch for big-endian.
531
532 2016-02-02  Alan Modra  <amodra@gmail.com>
533
534         * powerpc.cc (relocate): Further restrict ELFv2 entry optimization.
535
536 2016-01-15 Han Shen  <shenhan@google.com>
537
538         PR gold/19472 - need pc-relative stubs.
539
540         * aarch64.cc (Reloc_stub::stub_type_for_reloc): Return PC-relative
541         stub type for DSOs and pie executables.
542
543 2016-01-12  H.J. Lu  <hongjiu.lu@intel.com>
544
545         * i386.cc (Target_i386::Classify_reloc::get_r_addend): Remove
546         'typename'.
547
548 2016-01-12  Cary Coutant  <ccoutant@gmail.com>
549
550         * arm.cc (Target_arm::Classify_reloc::get_r_addend): New method.
551         * i386.cc (Target_i386::Classify_reloc::get_r_addend): New method.
552         * mips.cc (Target_arm::Mips_classify_reloc::get_r_addend): (Both
553         specializations) New method.
554
555 2016-01-11  Cary Coutant  <ccoutant@gmail.com>
556
557         PR gold/19353
558         * aarch64.cc (Target_aarch64::relocate_tls): Don't insist that
559         we have a TLS segment for GD-to-IE optimization.
560         * i386.cc (Target_i386::tls_gd_to_ie): Remove tls_segment parameter.
561         Adjust all calls.
562         (Target_i386::tls_desc_gd_to_ie): Likewise.
563         (Target_i386::relocate_tls): Don't insist that we have a TLS segment
564         for TLSDESC GD-to-IE optimizations.
565         * x86_64.cc (Target_x86_64::tls_gd_to_ie): Remove tls_segment parameter.
566         Adjust all calls.
567         (Target_x86_64::tls_desc_gd_to_ie): Likewise.
568         (Target_x86_64::relocate_tls): Don't insist that we have a TLS segment
569         for TLSDESC GD-to-IE optimizations.
570
571 2016-01-11  Cary Coutant  <ccoutant@gmail.com>
572
573         Refactor gold to enable support for MIPS-64 relocation format.
574
575         * gc.h (get_embedded_addend_size): Remove sh_type parameter.
576         (gc_process_relocs): Remove sh_type template parameter.
577         Use Classify_reloc to access r_sym, r_type, and r_addend fields.
578         * object.h (Sized_relobj_file::split_stack_adjust): Add target
579         parameter.
580         (Sized_relobj_file::split_stack_adjust_reltype): Likewise.
581         * reloc-types.h (Reloc_types::copy_reloc_addend): (SHT_REL and SHT_RELA
582         specializations) Remove.
583         * reloc.cc (Emit_relocs_strategy): Rename and move to target-reloc.h.
584         (Sized_relobj_file::emit_relocs_scan): Call Target::emit_relocs_scan().
585         (Sized_relobj_file::emit_relocs_scan_reltype): Remove.
586         (Sized_relobj_file::split_stack_adjust): Add target parameter.
587         Adjust all callers.
588         (Sized_relobj_file::split_stack_adjust_reltype): Likewise. Call
589         Target::get_r_sym() to get r_sym field from relocations.
590         (Track_relocs::next_symndx): Call Target::get_r_sym().
591         * target-reloc.h (scan_relocs): Remove sh_type template parameter;
592         add Classify_reloc template parameter.  Use for accessing r_sym and
593         r_type.
594         (relocate_section): Likewise.
595         (Default_classify_reloc): New class (renamed and moved from reloc.cc).
596         (Default_scan_relocatable_relocs): Remove sh_type template parameter.
597         (Default_scan_relocatable_relocs::Reltype): New typedef.
598         (Default_scan_relocatable_relocs::reloc_size): New const.
599         (Default_scan_relocatable_relocs::sh_type): New const.
600         (Default_scan_relocatable_relocs::get_r_sym): New method.
601         (Default_scan_relocatable_relocs::get_r_type): New method.
602         (Default_emit_relocs_strategy): New class.
603         (scan_relocatable_relocs): Replace sh_type template parameter with
604         Scan_relocatable_relocs class.  Use it to access r_sym and r_type
605         fields.
606         (relocate_relocs): Replace sh_type template parameter with
607         Classify_reloc class.  Use it to access r_sym and r_type fields.
608         * target.h (Target::is_call_to_non_split): Replace r_type parameter
609         with pointer to relocation. Adjust all callers.
610         (Target::do_is_call_to_non_split): Likewise.
611         (Target::emit_relocs_scan): New virtual method.
612         (Sized_target::get_r_sym): New virtual method.
613         * target.cc (Target::do_is_call_to_non_split): Replace r_type parameter
614         with pointer to relocation.
615
616         * aarch64.cc (Target_aarch64::emit_relocs_scan): New method.
617         (Target_aarch64::Relocatable_size_for_reloc): Remove.
618         (Target_aarch64::gc_process_relocs): Use Default_classify_reloc.
619         (Target_aarch64::scan_relocs): Likewise.
620         (Target_aarch64::relocate_section): Likewise.
621         (Target_aarch64::Relocatable_size_for_reloc::get_size_for_reloc):
622         Remove.
623         (Target_aarch64::scan_relocatable_relocs): Use Default_classify_reloc.
624         (Target_aarch64::relocate_relocs): Use Default_classify_reloc.
625         * arm.cc (Target_arm::Arm_scan_relocatable_relocs): Remove sh_type
626         template parameter.
627         (Target_arm::emit_relocs_scan): New method.
628         (Target_arm::Relocatable_size_for_reloc): Replace with...
629         (Target_arm::Classify_reloc): ...this.
630         (Target_arm::gc_process_relocs): Use Classify_reloc.
631         (Target_arm::scan_relocs): Likewise.
632         (Target_arm::relocate_section): Likewise.
633         (Target_arm::scan_relocatable_relocs): Likewise.
634         (Target_arm::relocate_relocs): Likewise.
635         * i386.cc (Target_i386::emit_relocs_scan): New method.
636         (Target_i386::Relocatable_size_for_reloc): Replace with...
637         (Target_i386::Classify_reloc): ...this.
638         (Target_i386::gc_process_relocs): Use Classify_reloc.
639         (Target_i386::scan_relocs): Likewise.
640         (Target_i386::relocate_section): Likewise.
641         (Target_i386::scan_relocatable_relocs): Likewise.
642         (Target_i386::relocate_relocs): Likewise.
643         * mips.cc (Mips_scan_relocatable_relocs): Remove sh_type template
644         parameter.
645         (Mips_reloc_types): New class template.
646         (Mips_classify_reloc): New class template.
647         (Target_mips::Reltype): New typedef.
648         (Target_mips::Relatype): New typedef.
649         (Target_mips::emit_relocs_scan): New method.
650         (Target_mips::get_r_sym): New method.
651         (Target_mips::Relocatable_size_for_reloc): Replace with
652         Mips_classify_reloc.
653         (Target_mips::copy_reloc): Use Mips_classify_reloc.
654         (Target_mips::gc_process_relocs): Likewise.
655         (Target_mips::scan_relocs): Likewise.
656         (Target_mips::relocate_section): Likewise.
657         (Target_mips::scan_relocatable_relocs): Likewise.
658         (Target_mips::relocate_relocs): Likewise.
659         (mips_get_size_for_reloc): New function, factored out from
660         Relocatable_size_for_reloc::get_size_for_reloc.
661         (Target_mips::Scan::local): Use Mips_classify_reloc.
662         (Target_mips::Scan::global): Likewise.
663         (Target_mips::Relocate::relocate): Likewise.
664         * powerpc.cc (Target_powerpc::emit_relocs_scan): New method.
665         (Target_powerpc::Relocatable_size_for_reloc): Remove.
666         (Target_powerpc::gc_process_relocs): Use Default_classify_reloc.
667         (Target_powerpc::scan_relocs): Likewise.
668         (Target_powerpc::relocate_section): Likewise.
669         (Powerpc_scan_relocatable_reloc): Convert to class template.
670         (Powerpc_scan_relocatable_reloc::Reltype): New typedef.
671         (Powerpc_scan_relocatable_reloc::reloc_size): New const.
672         (Powerpc_scan_relocatable_reloc::sh_type): New const.
673         (Powerpc_scan_relocatable_reloc::get_r_sym): New method.
674         (Powerpc_scan_relocatable_reloc::get_r_type): New method.
675         (Target_powerpc::scan_relocatable_relocs): Use
676         Powerpc_scan_relocatable_reloc.
677         (Target_powerpc::relocate_relocs): Use Default_classify_reloc.
678         * s390.cc (Target_s390::emit_relocs_scan): New method.
679         (Target_s390::Relocatable_size_for_reloc): Remove.
680         (Target_s390::gc_process_relocs): Use Default_classify_reloc.
681         (Target_s390::scan_relocs): Likewise.
682         (Target_s390::relocate_section): Likewise.
683         (Target_s390::Relocatable_size_for_reloc::get_size_for_reloc):
684         Remove.
685         (Target_s390::scan_relocatable_relocs): Use Default_classify_reloc.
686         (Target_s390::relocate_relocs): Use Default_classify_reloc.
687         * sparc.cc (Target_sparc::emit_relocs_scan): New method.
688         (Target_sparc::Relocatable_size_for_reloc): Remove.
689         (Target_sparc::gc_process_relocs): Use Default_classify_reloc.
690         (Target_sparc::scan_relocs): Likewise.
691         (Target_sparc::relocate_section): Likewise.
692         (Target_sparc::Relocatable_size_for_reloc::get_size_for_reloc):
693         Remove.
694         (Target_sparc::scan_relocatable_relocs): Use Default_classify_reloc.
695         (Target_sparc::relocate_relocs): Use Default_classify_reloc.
696         * tilegx.cc (Target_tilegx::emit_relocs_scan): New method.
697         (Target_tilegx::Relocatable_size_for_reloc): Remove.
698         (Target_tilegx::gc_process_relocs): Use Default_classify_reloc.
699         (Target_tilegx::scan_relocs): Likewise.
700         (Target_tilegx::relocate_section): Likewise.
701         (Target_tilegx::Relocatable_size_for_reloc::get_size_for_reloc):
702         Remove.
703         (Target_tilegx::scan_relocatable_relocs): Use Default_classify_reloc.
704         (Target_tilegx::relocate_relocs): Use Default_classify_reloc.
705         * x86_64.cc (Target_x86_64::emit_relocs_scan): New method.
706         (Target_x86_64::Relocatable_size_for_reloc): Remove.
707         (Target_x86_64::gc_process_relocs): Use Default_classify_reloc.
708         (Target_x86_64::scan_relocs): Likewise.
709         (Target_x86_64::relocate_section): Likewise.
710         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
711         Remove.
712         (Target_x86_64::scan_relocatable_relocs): Use Default_classify_reloc.
713         (Target_x86_64::relocate_relocs): Use Default_classify_reloc.
714
715         * testsuite/testfile.cc (Target_test::emit_relocs_scan): New method.
716
717 2016-01-01  Alan Modra  <amodra@gmail.com>
718
719         Update year range in copyright notice of all files.
720
721 For older changes see ChangeLog-0815
722 \f
723 Copyright (C) 2016 Free Software Foundation, Inc.
724
725 Copying and distribution of this file, with or without modification,
726 are permitted in any medium without royalty provided the copyright
727 notice and this notice are preserved.
728
729 Local Variables:
730 mode: change-log
731 left-margin: 8
732 fill-column: 74
733 version-control: never
734 End: