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