From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3876 invoked by alias); 25 Nov 2011 19:33:29 -0000 Received: (qmail 3860 invoked by uid 22791); 25 Nov 2011 19:33:28 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Nov 2011 19:33:14 +0000 From: "pcpa at mandriva dot com.br" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/47602] Permit inline asm to clobber PIC register Date: Fri, 25 Nov 2011 20:20:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pcpa at mandriva dot com.br X-Bugzilla-Status: REOPENED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-11/txt/msg02524.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D47602 Paulo C=C3=A9sar Pereira de Andrade changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pcpa at mandriva dot com.br --- Comment #14 from Paulo C=C3=A9sar Pereira de Andrade 2011-11-25 19:22:09 UTC --- In a first try on updating to valgrind 3.7.0 I run into this: make[3]: Entering directory `/home/pcpa/rpm/BUILD/valgrind-3.7.0/coregrind' x86_64-mandriva-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../VEX/pub -DVGA_x86=3D1 -DVGO_linux=3D1 -DVGP_x86_linux=3D1 -DVGPV_x86_linux_vanilla=3D1 -I../coregrind -DVG_LIBDIR=3D"\"/usr/lib64/val= grind"\" -DVG_PLATFORM=3D"\"x86-linux\"" -m32 -O2 -g -Wall -Wmissing-prototypes -Ws= hadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -Wno-long-long -O= 2 -g -frecord-gcc-switches -Wstrict-aliasing=3D2 -pipe -Wformat -Werror=3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2 -fstack-protector --param=3Dssp-buffer-size=3D4 -fPIC -Wno-pointer-sign -fno-stack-protector = -MT libcoregrind_x86_linux_a-syswrap-linux.o -MD -MP -MF .deps/libcoregrind_x86_linux_a-syswrap-linux.Tpo -c -o libcoregrind_x86_linux_a-syswrap-linux.o `test -f 'm_syswrap/syswrap-linux.= c' || echo './'`m_syswrap/syswrap-linux.c m_syswrap/syswrap-linux.c: In function 'run_a_thread_NORETURN': m_syswrap/syswrap-linux.c:202:7: error: PIC register clobbered by 'ebx' in 'asm' make[3]: *** [libcoregrind_x86_linux_a-syswrap-linux.o] Error 1 The code is like this: static void run_a_thread_NORETURN ( Word tidW ) [...] /* We have to use this sequence to terminate the thread to prevent a subtle race. If VG_(exit_thread)() had left the ThreadState as Empty, then it could have been reallocated, reusing the stack while we're doing these last cleanups. Instead, VG_(exit_thread) leaves it as Zombie to prevent reallocation. We need to make sure we don't touch the stack between marking it Empty and exiting. Hence the assembler. */ #if defined(VGP_x86_linux) asm volatile ( "movl %1, %0\n" /* set tst->status =3D VgTs_Empty */ "movl %2, %%eax\n" /* set %eax =3D __NR_exit */ "movl %3, %%ebx\n" /* set %ebx =3D tst->os_state.exitcode */ "int $0x80\n" /* exit(tst->os_state.exitcode) */ : "=3Dm" (tst->status) : "n" (VgTs_Empty), "n" (__NR_exit), "m" (tst->os_state.exitcode) : "eax", "ebx" ); #elif defined(VGP_amd64_linux) In valgrind 3.6.1 it works because it does not tell about the clobbered registers.