This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/67265] New: [x86] 'asm' operand has impossible constraints with -fstack-check
- From: "gnu at JonnyJD dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Aug 2015 00:32:41 +0000
- Subject: [Bug c/67265] New: [x86] 'asm' operand has impossible constraints with -fstack-check
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67265
Bug ID: 67265
Summary: [x86] 'asm' operand has impossible constraints with
-fstack-check
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gnu at JonnyJD dot net
Target Milestone: ---
Host: i686-linux-gnu
Created attachment 36209
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36209&action=edit
minimal working example (C file)
When compiling a 32 bit build of libx264 (on a 64 bit machine) it works in
general, even with PIC.
However the build breaks when I add -fstack-check to CFLAGS.
The failing code is:
int a, b, c, d, e;
int fn1() {
__asm__("" : "+r"(c), "+r"(e), "+r"(d), "+r"(a) : ""(b), "mg"(fn1), "mm"(c));
}
(attached as me.c)
This works:
gcc -O3 -m32 -fPIC -c me.c
This fails (and should work)
gcc -O3 -m32 -fstack-check -fPIC -c me.c
This also works (as a workaround):
gcc -O3 -m32 -fstack-check -c me.c
The error message is:
me.c: In function âfn1â:
me.c:3:3: error: âasmâ operand has impossible constraints
__asm__("" : "+r"(c), "+r"(e), "+r"(d), "+r"(a) : ""(b), "mg"(fn1),
"mm"(c));
^
The related discussion for x264 is here:
https://mailman.videolan.org/pipermail/x264-devel/2015-August/011246.html
The flag -fstack-check is added by default on Arch Linux when building
packages, but also additionally using hardened wrapper, where I also mentioned
the problem:
https://github.com/thestinger/hardening-wrapper/issues/6
I am the maintainer of lib32-libx264 on Arch Linux where the problem came up
originally:
https://aur.archlinux.org/packages/lib32-libx264/