https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91420

            Bug ID: 91420
           Summary: relocation truncated to fit: R_RISCV_HI20 against
                    `.LC0' with GCC 8.2/8.3 on RISC-V
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bmeng.cn at gmail dot com
  Target Milestone: ---

Created attachment 46700
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46700&action=edit
test case

Please use attached test case "riscv_cpp_test.c" to trigger the bug.

$ riscv64-unknown-linux-gnu-g++ -O2 riscv_cpp_test.c          
/tmp/ccCpODP4.o: In function `.L0 ':
riscv_cpp_test.c:(.text.startup+0x4): relocation truncated to fit: R_RISCV_HI20
against `.LC0'
/share/toolchains/riscv/lib/gcc/riscv64-unknown-linux-gnu/8.2.0/../../../../riscv64-unknown-linux-gnu/bin/ld:
final link failed: Symbol needs debug section which does not exist
collect2: error: ld returned 1 exit status

Workaround: using "-O0" makes the linking procedure happy.

$ riscv64-unknown-linux-gnu-g++ -O0 riscv_cpp_test.c

Reply via email to