solaris build problem with Sun compilers - Mailing list pgsql-ports

From Alan Stange
Subject solaris build problem with Sun compilers
Date
Msg-id 44638DE3.6040507@rentec.com
Whole thread Raw
Responses Re: solaris build problem with Sun compilers
List pgsql-ports
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

pgsql-ports by date:

Previous
From: Mark Campbell
Date:
Subject: Re: Compiling on 8.1.3 on Openserver 5.05
Next
From: Tom Lane
Date:
Subject: Re: Compiling on 8.1.3 on Openserver 5.05