================
@@ -137,6 +137,7 @@ RelExpr AArch64::getRelExpr(RelType type, const Symbol &s,
   switch (type) {
   case R_AARCH64_ABS16:
   case R_AARCH64_ABS32:
+  case R_AARCH64_PATCHINST:
----------------
smithp35 wrote:

If the relocation is used as described in the RFC, with the target symbol 
absolute all looks well. If a non ABS symbol is used in a position independent 
context I think you'll get a recompile with PIC error message. If not position 
independent then I think the relocation will pass through and give a likely 
unpredictable value to patch the instruction.

Could it be worth putting some checking (likely in Relocation.cpp) to make sure 
the target symbol is SHN_ABS?

A related question is whether non-zero addends should be supported? For most 
instructions the addend doesn't make logical sense. There could be some 
instructions where the immediate field is in the right place to make it work, 
but I think these cases may not be worth supporting.

An alternative formulation for RELA is to completely ignore the symbol value 
and just use the bottom 32-bits of the addend field. That would give the object 
producer that defines the relocations more control over what is patched in. Not 
got a strong opinion on whether that is better though.

https://github.com/llvm/llvm-project/pull/133534
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to