@@ -989,8 +989,8 @@ bool RelocationScanner::isStaticLinkTimeConstant(RelExpr e, RelType type,
989989 // only the low bits are used.
990990 if (e == R_GOT || e == R_PLT)
991991 return ctx.target ->usesOnlyLowPageBits (type) || !ctx.arg .isPic ;
992- // R_AARCH64_AUTH_ABS64 requires a dynamic relocation.
993- if (e == RE_AARCH64_AUTH)
992+ // R_AARCH64_AUTH_ABS64 and iRelSymbolicRel require a dynamic relocation.
993+ if (e == RE_AARCH64_AUTH || type == ctx. target -> iRelSymbolicRel )
994994 return false ;
995995
996996 // The behavior of an undefined weak reference is implementation defined.
@@ -1163,6 +1163,23 @@ void RelocationScanner::processAux(RelExpr expr, RelType type, uint64_t offset,
11631163 }
11641164 return ;
11651165 }
1166+ if (LLVM_UNLIKELY (type == ctx.target ->iRelSymbolicRel )) {
1167+ if (sym.isPreemptible ) {
1168+ auto diag = Err (ctx);
1169+ diag << " relocation " << type
1170+ << " cannot be used against preemptible symbol '" << &sym << " '" ;
1171+ printLocation (diag, *sec, sym, offset);
1172+ } else if (isIfunc) {
1173+ auto diag = Err (ctx);
1174+ diag << " relocation " << type
1175+ << " cannot be used against ifunc symbol '" << &sym << " '" ;
1176+ printLocation (diag, *sec, sym, offset);
1177+ } else {
1178+ part.relaDyn ->addReloc ({ctx.target ->iRelativeRel , sec, offset, false ,
1179+ sym, addend, R_ABS});
1180+ return ;
1181+ }
1182+ }
11661183 part.relaDyn ->addSymbolReloc (rel, *sec, offset, sym, addend, type);
11671184
11681185 // MIPS ABI turns using of GOT and dynamic relocations inside out.
0 commit comments