X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type:content-transfer-encoding; q=dns; s=
	default; b=LCwvI8cWwBHFYk1xudPjyUFKiy6ViXJHjr+ePgFM588wqy+0I5iGh
	5WlDHD9DPPcW5hZJ6gCtUHlEvrCOi/jCSWy9XM4DOIqwVOW35sIkqKPBUmlq9y6h
	GxmoxlmDgLWSpTKvKFWFNIuY9S7/dQeDSsWzoovLUwja3Sj0r1t2AA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type:content-transfer-encoding; s=default;
	 bh=+3pts6cH0m8SycamnuEdBbNrz9o=; b=LdkpMkIDTc4kQgVE9hYo+63/8Rjh
	/1qtxrNsYy3UqqRIuplvKYgjZ6gfPY4knizuJHRJJXe2VI2eEi4zGM0uOoaza4sC
	sOQP1Fmi9exgDWEOr7RdtbIK0GGahFQl/p3vLvccAeIDxZcc2Vft/DWRrpWyGaTD
	x3gSJ+kT4fAaYc0=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: plane.gmane.org
To: cygwin@cygwin.com
From: Jean-Pierre Flori <jpflori@gmail.com>
Subject: Re: Possibly wrong address passed to callq asm instruction within MPIR test binaries
Date: Mon, 7 Apr 2014 14:02:43 +0000 (UTC)
Lines: 67
Message-ID: <lhub63$ie3$9@ger.gmane.org>
References: <20140402090750.GP2508@calimero.vinschen.de>	<lhsctu$56e$1@ger.gmane.org> <20140407084312.GA2061@calimero.vinschen.de>	<lhtqa1$ie3$1@ger.gmane.org> <lhtsb6$ie3$2@ger.gmane.org>	<lhtve5$ie3$4@ger.gmane.org> <lhtvgh$ie3$5@ger.gmane.org>	<lhu212$ie3$6@ger.gmane.org> <20140407113027.GA30595@calimero.vinschen.de>	<lhu3dq$ie3$7@ger.gmane.org> <20140407115730.GA721@calimero.vinschen.de>	<lhu95j$ie3$8@ger.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
X-IsSubscribed: yes

Le Mon, 07 Apr 2014 13:28:19 +0000, Jean-Pierre Flori a écrit :

> Le Mon, 07 Apr 2014 13:57:30 +0200, Corinna Vinschen a écrit :
> 
>> On Apr  7 11:50, Jean-Pierre Flori wrote:
>>> Le Mon, 07 Apr 2014 13:30:27 +0200, Corinna Vinschen a écrit :
>>> > 
>>> > I'm sorry, but I don't know how this works exactly.  The nm prefix
>>> > is only added for external references, not for inlined functions,
>>> > but I don't know the gory details.  You may be better off to ask on
>>> > the gcc mailing list.
>>> > 
>>> No problem, I've already learned tons of stuff thanks to your help.
>>> I've just posted on gcc-help.
>>> http://gcc.gnu.org/ml/gcc-help/2014-04/msg00024.html
>> 
>> Thanks.  A simple testcase would still be nice, of course.
>> 
>> 
> Sure, but it seems the issue is that I cannot get the __nm_ prefix when
> I elaborate on a minimal problem like you did.
> 
> I'll still try to get something this afternoon.
I think I got something:
$ cat > lib.c <<EOF
#include <stdio.h>

int
foo (int a)
{
  printf ("a = %d\n", a);
  return a;
}
EOF
$cat > asm.as <<EOF
global nothing
;export nothing
nothing:
  ret
  end
EOF
$ cat > app.c <<EOF
#include <stdio.h>

extern int foo (int);

int
main ()
{
  int x = foo (42);
  printf ("x = %d\n", x);
  nothing();
  return 0;
}
EOF
$ gcc -g -c lib.c -o lib.o
$ yasm -fx64 asm.as -o asm.o
$ gcc -shared lib.o ams.o -Wl,--out-implib=lib.dll.a -Wl,--export-all-
symbols -o lib.dll
$ gcc -g -o app app.c -L. -llib
$ ./app
...
<segfault>

Without the export directive (commented above) I get __nm_ prefix and 
wrong callq instruction.
With it, the __nm_prefix disappears and the trampoline correctly used.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

