From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18659 invoked by alias); 28 Jun 2004 17:54:47 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18651 invoked from network); 28 Jun 2004 17:54:47 -0000 Received: from unknown (HELO granger.mail.mindspring.net) (207.69.200.148) by sourceware.org with SMTP; 28 Jun 2004 17:54:47 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by granger.mail.mindspring.net with esmtp (Exim 3.33 #1) id 1Bf0L7-0001Gi-00; Mon, 28 Jun 2004 13:54:45 -0400 Received: by berman.michael-chastain.com (Postfix, from userid 502) id 1C1504B104; Mon, 28 Jun 2004 13:55:05 -0400 (EDT) To: gdb-patches@sources.redhat.com Subject: Re: [RFA] testsuite/gdb.arch/i386-prologue.c: Fix compiling on Cygwin Cc: vinschen@redhat.com Message-Id: <20040628175505.1C1504B104@berman.michael-chastain.com> Date: Mon, 28 Jun 2004 17:54:00 -0000 From: mec.gnu@mindspring.com (Michael Elizabeth Chastain) X-SW-Source: 2004-06/txt/msg00644.txt.bz2 > the gdb.arch/i386-prologue.c testcase doesn't compile on Cygwin since > on Cygwin the assenmbler labels need leading underscores to match the > same names in C. The below patch fixes that. I acknowledge the problem, but I don't like to see #ifdef __CYGWIN__ in the middle of i386-prologue.c. So I am declining this patch. Can you add a layer to this? Use a new symbol such as SYMBOL_PREFIX so that i386-prologue.exp can tell i386-prologue.c whether to add a leading underscore or not. In i386-prologue.exp, something like this: # some targets have leading underscores on assembly symbols. # TODO: detect this automatically set additional_flags "" if { [istarget "i?86-*-cygwin*"] { set additional_flags "additional_flags=-DSYMBOL_PREFIX=_" } ... gdb_compile ... executable {debug $additional_flags} ... It would be better to auto-detect the need for a leading underscore, perhaps by compiling a test program. But you don't need to do that for this patch. i386-prologue.exp would look like this. First there is some preprocessor gunk to add "..." around the value of SYMBOL_PREFIX: #define xstringify(arg) stringify(arg) #define stringify(arg) #arg /* add "..." around SYMBOL_PREFIX to make SP_STRING */ #ifdef SYMBOL_PREFIX #define SP_STRING xstringify(SYMBOL_PREFIX) #else #define SP_STRING "" #endif ... Then in the places where you want optional leading underscores, just add SP_STRING to the big asm string. The big asm string already depends on string concatenation so this ought to work fine: " .align 8\n" SP_STRING "gdb1253:\n" " pushl %ebp\n" I'm open to ideas if you have improvements or a different idea. My goal here is that i386-prologue.c does not have any target-specific tests in it. Michael C === * gdb.arch/i386-prologue.c: Conditionalize label names to build on Cygwin.