[Bug target/81780] New: -finstrument-control-flow -mcet is incompatible with __attribute__ ((regparm (3)))

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 9 10:56:00 GMT 2017


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

            Bug ID: 81780
           Summary: -finstrument-control-flow -mcet is incompatible with
                    __attribute__ ((regparm (3)))
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: igor.v.tsimbalist at intel dot com
            Blocks: 81652
  Target Milestone: ---
            Target: i386

When -finstrument-control-flow -mcet is used, __attribute__ ((regparm (3)))
can't be used to call external function should is defined in a shared object:

https://sourceware.org/bugzilla/show_bug.cgi?id=21598

But

https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html has

regparm (number)
On x86-32 targets, the regparm attribute causes the compiler to pass arguments
number one to number if they are of integral type in registers EAX, EDX, and
ECX instead of on the stack. Functions that take a variable number of arguments
continue to be passed all of their arguments on the stack.

Beware that on some ELF systems this attribute is unsuitable for global
functions in shared libraries with lazy binding (which is the default). Lazy
binding sends the first call via resolving code in the loader, which might
assume EAX, EDX and ECX can be clobbered, as per the standard calling
conventions. Solaris 8 is affected by this. Systems with the GNU C Library
version 2.1 or higher and FreeBSD are believed to be safe since the loaders
there save EAX, EDX and ECX. (Lazy binding can be disabled with the linker or
the loader if desired, to avoid the problem.)

-finstrument-control-flow -mcet should disallow __attribute__ ((regparm (3)))
on a non-hidden external function declaration.  __attribute__ ((regparm (3)))
should be allowed on external function function body since linker may turn
it a hidden definition at link-time.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81652
[Bug 81652] [meta-bug] -finstrument-control-flow -mcet bugs


More information about the Gcc-bugs mailing list