solaris build problem with Sun compilers

From: Alan Stange <stange(at)rentec(dot)com>
To: pgsql-ports(at)postgresql(dot)org
Subject: solaris build problem with Sun compilers
Date: 2006-05-11 19:17:55
Message-ID: 44638DE3.6040507@rentec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-ports by date

  From Date Subject
Next Message Tom Lane 2006-05-11 19:24:55 Re: Compiling on 8.1.3 on Openserver 5.05
Previous Message Mark Campbell 2006-05-11 19:11:03 Re: Compiling on 8.1.3 on Openserver 5.05