[lld] [lld][LoongArch] Support the R_LARCH_{ADD,SUB}_ULEB128 relocation types (PR #81133)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 00:05:06 PST 2024


================
@@ -153,6 +154,23 @@ static bool isJirl(uint32_t insn) {
   return (insn & 0xfc000000) == JIRL;
 }
 
+static void handleUleb128(uint8_t *loc, uint64_t val) {
+  const char *err = nullptr;
+  const uint32_t maxcount = 1 + (config->is64 ? 64 : 32) / 7;
+  uint32_t count;
+  uint64_t orig = decodeULEB128(loc, &count, nullptr, &err);
+  if (err)
+    fatal(getErrorLocation(loc) + "could not decode uleb128 value: " + err);
----------------
MaskRay wrote:

when `end` is nullptr, we only get an error when the uleb128 value is malformed in the content. This is not tested, and probably not interesting anyway. So just remove the check?

https://github.com/llvm/llvm-project/pull/81133


More information about the llvm-commits mailing list