[Bug driver/103646] New: gcc driver breaks asm ("ebp")

siddhesh at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 10 10:44:55 GMT 2021


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

            Bug ID: 103646
           Summary: gcc driver breaks asm ("ebp")
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at gcc dot gnu.org
  Target Milestone: ---

Tested in rev cf23d58df262c15d7f560078cdcc4570d318bcc1, I haven't bisected the
earliest commit that introduced this.

asm ("ebp") does not seem to work:

struct __timeval64
{
  long long int tv_sec;
  long long int tv_usec;
};

void *
__select64 (struct __timeval64 *t)
{
  register unsigned int _a6 asm ("ebp") = 0;

  asm volatile ("call somefunc" : : "a" ((unsigned int) (t)),
                "r" (_a6) : "memory", "cc");

  t->tv_sec = 0;
  t->tv_usec = 1;
  return 0;
}

$ PATH=$HOME/tools/bin:$PATH gcc -v -fdump-rtl-all -m32 misc/select.c -c -O2
-m32 -mstackrealign -o misc/select.o
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/home/sipoyare/tools
--enable-languages=c,c++,lto --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211201 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-fdump-rtl-all' '-c' '-O2' '-m32' '-mstackrealign'
'-o' 'misc/select.o' '-mtune=generic' '-march=x86-64' '-dumpdir' 'misc/'
 /home/sipoyare/tools/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/cc1 -quiet -v
-imultilib 32 misc/select.c -quiet -dumpdir misc/ -dumpbase select.c
-dumpbase-ext .c -m32 -mstackrealign -mtune=generic -march=x86-64 -O2 -version
-fdump-rtl-all -o /tmp/ccPgSl7u.s
GNU C17 (GCC) version 12.0.0 20211201 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 11.2.1 20210728 (Red Hat 11.2.1-1), GMP
version 6.2.0, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/home/sipoyare/tools/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/sipoyare/tools/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include
 /usr/local/include
 /home/sipoyare/tools/include
 /home/sipoyare/tools/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include-fixed
 /usr/include
End of search list.
GNU C17 (GCC) version 12.0.0 20211201 (experimental) (x86_64-pc-linux-gnu)
        compiled by GNU C version 11.2.1 20210728 (Red Hat 11.2.1-1), GMP
version 6.2.0, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 3bf01b92d0d6f1753efbcaf2846d9076
misc/select.c: In function ‘__select64’:
misc/select.c:18:1: error: bp cannot be used in ‘asm’ here
   18 | }
      | ^

The driver appears to pass -march=x86-64, which results in this error.  Calling
cc1 with -march=i686 (like gcc11 does) results in no error.  Due to this, glibc
build fails for i686.


More information about the Gcc-bugs mailing list