Comment 17 for bug 1940029

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

My original case was in Impish and later.
I see the patch you applied and I see that it changes based on the presence of -m16

Due to linking with 16 bit being rather, ... special :-)
I can't use my trivial test that I found back then to be sure.
I thought of re-building qemu against gcc-10 in Focal (but that might hit all kind of other things we do not want to look for).

Gladly all we care is if fcf-protection is effectively set or not - and that we can do without the weird 16 bit linking.

Pre-fix:
root@f2:~# gcc-10 -Q -v -march=i486 -m16 -Wall -Werror test.c -o test.o |& grep -e fcf -e "GNU C17"
 /usr/lib/gcc/x86_64-linux-gnu/10/cc1 -v -imultiarch x86_64-linux-gnu test.c -dumpbase test.c -march=i486 -m16 -auxbase test -Wall -Werror -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc6LBUMj.s
GNU C17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)
GNU C17 (Ubuntu 10.3.0-1ubuntu1~20.04) version 10.3.0 (x86_64-linux-gnu)
 -Wformat-security -fstack-clash-protection -fcf-protection

Post-fix:
root@f:~# gcc-10 -Q -v -march=i486 -m16 -Wall -Werror test.c -o test.o |& grep -e fcf -e "GNU C17"
GNU C17 (Ubuntu 10.5.0-1ubuntu1~20.04) version 10.5.0 (x86_64-linux-gnu)
GNU C17 (Ubuntu 10.5.0-1ubuntu1~20.04) version 10.5.0 (x86_64-linux-gnu)

So you see that with the fix in the -m16 case "-fcf-protection" is gone.
\o/

BTW as I found above in theory we'd also want to disable that for march=i486 in general?
But if that is a bug worth addressing (split it to a new one then) is up to you.