https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113101
--- Comment #3 from Haoxiang Jia <jiahaoxiang.hust at gmail dot com> --- I tried to add the -mcmodel=large option, but the compilation error still exists. # g++ --coverage -mcmodel=large -o test test.cpp /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `gcov_write_block': (.text+0x17): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `gcov_read_words': (.text+0x59): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `gcov_error': (.text+0x1f6): failed to convert GOTPCREL relocation against '__gcov_error_file'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `gcov_write_words': (.text+0x36b): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_rewrite': (.text+0x3d7): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_open': (.text+0x430): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_close': (.text+0x4e8): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `gcov_do_dump': (.text+0x67c): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0x822): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x8c5): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x930): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0xa5e): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0xaad): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0xc18): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0xc75): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0xecd): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0x1377): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x1514): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0x151d): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0x154f): relocation truncated to fit: R_X86_64_PC32 against `.bss' (.text+0x155e): additional relocation overflows omitted from the output (.text+0x1668): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x167f): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x1686): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x16b1): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x16b8): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x1716): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x1724): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x172b): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x1783): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x1791): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax (.text+0x1798): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_write_unsigned': (.text+0x17ef): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_write_counter': (.text+0x1860): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_write_tag_length': (.text+0x18e0): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_seek': (.text+0x1b0f): failed to convert GOTPCREL relocation against '__gcov_var'; relink with --no-relax /usr/lib/gcc/x86_64-linux-gnu/11/libgcov.a(_gcov.o): in function `__gcov_exit': (.text+0x1bd5): failed to convert GOTPCREL relocation against '__gcov_error_file'; relink with --no-relax collect2: error: ld returned 1 exit status