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