LINK ERROR: relocation truncated to fit: R_RISCV_JAL against symbol

Yes, there are jal instruction, j pseudoinstruction or conditional branch instruction in these .S files in the following links… Also, there errors generate after I add some new code package into my whole project. Before that it can be built correctly even with -ggdb -O0 options.
context_gcc.S
interrupt_gcc.S
startup_gcc.S

Do these errors mean that the targets of these instructions are beyond the address range they can access? And when options -Os is used, the size of the code is optimized to a smaller one so that those targets fall into the address range of those instructions again? If so, how should I fix it?

Sorry I cannot provide a complete testcase now.