This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

RETURN_IN_MEMORY & -fPIC on x86



I've been trying to figure out why the SVR4 and SVR5 x86 targets have
failures in the PIC tests that didn't show up on Linux or OpenServer.  I
don't really understand the code or the issues involved but I got here
by brute force comparison and debugging.  Once I got past blaming the
assembler and the linker, it wasn't terribly hard to find.

i386/i386.h has:
	#define RETURN_IN_MEMORY(TYPE) \
	  ((TYPE_MODE (TYPE) == BLKmode) || int_size_in_bytes (TYPE) > 12)

i386/sysv4.h overrides this with :
	#undef  RETURN_IN_MEMORY(TYPE)
	#define RETURN_IN_MEMORY(TYPE) \
	  (TYPE_MODE (TYPE) == BLKmode)

There is a comment that this is mandated by the ABI.

If I remove that redefinition, I get many tests that now pass in PIC.

> FAIL: gcc.c-torture/execute/921123-2.c execution,  -O0 
54a80,84
> FAIL: gcc.c-torture/execute/930930-2.c execution,  -O1 
> FAIL: gcc.c-torture/execute/930930-2.c execution,  -O2 
> FAIL: gcc.c-torture/execute/930930-2.c execution,  -O2 -g 
> FAIL: gcc.c-torture/execute/930930-2.c execution,  -Os 
> FAIL: gcc.c-torture/execute/940122-1.c execution,  -O2 -fomit-frame-pointer -finline-functions 
61a92,101
> FAIL: gcc.c-torture/execute/complex-1.c execution,  -O0 
> FAIL: gcc.c-torture/execute/complex-1.c execution,  -O1 
> FAIL: gcc.c-torture/execute/complex-1.c execution,  -O2 
> FAIL: gcc.c-torture/execute/complex-1.c execution,  -O2 -g 
> FAIL: gcc.c-torture/execute/complex-1.c execution,  -Os 
> FAIL: gcc.c-torture/execute/complex-2.c execution,  -O0 
> FAIL: gcc.c-torture/execute/complex-2.c execution,  -O1 
> FAIL: gcc.c-torture/execute/complex-2.c execution,  -O2 
> FAIL: gcc.c-torture/execute/complex-2.c execution,  -O2 -g 
> FAIL: gcc.c-torture/execute/complex-2.c execution,  -Os 
74a115,118
> FAIL: gcc.c-torture/execute/nestfunc-1.c execution,  -O1 
> FAIL: gcc.c-torture/execute/nestfunc-1.c execution,  -O2 
> FAIL: gcc.c-torture/execute/nestfunc-1.c execution,  -O2 -g 
> FAIL: gcc.c-torture/execute/nestfunc-1.c execution,  -Os 

[ and perhaps a few others.   I was stupid in my testcase. ] 

Can anyone comment on the appropriateness of this definition and its use
in function.c on the SVR4/x86 ABI when generating PIC?  I don't know
if the SVR4/x86-specific definition of RETURN_IN_MEMORY is necessary,
incorrect, or if we're just triggering some nastiness somewhere else.

I'd like it to pass the testsuite, but I'd also like it to not bomb in
the real world becuase the calling convention mismatches those of the
system.


RJL