<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/153775>153775</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            BOLT-ERROR: JITLink failed: Unsupported riscv relocation:60: R_RISCV_SET_ULEB128
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zengdage
      </td>
    </tr>
</table>

<pre>
    I use the following code to test `bolt` for risc-v, and run `llvm-bolt test -instrument -o test.instr` to get instrumented elf binary, but it will report a error like `BOLT-ERROR: JITLink failed: Unsupported riscv relocation:60: R_RISCV_SET_ULEB128`.

Build command: `g++ test.cpp -o test -Wl,-znow -Wl,-emit-relocs`
```
#include <iostream>
#include <string>
#include <stdexcept>
#include <vector>

void riskyFunction(int choice) {
    std::cout << "riskyFunction, choice = " << choice << std::endl;

    switch (choice) {
        case 1:
            throw 42;
            break;
        case 2:
            throw std::string("This is a string exception.");
 break;
        default:
            break;
    }
}

int main() {
 int test_case;

    std::cout << "1-2 cause exception:";
    std::cin >> test_case;

    try {
        riskyFunction(test_case);
 std::cout << "riskyFunction run ok" << std::endl;
    }
    catch (int e) {
        std::cout << "int exception: " << e << std::endl;
    }
 catch (const std::string& e) {
        std::cout << "string exception: " << e << std::endl;
    }

    std::cout << "OK" << std::endl;
 return 0;
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VV2P4jYU_TU3L1dBjkMCPOQBmEHadqSR2Nn2cWScS3AxNrId6Oyvr5wwwDJMt63UCAG5H-dcH5_EwnvVGKIKihkUD4low8a66juZphYNJStbv1VfsPWEYUO4tlrbozINSlsTBouBfEAo2crqACXDtXXolJfpAfgchanRtSYWaH3YpbGqb0mV8cG1OzIB0x5m0IUiSLDYUMBLCdVIeo0rZYR7i8CrNqAKeFRao6O9dQEFknPWoVZ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