JAL 1Mib jump

I get the below error:
relocation truncated to fit: R_RISCV_JAL

when I try to jump to 1Mib using JAL.
How to resolve this.

jal 1f
jal x5, 2f
.fill (1024*1024),1,0
#more code

You need to review and understand the capabilities of the RISC-V JAL instruction and then take steps to deal with the limitations of the “jump distance” - e.g. by “trampolining” or similar if necessary. Alternatively, write your code in a high level language such as C/C++ and let the compiler/linker deal with the issue.