Karim BELABAS on Sat, 3 Oct 1998 13:44:50 +0200 (MET DST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: -KPIC


[Ilya:]
> Do I understand it correct that PARI cannot be put into a shared
> library nowadays?  I tried to compile sparc assembler with -K PIC, and
> got a segfault.  
> 
> AFAIK Solaris allows DLLs without -K PIC, but they are not shared.  Do
> not know about SunOS4.  Most anyone else requires PIC for shared
> libraries - except platforms which have "hard linking" DLLs without
> any relocation, like OS/2, AIX, DG-UX (?).
> 
> Is there any architecture ((except port ;-) which requires PIC, and
> PARI supports it?  Currently the prospect of having PARI as
> DynaLoadable Perl extension looks kinda moot...

Very weird; could you be more specific? On most architectures mentionned in
the MACHINES file (including solaris-[super|micro|ultra]sparc), a
DLL libpari.so could be built, gp-dyn linked with it and gave sensible
running times. In my experience, (with gcc mostly) -fPIC flag is not needed
and, when used, give disastrous results (_slow_ binaries).

HPUX was a (hard) special case and the only one I could test where gcc
-fPIC / cc +z was actually needed (and giving an executable about least
twice slower).

Karim.

P.S: Here's my current (2.0.12 not released yet) MACHINES file
                                                  Bench (in ms)
Arch / proc:         OS:             Configure:     sta:    dyn:  GP version:
==============================================================================
DEC/Alpha
alpha21164   600MHz  OSF1-V4.0D      cc  X11 dl2    3996    4384   2.0.10   LG
alpha21164   533Mhz  Linux 2.0.34    gcc X11 dl2    5105    5031   2.0.10   JC
alpha21164   500Mhz  Linux-2.0.30    gcc X11 dl2    4806    4791   2.0.12
alpha21064   172Mhz  OSF1-3.0        cc  X11 dl2   30208   29754   2.0.12
------------------------------------------------------------------------------
Sun/SPARC
UltraSPARC10 300MHz  Solaris-2.6     gcc X11 dl2    5932    6102   2.0.12   GN
UltraSPARC   300MHz  Solaris-2.5     gcc X11 dl2    7643    7566   2.0.9    IS
UltraSPARC2i 270MHz  Solaris-2.6     gcc X11 dl2    7068    7218   2.0.10   LG
UltraSPARC2i 270MHz  Solaris-2.6     cc  X11 dl2    9200    9970   2.0.10   LG
UltraSPARC   167MHz  Solaris-2.6     gcc X11 dl2    9790   10158   2.0.12   GN
UltraSPARC   167MHz  Solaris-2.5     gcc X11 dl2   10257   10125   2.0.12
UltraSPARC   167MHz  Solaris-2.5     g++ X11 dl2   13474   13418   2.0.9 (7)LG
UltraSPARC   167MHz  Solaris-2.5     CC  X11 -     15778   16400   2.0.9    LG
UltraSPARC   167MHz  Solaris-2.5     cc  X11 dl2   16241   17048   2.0.9    LG
UltraSPARC   143MHz  Solaris-2.5     gcc X11 dl2   11335   11613   2.0.12
SuperSPARC2   75MHz  Solaris-2.5     gcc X11 dl2   16969   17013   2.0.10   LG
SuperSPARC    40MHz  SunOS-4.1.3     gcc X11 dl2   28254   28394   2.0.12
SuperSPARC    40Mhz  Solaris-2.5     gcc X11 dl2   27828   28353   2.0.12
TurboSPARC   170MHz  Solaris-2.5     gcc X11 dl2   15907   16529   2.0.9    LG
MicroSPARC2  110MHz  NextStep-v3     cc    -   -   37794       -   2.0.9    LG
MicroSPARC2  110MHz  SunOS-4.1.4     gcc X11 dl2   31476   32123   2.0.9    LG
MicroSPARC2  110MHz  Solaris-2.5     gcc X11 dl2   22664   23406   2.0.12
SPARCv7(SS2)  40MHz  SunOS-4.1.3     gcc X11 dl   115212  115364   2.0.9    LG
SPARCv7(ELC)  33MHz  SunOS-4.1.1     gcc X11   -  139406       -   2.0.8    GN
------------------------------------------------------------------------------
Intel/x86
PentiumII    333Mhz  Linux-2.0.32    gcc X11 dl2    5006    4762   2.0.10   JC
PentiumII    300MHz  NextStep-3.3    cc    -   -    5325       -   2.0.10
Pentium      266Mhz  Linux-2.0.29    gcc X11 dl2    7256    7044   2.0.11
PentiumII    233MHz  FreeBSD-2.2.5   gcc X11 dl2    6251    6114   2.0.11
PentiumPro   200MHz  Linux-2.0.27    gcc X11 dl2   12088   12214   2.0.4k
Pentium      200Mhz  NextStep-3.3    cc    -   -   16035       -   2.0.6    MS
Pentium      166MHz  FreeBSD-2.2.5   gcc X11 dl2   15159   14481   2.0.11
Pentium      166MHz  Solaris-2.6     gcc X11 dl2   13550   13746   2.0.12   GN
Pentium      133MHz  Linux-1.2.8     gcc X11   -   15448       -   2.0.12(5)GN
Pentium      133MHz  FreeBSD-2.2.5   gcc X11 dl2   15231   17259   2.0.10   KK
486dx2        50MHz  Linux-2.0.33    gcc X11 dl2  213710  216224   2.0.9    LG
486dx         50MHz  DOS-5.0         gcc   -   -   77639       -   2.0.12
*i860         40MHz  Concentrix      cc  X11   -  147989       -   2.0.9    LG
------------------------------------------------------------------------------
Motorola
*MC68040      25MHz  NextStep-v2     cc    -   -  250542       -   2.0.9    LG
MC68030       25MHz  SunOS-4.0.3     gcc X11   -  683736  685248   2.0.9 (4)
*MC68030      25MHz  SunOS-4.0.3     gcc X11   - 1034136 1038368   2.0.9
------------------------------------------------------------------------------
IBM/POWER,PowerPC
*PPC604e     233MHz  AIX-4.2         cc  X11   -    8616       -   2.0.12(3)GN
*PPC604      133MHz  AIX-4.2         cc  X11   -   21528       -   2.0.4 (3)GN
*PPC601      100MHz  AIX-4.1         cc  X11   -   21692       -   2.0.4 (3)GN
*PPC601       75MHz  Linux-2.1.24    gcc   - dl2   51810   52702   2.0.9    EK
*PPC601       66MHz  AIX-3.2.5       cc  X11   -   66280       -   2.0.4 (3)GN
*POWER2       66MHz  AIX-4.2         cc  X11   -   37592       -   2.0.4 (3)GN
------------------------------------------------------------------------------
SGI/MIPS
*R4000     50/70MHz  IRIX-5.2        gcc X11 dl2   70764   70114   2.0.9 (1)TP
*R4000     50/70MHz  IRIX-5.2        cc  X11 dl2   81467   80176   2.0.9 (2)TP
*R10000      196MHz  IRIX-6.4        cc  X11 dl2    8461    9856   2.0.10(8)TP
------------------------------------------------------------------------------
HP/PA-RISC
HPPA9000/778  134MHz HPUX-10.20      cc  X11   -   16276   29212   2.0.12(9)
*HPPA9000/778 134MHz HPUX-10.20      cc  X11   -   23666           2.0.12(10)
HPPA9000/735  100MHz HPUX-10.20      cc  X11   -   25106   38898   2.0.12(9)
HPPA9000/720     ??? HPUX-10.20      cc  X11   -   66138       -   2.0.9
*HPPA9000/720    ??? HPUX-10.20      cc  X11   -  101114  119626   2.0.9
HPPA9000/712   90MHz HPUX-10.20      cc  X11   -   26756   45196   2.0.12(9)
*HPPA9000/712    ??? HPUX-10.10      gcc X11   -   66328   71250   2.0.5 (6)
*HPPA7100LC    60MHz NextStep-v3     cc    -   -   62866       -   2.0.10   LG
*HPPA7000      50MHz HPUX-09.05      cc  X11   -  113406  152778   2.0.9    LG
------------------------------------------------------------------------------

Notes:
======
(1) uncomment the last PLOTLIBS= in Makefile
(2) same as above, compiled with cc -O2
(3) AIX/POWER versions built with cc options including
      -qarch=com -qtune=601 (any other tuning makes them slower)
(4) Slightly different results in make bench (last decimal different in
    3 tests, due to a different mulsr())
(5) built with gcc 2.7.2p
(6) gcc -fPIC (otherwise /usr/bin/ld will not link the shared library)
(7) the `program' bench fails on "install(addii)". But if the symbol addii
    is declared within extern "C" {} in paridecl.h, it works.

(8) use
CC         = cc -64
CFLAGS     = -O -OPT:Olimit=2170
LD         = cc -64
LDFLAGS    = -O -L/usr/lib64
DLLD       = cc -64
DLLDFLAGS  = -shared -elf -no_unresolved -all -L/usr/lib64
CPP        = cc -64 -E -I.

(9) * for gp-dyn: in o-hpux.hppa/Makefile, move kernel.o from OBJS to OBJSGP. I
couldn't find a way to have HP as (needed since gas doesn't understand our
syntax) to produce PIC code, hence kernel.o has to be linked explicitly with
all programs compiled with libpari.sl

    * for gp-sta: remove +z from CFLAGS, final link only worked with the
following command line (there has to be a better way...):

cc dummy.c -c
cc -o gp-sta -Wl,-a,archive -O dummy.o [... rest as produced by Configure]

where dummy.c defines two dummy symbols (referenced in static libc):

shl_findsym(){}
   shl_load(){}

Whatever else I tried, linking failed:

/usr/ccs/bin/ld: Data address is out of range for short load or store
   Reference from:  kernel.o(0x8) [for all symbols defined in level0.s]

(10) compiled without +z flags
--
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://pari.home.ml.org