using nlist(), not nlist64(), in SunOS5.7_64-bit ... can it be done ???

using nlist(), not nlist64(), in SunOS5.7_64-bit ... can it be done ???

Post by Greg Sylvai » Sat, 17 Jul 1999 04:00:00



Hi all,

I hope someone on this list or from Sun might be able to shed some light
on this problem.

We are trying to run a 32-bit app that runs on Solaris 7 (booted in
32-bit mode) on the same box booted in 64-bit mode.  It turns out that
all calls to nlist() are failing  (for kernel symbols like "sema",
"seminfo", "msginfo", "ncpu", etc...).

We would like to keep one binary that would support both platforms, is
there a way to compile the application in a 32-bit environment so that
it will work on a 64-bit OS ? (i.e. Is there a define(s) that will tell
the compiler to use the "wide" mode when calling specific system calls.
For instance, HP uses _PSTAT64 for this and others.)

Thanks in advance for any assistance,
greg

 
 
 

using nlist(), not nlist64(), in SunOS5.7_64-bit ... can it be done ???

Post by James Maur » Sun, 18 Jul 1999 04:00:00


No, not to my knowledge.

Code that links to libkvm, uses the nlist() routine, opens /dev/mem or
/dev/kmem,
fall under the category of applications that need to be the same data model
as
the underlying kernel.

With a 64-bit (LP64) kernel booted, the code  must also be a 64-bit binary
to
use nlist.

You can, of course, maintain a single source tree;

#ifdef (_LP64)
    64-bit code/calls
#else
    32-bit APIs

The _LP64 symbol is created by the compiler when you build a 64-bit
binary (-xarch=v9 flag).

/jim


>Hi all,

>I hope someone on this list or from Sun might be able to shed some light
>on this problem.

>We are trying to run a 32-bit app that runs on Solaris 7 (booted in
>32-bit mode) on the same box booted in 64-bit mode.  It turns out that
>all calls to nlist() are failing  (for kernel symbols like "sema",
>"seminfo", "msginfo", "ncpu", etc...).

>We would like to keep one binary that would support both platforms, is
>there a way to compile the application in a 32-bit environment so that
>it will work on a 64-bit OS ? (i.e. Is there a define(s) that will tell
>the compiler to use the "wide" mode when calling specific system calls.
>For instance, HP uses _PSTAT64 for this and others.)

>Thanks in advance for any assistance,
>greg


 
 
 

using nlist(), not nlist64(), in SunOS5.7_64-bit ... can it be done ???

Post by Drazen Kac » Sun, 18 Jul 1999 04:00:00



> The _LP64 symbol is created by the compiler when you build a 64-bit
> binary (-xarch=v9 flag).

Nope. It's created by /usr/include/sys/isa_defs.h, at least on Solaris 7.
The compiler is supposed to define __sparcv9.

--
 .-.   .-.    Life is a *ly transmitted disease.
(_  \ /  _)


 
 
 

using nlist(), not nlist64(), in SunOS5.7_64-bit ... can it be done ???

Post by Gavin Maltb » Sun, 18 Jul 1999 04:00:00


Quote:> I hope someone on this list or from Sun might be able to shed some light
> on this problem.

> We are trying to run a 32-bit app that runs on Solaris 7 (booted in
> 32-bit mode) on the same box booted in 64-bit mode.  It turns out that
> all calls to nlist() are failing  (for kernel symbols like "sema",
> "seminfo", "msginfo", "ncpu", etc...).

> We would like to keep one binary that would support both platforms, is
> there a way to compile the application in a 32-bit environment so that
> it will work on a 64-bit OS ? (i.e. Is there a define(s) that will tell
> the compiler to use the "wide" mode when calling specific system calls.
> For instance, HP uses _PSTAT64 for this and others.)

For applications that use libkvm like the above the usual way is
to make use of isaexec - compile separate 32 and 64 bit versions
and use the isaexec mechanism to choose between them:

cd target_dir
cp 32-bit-app sparcv7/app
cp 64-bit-app sparcv9/app
cp /usr/lib/isaexec ./app

Now running ./app will choose the correct executable.

Cheers

Gavin

 
 
 

using nlist(), not nlist64(), in SunOS5.7_64-bit ... can it be done ???

Post by Greg Sylvai » Mon, 19 Jul 1999 04:00:00


OK,

Then has anyone been able to get Gcc (more specifically, egcs-2.91.66)
to build on solaris2.7 booted in 64 bit mode.

Or can you use the 32-bit compiler to build 64-bit binaries ?  I have
not had much luck in this direction either.  I tried to link a simple
nlist program with the /usr/lib/sparv9 libraries without any success.

Thanks again for any assitance,
greg



> > The _LP64 symbol is created by the compiler when you build a 64-bit
> > binary (-xarch=v9 flag).

> Nope. It's created by /usr/include/sys/isa_defs.h, at least on Solaris 7.
> The compiler is supposed to define __sparcv9.

> --
>  .-.   .-.    Life is a *ly transmitted disease.
> (_  \ /  _)