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

            Bug ID: 95604
           Summary: LTO doesn't pick up -fcf-protection flag for the link
                    step
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at debian dot org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

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?

Reply via email to