Thread: compile problem on a vax

compile problem on a vax

From
"bart sikkes"
Date:
Hello,

I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
1.5, after some problems i am almost there, now i only get these errors
during the final compile:

>gcc -I../include -I../backend -O2 -pipe -Wall -Wmissing-prototypes -Wmissin
g-declarations -o postgres access/SUBSYS.o bootstrap/SUBSYS.o
>catalog/SUBSYS.o commands/SUBSYS.o executor/SUBSYS.o lib/SUBSYS.o
libpq/SUBSYS.o main/SUBSYS.o parser/SUBSYS.o nodes/SUBSYS.o
>optimizer/SUBSYS.o port/SUBSYS.o postmaster/SUBSYS.o regex/SUBSYS.o
rewrite/SUBSYS.o storage/SUBSYS.o tcop/SUBSYS.o >utils/SUBSYS.o
../utils/version.o -lcrypt -lcompat -lm -lutil -ltermcap -lcurses
>access/SUBSYS.o: Undefined symbol `r0' referenced
>storage/SUBSYS.o: Undefined symbol `r0' referenced
>collect2: ld returned 1 exit status
>gmake[1]: *** [postgres] Error 1
>gmake[1]: Leaving directory `/dinges/temp/postgresql-7.0.3/src/backend'
>gmake: *** [all] Error 2

I have change something in /src/include/storage/s_lock.h (because else i
would get another error, saying that slock_t was already defined in os.h):

>#if defined(NEED_VAX_TAS_ASM)
>/*
> * VAXen -- even multiprocessor ones
> * (thanks to Tom Ivar Helbekkmo)
> */
>#define TAS(lock) tas(lock)
>
>typedef unsigned char slock_t; <---- DELETED THIS LINE
>
>static __inline__ int
>tas(volatile slock_t *lock)
>{
>        register        _res;
>
>        __asm__("       movl $1, r0 \
>                        bbssi $0, (%1), 1 f \
>                        clrl r0 \
>1:                      movl r0, %0 "
>:                       "=r"(_res)                      /* return value, in
register */
>:                       "r"(lock)                       /* argument, 'lock
pointer', in register */
>:                       "r0");                          /* inline code uses
this register */
>        return (int) _res;
>}
>
>#endif   /* NEED_VAX_TAS_ASM */

Can anybody help me and explain to me how to fix this?

Are there people here that have any postgresql version running on the vax?
which version do you use and which OS for your vax

thank you,
bart


Re: compile problem on a vax

From
Bruce Momjian
Date:
Do a mailing list search.  Someone did work on a VAX port about a year
ago.  They never got it to work, though.  Sounds like you have problems
with the assembly code.


[ Charset ISO-8859-1 unsupported, converting... ]
> Hello,
>
> I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
> 1.5, after some problems i am almost there, now i only get these errors
> during the final compile:
>
> >gcc -I../include -I../backend -O2 -pipe -Wall -Wmissing-prototypes -Wmissin
> g-declarations -o postgres access/SUBSYS.o bootstrap/SUBSYS.o
> >catalog/SUBSYS.o commands/SUBSYS.o executor/SUBSYS.o lib/SUBSYS.o
> libpq/SUBSYS.o main/SUBSYS.o parser/SUBSYS.o nodes/SUBSYS.o
> >optimizer/SUBSYS.o port/SUBSYS.o postmaster/SUBSYS.o regex/SUBSYS.o
> rewrite/SUBSYS.o storage/SUBSYS.o tcop/SUBSYS.o >utils/SUBSYS.o
> ../utils/version.o -lcrypt -lcompat -lm -lutil -ltermcap -lcurses
> >access/SUBSYS.o: Undefined symbol `r0' referenced
> >storage/SUBSYS.o: Undefined symbol `r0' referenced
> >collect2: ld returned 1 exit status
> >gmake[1]: *** [postgres] Error 1
> >gmake[1]: Leaving directory `/dinges/temp/postgresql-7.0.3/src/backend'
> >gmake: *** [all] Error 2
>
> I have change something in /src/include/storage/s_lock.h (because else i
> would get another error, saying that slock_t was already defined in os.h):
>
> >#if defined(NEED_VAX_TAS_ASM)
> >/*
> > * VAXen -- even multiprocessor ones
> > * (thanks to Tom Ivar Helbekkmo)
> > */
> >#define TAS(lock) tas(lock)
> >
> >typedef unsigned char slock_t; <---- DELETED THIS LINE
> >
> >static __inline__ int
> >tas(volatile slock_t *lock)
> >{
> >        register        _res;
> >
> >        __asm__("       movl $1, r0 \
> >                        bbssi $0, (%1), 1 f \
> >                        clrl r0 \
> >1:                      movl r0, %0 "
> >:                       "=r"(_res)                      /* return value, in
> register */
> >:                       "r"(lock)                       /* argument, 'lock
> pointer', in register */
> >:                       "r0");                          /* inline code uses
> this register */
> >        return (int) _res;
> >}
> >
> >#endif   /* NEED_VAX_TAS_ASM */
>
> Can anybody help me and explain to me how to fix this?
>
> Are there people here that have any postgresql version running on the vax?
> which version do you use and which OS for your vax
>
> thank you,
> bart
>
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: compile problem on a vax

From
Tom Lane
Date:
"bart sikkes" <b.sikkes@student.utwente.nl> writes:
> I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
> 1.5, after some problems i am almost there, now i only get these errors
> during the final compile:

>> gcc -I../include -I../backend -O2 -pipe -Wall -Wmissing-prototypes -Wmissin
> g-declarations -o postgres access/SUBSYS.o bootstrap/SUBSYS.o
>> catalog/SUBSYS.o commands/SUBSYS.o executor/SUBSYS.o lib/SUBSYS.o
> libpq/SUBSYS.o main/SUBSYS.o parser/SUBSYS.o nodes/SUBSYS.o
>> optimizer/SUBSYS.o port/SUBSYS.o postmaster/SUBSYS.o regex/SUBSYS.o
> rewrite/SUBSYS.o storage/SUBSYS.o tcop/SUBSYS.o >utils/SUBSYS.o
> ../utils/version.o -lcrypt -lcompat -lm -lutil -ltermcap -lcurses
>> access/SUBSYS.o: Undefined symbol `r0' referenced
>> storage/SUBSYS.o: Undefined symbol `r0' referenced
>> collect2: ld returned 1 exit status


I'll bet that the assembler is taking the 'r0' references in the TAS()
snippet to be a global-variable name, rather than register name as
intended.  Possibly $0 or %0 or some such locution is needed.

The VAX port has evidently not been used in a long time.  I had noticed
that it was inconsistent with all the other ports in defining slock_t
in s_lock.h rather than in the OS-specific header files; that's clearly
wrong now.

Feel free to submit a patch once you get it worked out.

            regards, tom lane

Re: compile problem on a vax

From
Alfred Perlstein
Date:
* Tom Lane <tgl@sss.pgh.pa.us> [010117 18:14] wrote:
> "bart sikkes" <b.sikkes@student.utwente.nl> writes:
> > I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
> > 1.5, after some problems i am almost there, now i only get these errors
> > during the final compile:
>
> >> gcc -I../include -I../backend -O2 -pipe -Wall -Wmissing-prototypes -Wmissin
> > g-declarations -o postgres access/SUBSYS.o bootstrap/SUBSYS.o
> >> catalog/SUBSYS.o commands/SUBSYS.o executor/SUBSYS.o lib/SUBSYS.o
> > libpq/SUBSYS.o main/SUBSYS.o parser/SUBSYS.o nodes/SUBSYS.o
> >> optimizer/SUBSYS.o port/SUBSYS.o postmaster/SUBSYS.o regex/SUBSYS.o
> > rewrite/SUBSYS.o storage/SUBSYS.o tcop/SUBSYS.o >utils/SUBSYS.o
> > ../utils/version.o -lcrypt -lcompat -lm -lutil -ltermcap -lcurses
> >> access/SUBSYS.o: Undefined symbol `r0' referenced
> >> storage/SUBSYS.o: Undefined symbol `r0' referenced
> >> collect2: ld returned 1 exit status
>
>
> I'll bet that the assembler is taking the 'r0' references in the TAS()
> snippet to be a global-variable name, rather than register name as
> intended.  Possibly $0 or %0 or some such locution is needed.
>
> The VAX port has evidently not been used in a long time.  I had noticed
> that it was inconsistent with all the other ports in defining slock_t
> in s_lock.h rather than in the OS-specific header files; that's clearly
> wrong now.
>
> Feel free to submit a patch once you get it worked out.

It's been a long, long time, but I think r0 is actually a register
name on VAX, dunno if it would cause a conflict, probably depends on
the asm syntax.

--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."

Re: compile problem on a vax

From
Tom Ivar Helbekkmo
Date:
Tom Lane <tgl@sss.pgh.pa.us> writes:

> The VAX port has evidently not been used in a long time.  I had noticed
> that it was inconsistent with all the other ports in defining slock_t
> in s_lock.h rather than in the OS-specific header files; that's clearly
> wrong now.

I did the VAX port, and it worked, once upon a time.  Now, I haven't
had a NetBSD/vax system for a long time, and the surrounding code has
changed.  If noone else does anything about it, I probably will fix it
eventually, but I can't do anything as it now stands.

-tih
--
The basic difference is this: hackers build things, crackers break them.

Re: compile problem on a vax

From
Peter Eisentraut
Date:
bart sikkes writes:

> I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD

The spinlock assembly code for VAX was corrupted during a code indentation
run.  I'll try to remember to fix it over the weekend.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Re: compile problem on a vax

From
Bruce Momjian
Date:
> bart sikkes writes:
>
> > I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
>
> The spinlock assembly code for VAX was corrupted during a code indentation
> run.  I'll try to remember to fix it over the weekend.

Oh, no.  That is terrible.  This the first I heard about it.  Any idea
when it happened so I can fix it?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: compile problem on a vax

From
Bruce Momjian
Date:
> bart sikkes writes:
>
> > I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
>
> The spinlock assembly code for VAX was corrupted during a code indentation
> run.  I'll try to remember to fix it over the weekend.

OK, here is the fix:

    __asm__("   movl $1, r0 \
            bbssi $0, (%1), 1f \
                            ^^
            clrl r0 \


The old pgindent had a bug with numbers followed by a letter, '1f -> '1 f'.

The new version I have fixes that problem, and I verified that the VAX
ASM doesn't change under the new pgindent.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: compile problem on a vax

From
Bruce Momjian
Date:
Also, the current pgindent README has:

  find . -name '*.[ch]' -type f -print | egrep -v '\+\+|/odbc/|s_lock.h' | xargs> bart sikkes writes:

so I exclude s_lock.h from the pgindent run for exactly this reason that
the ASM could get corrupted.

>
> > I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
>
> The spinlock assembly code for VAX was corrupted during a code indentation
> run.  I'll try to remember to fix it over the weekend.
>
> --
> Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
>
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: compile problem on a vax

From
Bruce Momjian
Date:
FYI, I just committed the fix to the CVS tree.


> bart sikkes writes:
>
> > I have been trying to compile postgresql-7.0.3 on a uVax II running NetBSD
>
> The spinlock assembly code for VAX was corrupted during a code indentation
> run.  I'll try to remember to fix it over the weekend.
>
> --
> Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
>
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026