[OpenIndiana-discuss] running sunpro binaries

Udo Grabowski (IMK) udo.grabowski at kit.edu
Tue Jan 9 10:40:53 UTC 2024


On 09/01/2024 03:40, Goetz T. Fischer wrote:
> On Mon, 8 Jan 2024 18:17:17 -0800, Alan Coopersmith wrote:
>> On 1/8/24 17:55, Goetz T. Fischer wrote:
>>> hi again,
>>>
>>> i tried to run something compiled with sunpro on solaris 11 on indiana and it almost worked. i put the
>>> additional libs in place and everything looked fine. however, running the program in question failed
>>> with:
>>>
>>> ld.so.1: prog: fatal: prog: hardware capability (CA_SUNW_HW_2) unsupported: 0x80 [ RDSEED ]
>>>
>>> of course the first impression is that the cpu simply doesn't support RDSEED but that's not the case.
>>> it
>>> does support it and the program in question runs fine on the same machine under solaris 11.
>>> so it seems like something sunpro produces gets misinterpreted.
>>>
>>> maybe someone else ran into the same problem and found a solution?
>>
>> Unfortunately, illumos & Solaris diverged on the id's used for hardware
>> capabilities added after the fork.
>>
>> On illumos, AV_386_2_RDSEED is 0x00000080 and AV_386_2_BMI2 is 0x00000008,
>> but on Solaris, AV2_386_BMI2 is 0x00000080 and AV2_386_RDSEED is 0x00000800.
>> (You can see this in the /usr/include/sys/auxv_386.h file on each system.)
>>
>> You might be able to use "env LD_DEBUG=cap" to see what capabilities the OS
>> thinks your hardware supports and "env LD_HWCAP=+RDSEED" to override that
>> detection.
>>
>> More info about this is documented in
>>
> https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/capability-processing.html
>> and on the illumos side in https://illumos.org/man/1/ld.so.1 .
>>
>> -alan-
> 
> ah, i see, much thanks for the info!
> 
> i always liked the way sunpro binaries expose these cpu features by just using "file" or "ldd". that can
> save a lot of time investigating why something doesn't run.
> 

There's a way to repair binaries and libraries:

isainfo -v
elfdump -H <file>

will show you the capabilities of the machine and the requirements
of your binary.

With

elfedit -e 'cap:hw2 -and -cmp rdseed' <file>

you can delete that requirement from the binary if rdseed is not
seen on the CPU.

You can also specify a mapfile during linking to explicitly
set the hw caps:

$ cat mapfile
$mapfile_version 2
   CAPABILITY {
     HW = SSE SSE2;
};

> btw given its age, does it still make sense to use sunpro performance wise? maybe gcc and/or clang did
> catch up in the meantime or maybe got even better?

We still use the sunpro compiler for Fortran 90/95, where gfortran is
still inferior in language conformity, and the Intel compiler is too
slow in compiling our project on Linux environments (...and non-existent
for illumos), and the binaries are farely compatible to the Intel ifort.
For C/C++, I would absolutely prefer gcc/g++. Also note that licensing
and binary compatibility would restrict us using anything above sunpro
12.1u1, so it's also getting outdated in terms of supported standards.


More information about the openindiana-discuss mailing list