Index: llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp =================================================================== --- llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp +++ llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp @@ -550,16 +550,13 @@ int64_t Addend = Rel.r_addend; if (Type == llvm::ELF::R_RISCV_ALIGN) { - uint64_t Alignment = PowerOf2Ceil(Addend); + uint64_t Alignment = NextPowerOf2(Addend); // FIXME: Implement support for ensuring alignment together with linker - // relaxation; 2 bytes are guaranteed by the length of compressed - // instructions, so this does not need any action from our side. - if (Alignment > 2) - return make_error( - formatv("Unsupported relocation R_RISCV_ALIGN with alignment {0} " - "larger than 2 (addend: {1})", - Alignment, Addend)); - return Error::success(); + // relaxation + return make_error( + formatv("Unsupported relocation R_RISCV_ALIGN with alignment {0} " + "(offset: {1}, addend: {2})", + Alignment, Rel.r_offset, Addend)); } Expected Kind = getRelocationKind(Type);