File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class AMDGPU final : public TargetInfo {
34
34
RelExpr getRelExpr (RelType type, const Symbol &s,
35
35
const uint8_t *loc) const override ;
36
36
RelType getDynRel (RelType type) const override ;
37
+ int64_t getImplicitAddend (const uint8_t *buf, RelType type) const override ;
37
38
};
38
39
} // namespace
39
40
@@ -183,6 +184,20 @@ RelType AMDGPU::getDynRel(RelType type) const {
183
184
return R_AMDGPU_NONE;
184
185
}
185
186
187
+ int64_t AMDGPU::getImplicitAddend (const uint8_t *buf, RelType type) const {
188
+ switch (type) {
189
+ case R_AMDGPU_NONE:
190
+ return 0 ;
191
+ case R_AMDGPU_ABS64:
192
+ case R_AMDGPU_RELATIVE64:
193
+ return read64 (buf);
194
+ default :
195
+ internalLinkerError (getErrorLocation (buf),
196
+ " cannot read addend for relocation " + toString (type));
197
+ return 0 ;
198
+ }
199
+ }
200
+
186
201
TargetInfo *elf::getAMDGPUTargetInfo () {
187
202
static AMDGPU target;
188
203
return ⌖
Original file line number Diff line number Diff line change @@ -1713,8 +1713,7 @@ static void setConfigs(opt::InputArgList &args) {
1713
1713
// enable the debug checks for all targets, but currently not all targets
1714
1714
// have support for reading Elf_Rel addends, so we only enable for a subset.
1715
1715
#ifndef NDEBUG
1716
- bool checkDynamicRelocsDefault =
1717
- !llvm::is_contained ({EM_AMDGPU, EM_HEXAGON}, m);
1716
+ bool checkDynamicRelocsDefault = m != EM_HEXAGON;
1718
1717
#else
1719
1718
bool checkDynamicRelocsDefault = false ;
1720
1719
#endif
Original file line number Diff line number Diff line change 5
5
# RUN: llvm-nm %t.so | FileCheck %s --check-prefix=NM
6
6
# RUN: llvm-readelf -x .rodata -x nonalloc %t.so | FileCheck %s --check-prefix=HEX
7
7
8
+ ## ABS64 and RELATIVE64 relocs do not cause --check-dynamic-relocations errors.
9
+ # RUN: ld.lld --hash-style=sysv -shared %t.o -o /dev/null --apply-dynamic-relocs
10
+
8
11
.text
9
12
10
13
kernel0:
You can’t perform that action at this time.
0 commit comments