Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jun 2001 02:16:48 +0900 (JST)
From:      kaz@kobe1995.net (NAKAMURA Kazushi)
To:        obrien@FreeBSD.ORG
Cc:        Alexander@Leidinger.net, sobomax@FreeBSD.ORG, current@FreeBSD.ORG, djhill@novagate.net
Subject:   Re: GNU ld(1) dumps core
Message-ID:  <200106261716.CAA02226@ns.kobe1995.net>
In-Reply-To: Your message of "Tue, 26 Jun 2001 07:23:57 -0700". <20010626072357.B11396@dragon.nuxi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <20010626072357.B11396@dragon.nuxi.com>
obrien@FreeBSD.ORG writes:
>> Oops. I wanted to say: Every software which has a problem with ld
>> dumping core uses nasm (so far). The core dump is a bug in ld, but I
>> didn't know if the condition which triggers the core dump is a problem
>> with nasm, the input of nasm, or a bug in ld.
>
>If someone could provide me with the minal input to nasm which then fed
>to `ld' dumps core, it would really speed up a fix. :-)

Not only nasm, but also gas has same problem. In case of 
ports/audio/gogo and ports/audio/lame, nasm outputs object which
make ld dumps core. While gcc+gas outputs object which can't link
by ld. I think the problem occures when "SSE instructions" and
"align" are used. (Unfortunatry, most SSE instructions need
16Byte(=128bit) alined operands.) For example:
==> bug.C <==
/* test program for SSE by kaz @ kobe1995.net
	% c++ -g bug.C && ./a.out
  But it fails. So,
	% c++ -g -S bug.C
  And change loop.s to avoid bug of gcc (may be):
	 #APP
	-       movaps ($A.15),%xmm0
	-       movaps ($B.16),%xmm1
	+       movaps A.15,%xmm0
	+       movaps B.16,%xmm1
	 #NO_APP
	% c++ loop.s && ./a.out
*/

#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>

main(){
static float __attribute__((aligned(16)))
	A[4]={1.,1.,1.,1.},
	B[4]={0.,1.,2.,3.},
	C[4];

	int i;

	printf("float A=(");
	for(i=0;i<4;i++)	printf("%f,",A[i]);
	printf("\b)\n");

	printf("float B=(");
	for(i=0;i<4;i++)	printf("%f,",B[i]);
	printf("\b)\n");

	asm("movaps (%0),%%xmm0"				//SSE
	:
	:"g"(A));
	asm("movaps (%0),%%xmm1"				//SSE
	:
	:"g"(B));

	asm("addps %xmm1,%xmm0");				//SSE
//	asm("mulps %xmm1,%xmm0");				//SSE
	asm("movaps %%xmm0,%0":"=g"(C));			//SSE
	printf("float C=(");
	for(i=0;i<4;i++)	printf("%f,",C[i]);
	printf("\b)\n");
}
-- 
<mailto:kaz@kobe1995.net>	NAKAMURA Kazushi@KOBE
<http://kobe1995.net/~kaz/index-e.html>;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106261716.CAA02226>