#996659 gcc-11: static-pie cause link failure

Package:
gcc-11
Source:
gcc-11
Description:
GNU C compiler
Submitter:
Ryutaroh Matsumoto
Date:
2021-10-16 23:51:04 UTC
Severity:
normal
#996659#5
Date:
2021-10-16 23:46:21 UTC
From:
To:
Dear Maintainer,

gcc-11 -static -fPIE -static-pie hello.c  causes the following link failure:

/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/crtbeginT.o: warning: relocation against `__deregister_frame_info' in read-only section `.rodata.cst8'
/usr/bin/ld: read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status

On the other hand, clang-13 can handle the same situation better as below:

$ clang-13 -static -fPIE -static-pie hello.c
$ ./a.out
hello world!

Best regards, Ryutaroh Matsumoto