[PORTS] solaris build problem with Sun compilers

Alan Stange <[email protected]> Thu, 11 May 2006 15:17:55 -0400
Newsgroups gmane.comp.db.postgresql.ports
Organization Renaissance Technologies Corp.
Message-ID <[email protected]>
Hello all,

it appears that there's a problem building postgresql with 
--enable-debug on Solaris with the Sun compilers.

noisy$ /opt/spro11/SUNWspro/bin/cc -Xa -v -DSUNOS4_CC 
-I../../../../src/include -g -c s_lock.c
/opt/spro11/SUNWspro/prod/bin/fbe: "/tmp/yabeAAAdBaiW5", line 484: 
error: can't compute difference between symbols in different segments
Failure in /opt/spro11/SUNWspro/prod/bin/fbe, status = 0x100
Fatal Error exec'ing /opt/spro11/SUNWspro/prod/bin/fbe
cc: acomp failed for s_lock.c

It appears that explicitly adding "-xO0" to the compile statement 
resolves this problem.  In fact, any optimization level seems to make 
this error go away which is why it's not seen in a normal build.

The core of the problem seems to be a
.size tas_dummy,(.-tas_dummy)
directive which is emitted by the compiler.

Without the any -xO specifier this directive ends up in a different 
.section due to the two .section directives in the s_lock.c code. 
Adding any -xO options relocates the code so that the section mismatch 
isn't a problem.


This brings up the question:    why are the two .section directives 
there at all in s_lock.c:299?

	asm(".section \"data\"");
         asm(".section \"text\"");

I don't see what they add and they're confusing assembler (fbe 
actually).   The data section obviously isn't needed and given this code 
is already nested in a function, the text section is redundant too.


Anyway, seems we have two solutions:

1) explicitly specify a -xO0 option along with -g
or
2) remove the .section specifiers


Comments?

-- Alan

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings