https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95604
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Matthias Klose from comment #0) > Building the example from PR93966 with the -fcf-protection flag in the > compile step, but not in the link step, I get the error triggered by the -z > option. > > $ cat x.c > #include <stdio.h> > > int > main () > { > printf ("hello\n"); > return 0; > } > > $ gcc-10 -flto -fcf-protection -c x.c > $ gcc-10 -flto x.o -Wl,-z,cet-report=error > /usr/bin/ld: /tmp/ccM08n28.ltrans0.ltrans.o: error: missing IBT and SHSTK > properties > collect2: error: ld returned 1 exit status > > Isn't the lto link step supposed to pick up the compilation options from the > compile step? > > An objdump -w -s --section=.gnu.lto_.opts x.o > shows that this option is recorded, however I don't see it printed out in > the link step, even when calling gcc with -v. > > An unrelated question: why is the compile step from PR93966 not called with > -fcf-protection? -fcf-protection is a codegen option. I think -flto -fcf-protection at the final link is sufficient to enable CET.