Overhaul relocation framework to support overflow checking.
[external/binutils.git] / gold / ChangeLog
1 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
2
3         PR gold/18695
4         * reloc.h (Relocate_functions::Address): New typedef.
5         (Relocate_functions::Addendtype): New typedef.
6         (Relocate_functions::Overflow_check): New enum type.
7         (Relocate_functions::Reloc_status): New enum type.
8         (Relocate_functions::check_overflow): New function template.
9         (Relocate_functions::rel): Add check parameter; check for overflow.
10         (Relocate_functions::rel_unaligned): Likewise.
11         (Relocate_functions::rela): Likewise.
12         (Relocate_functions::pcrel): Likewise.
13         (Relocate_functions::pcrel_unaligned): Likewise.
14         (Relocate_functions::pcrela): Likewise.
15         (Relocate_functions::rel8): Adjust parameter types.
16         (Relocate_functions::rela8): Likewise.
17         (Relocate_functions::pcrel8): Likewise.
18         (Relocate_functions::pcrela8): Likewise.
19         (Relocate_functions::rel16): Likewise.
20         (Relocate_functions::rela168): Likewise.
21         (Relocate_functions::pcrel16): Likewise.
22         (Relocate_functions::pcrela16): Likewise.
23         (Relocate_functions::rel32): Likewise.
24         (Relocate_functions::rel32_unaligned): Likewise.
25         (Relocate_functions::rela32): Likewise.
26         (Relocate_functions::pcrel32): Likewise.
27         (Relocate_functions::pcrel32_unaligned): Likewise.
28         (Relocate_functions::pcrela32): Likewise.
29         (Relocate_functions::rel8_check): New function.
30         (Relocate_functions::rela8_check): New function.
31         (Relocate_functions::pcrel8_check): New function.
32         (Relocate_functions::pcrela8_check): New function.
33         (Relocate_functions::rel16_check): New function.
34         (Relocate_functions::rela168_check): New function.
35         (Relocate_functions::pcrel16_check): New function.
36         (Relocate_functions::pcrela16_check): New function.
37         (Relocate_functions::rel32_check): New function.
38         (Relocate_functions::rel32_unaligned_check): New function.
39         (Relocate_functions::rela32_check): New function.
40         (Relocate_functions::pcrel32_check): New function.
41         (Relocate_functions::pcrel32_unaligned_check): New function.
42         (Relocate_functions::pcrela32_check): New function.
43         (Bits::has_unsigned_overflow32): New function.
44         (Bits::has_unsigned_overflow): New function.
45         * testsuite/Makefile.am (overflow_unittest): New test.
46         * testsuite/Makefile.in: Regenerate.
47         * testsuite/overflow_unittest.cc: New source file.
48
49 2016-02-04  Alan Modra  <amodra@gmail.com>
50
51         * powerpc.cc (relocate): Adjust last patch for big-endian.
52
53 2016-02-02  Alan Modra  <amodra@gmail.com>
54
55         * powerpc.cc (relocate): Further restrict ELFv2 entry optimization.
56
57 2016-01-15 Han Shen  <shenhan@google.com>
58
59         PR gold/19472 - need pc-relative stubs.
60
61         * aarch64.cc (Reloc_stub::stub_type_for_reloc): Return PC-relative
62         stub type for DSOs and pie executables.
63
64 2016-01-12  H.J. Lu  <hongjiu.lu@intel.com>
65
66         * i386.cc (Target_i386::Classify_reloc::get_r_addend): Remove
67         'typename'.
68
69 2016-01-12  Cary Coutant  <ccoutant@gmail.com>
70
71         * arm.cc (Target_arm::Classify_reloc::get_r_addend): New method.
72         * i386.cc (Target_i386::Classify_reloc::get_r_addend): New method.
73         * mips.cc (Target_arm::Mips_classify_reloc::get_r_addend): (Both
74         specializations) New method.
75
76 2016-01-11  Cary Coutant  <ccoutant@gmail.com>
77
78         PR gold/19353
79         * aarch64.cc (Target_aarch64::relocate_tls): Don't insist that
80         we have a TLS segment for GD-to-IE optimization.
81         * i386.cc (Target_i386::tls_gd_to_ie): Remove tls_segment parameter.
82         Adjust all calls.
83         (Target_i386::tls_desc_gd_to_ie): Likewise.
84         (Target_i386::relocate_tls): Don't insist that we have a TLS segment
85         for TLSDESC GD-to-IE optimizations.
86         * x86_64.cc (Target_x86_64::tls_gd_to_ie): Remove tls_segment parameter.
87         Adjust all calls.
88         (Target_x86_64::tls_desc_gd_to_ie): Likewise.
89         (Target_x86_64::relocate_tls): Don't insist that we have a TLS segment
90         for TLSDESC GD-to-IE optimizations.
91
92 2016-01-11  Cary Coutant  <ccoutant@gmail.com>
93
94         Refactor gold to enable support for MIPS-64 relocation format.
95
96         * gc.h (get_embedded_addend_size): Remove sh_type parameter.
97         (gc_process_relocs): Remove sh_type template parameter.
98         Use Classify_reloc to access r_sym, r_type, and r_addend fields.
99         * object.h (Sized_relobj_file::split_stack_adjust): Add target
100         parameter.
101         (Sized_relobj_file::split_stack_adjust_reltype): Likewise.
102         * reloc-types.h (Reloc_types::copy_reloc_addend): (SHT_REL and SHT_RELA
103         specializations) Remove.
104         * reloc.cc (Emit_relocs_strategy): Rename and move to target-reloc.h.
105         (Sized_relobj_file::emit_relocs_scan): Call Target::emit_relocs_scan().
106         (Sized_relobj_file::emit_relocs_scan_reltype): Remove.
107         (Sized_relobj_file::split_stack_adjust): Add target parameter.
108         Adjust all callers.
109         (Sized_relobj_file::split_stack_adjust_reltype): Likewise. Call
110         Target::get_r_sym() to get r_sym field from relocations.
111         (Track_relocs::next_symndx): Call Target::get_r_sym().
112         * target-reloc.h (scan_relocs): Remove sh_type template parameter;
113         add Classify_reloc template parameter.  Use for accessing r_sym and
114         r_type.
115         (relocate_section): Likewise.
116         (Default_classify_reloc): New class (renamed and moved from reloc.cc).
117         (Default_scan_relocatable_relocs): Remove sh_type template parameter.
118         (Default_scan_relocatable_relocs::Reltype): New typedef.
119         (Default_scan_relocatable_relocs::reloc_size): New const.
120         (Default_scan_relocatable_relocs::sh_type): New const.
121         (Default_scan_relocatable_relocs::get_r_sym): New method.
122         (Default_scan_relocatable_relocs::get_r_type): New method.
123         (Default_emit_relocs_strategy): New class.
124         (scan_relocatable_relocs): Replace sh_type template parameter with
125         Scan_relocatable_relocs class.  Use it to access r_sym and r_type
126         fields.
127         (relocate_relocs): Replace sh_type template parameter with
128         Classify_reloc class.  Use it to access r_sym and r_type fields.
129         * target.h (Target::is_call_to_non_split): Replace r_type parameter
130         with pointer to relocation. Adjust all callers.
131         (Target::do_is_call_to_non_split): Likewise.
132         (Target::emit_relocs_scan): New virtual method.
133         (Sized_target::get_r_sym): New virtual method.
134         * target.cc (Target::do_is_call_to_non_split): Replace r_type parameter
135         with pointer to relocation.
136
137         * aarch64.cc (Target_aarch64::emit_relocs_scan): New method.
138         (Target_aarch64::Relocatable_size_for_reloc): Remove.
139         (Target_aarch64::gc_process_relocs): Use Default_classify_reloc.
140         (Target_aarch64::scan_relocs): Likewise.
141         (Target_aarch64::relocate_section): Likewise.
142         (Target_aarch64::Relocatable_size_for_reloc::get_size_for_reloc):
143         Remove.
144         (Target_aarch64::scan_relocatable_relocs): Use Default_classify_reloc.
145         (Target_aarch64::relocate_relocs): Use Default_classify_reloc.
146         * arm.cc (Target_arm::Arm_scan_relocatable_relocs): Remove sh_type
147         template parameter.
148         (Target_arm::emit_relocs_scan): New method.
149         (Target_arm::Relocatable_size_for_reloc): Replace with...
150         (Target_arm::Classify_reloc): ...this.
151         (Target_arm::gc_process_relocs): Use Classify_reloc.
152         (Target_arm::scan_relocs): Likewise.
153         (Target_arm::relocate_section): Likewise.
154         (Target_arm::scan_relocatable_relocs): Likewise.
155         (Target_arm::relocate_relocs): Likewise.
156         * i386.cc (Target_i386::emit_relocs_scan): New method.
157         (Target_i386::Relocatable_size_for_reloc): Replace with...
158         (Target_i386::Classify_reloc): ...this.
159         (Target_i386::gc_process_relocs): Use Classify_reloc.
160         (Target_i386::scan_relocs): Likewise.
161         (Target_i386::relocate_section): Likewise.
162         (Target_i386::scan_relocatable_relocs): Likewise.
163         (Target_i386::relocate_relocs): Likewise.
164         * mips.cc (Mips_scan_relocatable_relocs): Remove sh_type template
165         parameter.
166         (Mips_reloc_types): New class template.
167         (Mips_classify_reloc): New class template.
168         (Target_mips::Reltype): New typedef.
169         (Target_mips::Relatype): New typedef.
170         (Target_mips::emit_relocs_scan): New method.
171         (Target_mips::get_r_sym): New method.
172         (Target_mips::Relocatable_size_for_reloc): Replace with
173         Mips_classify_reloc.
174         (Target_mips::copy_reloc): Use Mips_classify_reloc.
175         (Target_mips::gc_process_relocs): Likewise.
176         (Target_mips::scan_relocs): Likewise.
177         (Target_mips::relocate_section): Likewise.
178         (Target_mips::scan_relocatable_relocs): Likewise.
179         (Target_mips::relocate_relocs): Likewise.
180         (mips_get_size_for_reloc): New function, factored out from
181         Relocatable_size_for_reloc::get_size_for_reloc.
182         (Target_mips::Scan::local): Use Mips_classify_reloc.
183         (Target_mips::Scan::global): Likewise.
184         (Target_mips::Relocate::relocate): Likewise.
185         * powerpc.cc (Target_powerpc::emit_relocs_scan): New method.
186         (Target_powerpc::Relocatable_size_for_reloc): Remove.
187         (Target_powerpc::gc_process_relocs): Use Default_classify_reloc.
188         (Target_powerpc::scan_relocs): Likewise.
189         (Target_powerpc::relocate_section): Likewise.
190         (Powerpc_scan_relocatable_reloc): Convert to class template.
191         (Powerpc_scan_relocatable_reloc::Reltype): New typedef.
192         (Powerpc_scan_relocatable_reloc::reloc_size): New const.
193         (Powerpc_scan_relocatable_reloc::sh_type): New const.
194         (Powerpc_scan_relocatable_reloc::get_r_sym): New method.
195         (Powerpc_scan_relocatable_reloc::get_r_type): New method.
196         (Target_powerpc::scan_relocatable_relocs): Use
197         Powerpc_scan_relocatable_reloc.
198         (Target_powerpc::relocate_relocs): Use Default_classify_reloc.
199         * s390.cc (Target_s390::emit_relocs_scan): New method.
200         (Target_s390::Relocatable_size_for_reloc): Remove.
201         (Target_s390::gc_process_relocs): Use Default_classify_reloc.
202         (Target_s390::scan_relocs): Likewise.
203         (Target_s390::relocate_section): Likewise.
204         (Target_s390::Relocatable_size_for_reloc::get_size_for_reloc):
205         Remove.
206         (Target_s390::scan_relocatable_relocs): Use Default_classify_reloc.
207         (Target_s390::relocate_relocs): Use Default_classify_reloc.
208         * sparc.cc (Target_sparc::emit_relocs_scan): New method.
209         (Target_sparc::Relocatable_size_for_reloc): Remove.
210         (Target_sparc::gc_process_relocs): Use Default_classify_reloc.
211         (Target_sparc::scan_relocs): Likewise.
212         (Target_sparc::relocate_section): Likewise.
213         (Target_sparc::Relocatable_size_for_reloc::get_size_for_reloc):
214         Remove.
215         (Target_sparc::scan_relocatable_relocs): Use Default_classify_reloc.
216         (Target_sparc::relocate_relocs): Use Default_classify_reloc.
217         * tilegx.cc (Target_tilegx::emit_relocs_scan): New method.
218         (Target_tilegx::Relocatable_size_for_reloc): Remove.
219         (Target_tilegx::gc_process_relocs): Use Default_classify_reloc.
220         (Target_tilegx::scan_relocs): Likewise.
221         (Target_tilegx::relocate_section): Likewise.
222         (Target_tilegx::Relocatable_size_for_reloc::get_size_for_reloc):
223         Remove.
224         (Target_tilegx::scan_relocatable_relocs): Use Default_classify_reloc.
225         (Target_tilegx::relocate_relocs): Use Default_classify_reloc.
226         * x86_64.cc (Target_x86_64::emit_relocs_scan): New method.
227         (Target_x86_64::Relocatable_size_for_reloc): Remove.
228         (Target_x86_64::gc_process_relocs): Use Default_classify_reloc.
229         (Target_x86_64::scan_relocs): Likewise.
230         (Target_x86_64::relocate_section): Likewise.
231         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
232         Remove.
233         (Target_x86_64::scan_relocatable_relocs): Use Default_classify_reloc.
234         (Target_x86_64::relocate_relocs): Use Default_classify_reloc.
235
236         * testsuite/testfile.cc (Target_test::emit_relocs_scan): New method.
237
238 2016-01-01  Alan Modra  <amodra@gmail.com>
239
240         Update year range in copyright notice of all files.
241
242 For older changes see ChangeLog-0815
243 \f
244 Copyright (C) 2016 Free Software Foundation, Inc.
245
246 Copying and distribution of this file, with or without modification,
247 are permitted in any medium without royalty provided the copyright
248 notice and this notice are preserved.
249
250 Local Variables:
251 mode: change-log
252 left-margin: 8
253 fill-column: 74
254 version-control: never
255 End: