Re: HP-UX 11.31: HP C - Inability to create shared libs for openssl-1.0.1e (cc -r fails) (606 Views)
Reply
Established Member
radhart
Posts: 3
Registered: ‎08-06-2013
Message 1 of 8 (710 Views)

HPUX 11.31: HP C - Inability to Create Shared Libs for openssl-1.0.1e

-------------------------------------------------------------------------------

Board Members:
I've been able to build openssl-fips-2.0 on HP-UX v11.31 using the HP C
compiler.  However, when I try to build FIPS-capable openssl-1.0.1e shared
libs, the "make" fails, referring to an error associated with "CODE_ONE_SYM".
I've searched the web for, found and read many references to HP-UX
"CODE_ONE_SYM" related errors, but have been unable to successfully apply the
information contained therein.  Can someone provide some guidance?  Following
are excerpts from my attempted builds.  Thanks. 

-------------------------------------------------------------------------------

lrwxr-xr-x   1 root       sys             17 Jun 28 16:42 /usr/bin/cc -> /opt/ansic/bin/cc

-r-xr-xr-x   2 bin        bin         925696 May 18  2011 /opt/ansic/bin/cc

---> what /opt/ansic/bin/cc
/opt/ansic/bin/cc:
        $Revision: 92453-07 linker linker crt0.o B.11.64 080728 $
        LINT B.11.11.24 CXREF B.11.11.24
        HP92453-01 B.11.11.24 HP C Compiler
         $ PATCH/11.00:PHCO_27774  Oct  3 2002 09:45:59 $

---> what /opt/aCC/bin/aCC
/opt/aCC/bin/aCC:
        $Revision: 92453-07 linker linker crt0.o B.11.64 080728 $
        HP aC++ B3910B A.03.95
        HP aC++ B3910B A.03.85 Classic Iostream Library
        HP aC++ B3910B A.03.85 Language Support Library

---> ./config --help
Operating system: 9000/800-hp-hpux1x
Configuring for hpux-parisc2-cc
...

-------------------------------------------------------------------------------

In Configure, I modified the "hpux-parisc2-cc" line, adding "-Wl,+allowdups"
as it is necessary for linking the openssl-fips-2.0 FIPS Object Module ...

-------------------------------------------------------------------------------

"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_END
IAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -Wl,+allowdups -ldld:SIXTY_FOUR_BIT MD2
_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:".eval{my $asm=$parisc20_a
sm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_
MAJOR).\$(SHLIB_MINOR):::/pa20_32",

-------------------------------------------------------------------------------

I ran my wrapper script that sets options, runs config and logs the output as
well as configuration information.  The following are some excerpts ...

-------------------------------------------------------------------------------

#Platform:
   HP-UX devcomp2 B.11.31 U 9000/800 2522944933 unlimited-user license
#Cmdline:
   ./config fips shared no-asm no-zlib --with-fipsdir=/usr/local/ssl/fips-2.0 --
with-fipslibdir=/usr/local/ssl/fips-2.0/lib/
#Output:
Operating system: 9000/800-hp-hpux1x
WARNING! If you wish to build 64-bit library then you have to
         invoke './Configure hpux64-parisc2-cc' *manually*.
Configuring for hpux-parisc2-cc
    no-asm          [option]   OPENSSL_NO_ASM
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)
    no-rsax         [forced]   OPENSSL_NO_RSAX (skip dir)
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)
    no-zlib         [option]
    no-zlib-dynamic [default]
IsMK1MF=0
CC            =cc
CFLAG         =+Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_REENTRANT +DA2.0
+DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRAN
T -I$(FIPSDIR)/include
EX_LIBS       =-Wl,+s -Wl,+allowdups -ldld
...
PERL          =/usr/bin/perl
SIXTY_FOUR_BIT mode
DES_RISC1 used
...
Since you've disabled or enabled at least one algorithm, you need to do
the following before building:
 
   make depend

Configured for hpux-parisc2-cc.

#Selected Makefile settings:
PLATFORM=hpux-parisc2-cc
OPTIONS=fips enable-shared --with-fipsdir=/usr/local/ssl/fips-2.0 --with-fipslib
dir=/usr/local/ssl/fips-2.0/lib/ -D_REENTRANT no-asm no-ec_nistp_64_gcc_128 no-g
mp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-rsax no-sctp no-store no-zlib no
-zlib-dynamic no-static-engine
CONFIGURE_ARGS=hpux-parisc2-cc fips shared no-asm no-zlib --with-fipsdir=/usr/lo
cal/ssl/fips-2.0 --with-fipslibdir=/usr/local/ssl/fips-2.0/lib/ -D_REENTRANT
SHLIB_TARGET=hpux-shared
INSTALLTOP=/usr/local/ssl
OPENSSLDIR=/usr/local/ssl
CC= cc
CFLAG= +Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_REENTRANT +DA2.0 +DS2.0 +
O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT -I$(FI
PSDIR)/include
ARFLAGS=
AR= ar $(ARFLAGS) r
RANLIB= /usr/bin/ranlib
LIBDIR=lib
AS=$(CC) -c
ASFLAG=$(CFLAG)
FIPSDIR=/usr/local/ssl/fips-2.0
FIPSLIBDIR=/usr/local/ssl/fips-2.0/lib/
SHELL=/bin/sh
SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
SHARED_SSL=libssl$(SHLIB_EXT)
SHARED_LIBS=$(SHARED_CRYPTO) $(SHARED_SSL)
SHARED_LIBS_LINK_EXTS=.sl.$(SHLIB_MAJOR) .sl
SHARED_LDFLAGS=-b
./apps/Makefile:
SHLIB_TARGET=
./crypto/srp/Makefile:
SHLIB_TARGET=
./crypto/srp/Makefile:
OPENSSLDIR=     /usr/local/ssl
./crypto/ts/Makefile:
OPENSSLDIR=     /usr/local/ssl
./demos/easy_tls/Makefile:
OPENSSLDIR=../..

-------------------------------------------------------------------------------

I ran "make depend", then "make".  The latter emitted the following (edited
for brevity):

-------------------------------------------------------------------------------

#Project:
   openssl-1.0.1e
#Who:
   cwelling as cwelling
#Platform:
   HP-UX devcomp2 B.11.31 U 9000/800 2522944933 unlimited-user license
#Environment(PATH|LIB|INCLUDE|SSL):
   E2E_U310_SSL=/home/cwelling/E2E/udc-3.1.0/d.dev/d.openssl/openssl-1.0.1e
   E2E_U310_SSLFOM=/home/cwelling/E2E/udc-3.1.0/d.dev/d.openssl/openssl-fips-2.0
   PATH=/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bi
n:/opt/perl/bin:/opt/ipf/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/o
pt/wbem/bin:/opt/wbem/sbin:/usr/bin/X11:/opt/sec_mgmt/bastille/bin:/opt/drd/bin:
/opt/dsau/bin:/opt/dsau/sbin:/opt/resmon/bin:/opt/gnome/bin:/opt/perf/bin:/usr/c
ontrib/kwdb/bin:/opt/graphics/common/bin:/opt/prm/bin:/usr/sbin/diag/contrib:/op
t/sfm/bin:/opt/sec_mgmt/spc/bin:/opt/ssh/bin:/opt/swa/bin:/opt/hpsmh/bin:/opt/up
grade/bin:/opt/gwlm/bin:/usr/contrib/bin/X11:/opt/ignite/bin:/opt/atok/bin:/opt/
perl_32/bin:/opt/perl_64/bin:/opt/propplus/bin:/opt/swm/bin:/opt/thunderbird:/op
t/langtools/bin:/opt/wlm/bin:/opt/aCC/bin:/opt/cadvise/bin:/opt/sentinel/bin:/op
t/imake/bin:/usr/local/bin:/usr/sbin:/home/cwelling/E2E/d.tools:/home/cwelling/E
2E/d.docs:/home/cwelling/E2E/d.cmds
#Cmdline:
   make
#Output:
 
making all in crypto...
   echo crypto:CGWDBG
crypto:CGWDBG
   echo crypto:TOP=..
crypto:TOP=..
   echo crypto:CFLAGS=-I. -I.. -I../include  +Z -DOPENSSL_PIC -DOPENSSL_THREADS
 -DDSO_DL -D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_EN
DIAN -DMD32_XARRAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/include
crypto:CFLAGS=-I. -I.. -I../include +Z -DOPENSSL_PIC -DOPENSSL_THREADS -DDSO_DL
-D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD3
2_XARRAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/include
   echo crypto:GENERAL=Makefile README crypto-lib.com install.com
crypto:GENERAL=Makefile README crypto-lib.com install.com
   echo crypto:SHLIB_TARGET=hpux-shared
crypto:SHLIB_TARGET=hpux-shared
   echo crypto:EX_LIBS=-Wl,+s -Wl,+allowdups -ldld
crypto:EX_LIBS=-Wl,+s -Wl,+allowdups -ldld
   ( echo "#ifndef MK1MF_BUILD"; \
   echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
   echo '  #define CFLAGS "cc +Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_RE
ENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XAR
RAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/include"'; \
   echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
   echo '  #define CFLAGS "cc +Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_RE
ENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XAR
RAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/include"'; \
   echo '  #define PLATFORM "hpux-parisc2-cc"'; \
   echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
   echo '#endif' ) >buildinf.h
   cc -I. -I.. -I../include  +Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_REE
NTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARR
AY -D_REENTRANT -I/usr/local/ssl/fips-2.0/include -c cryptlib.c
...
   cc -I. -I.. -I../include  +Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_REE
NTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARR
AY -D_REENTRANT -I/usr/local/ssl/fips-2.0/include -c mem_clr.c
   ar  r ../libcrypto.a cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.
o ebcdic.o  uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o mem_clr.
o
ar: creating ../libcrypto.a
   [ -z "/usr/local/ssl/fips-2.0/lib/" ] || ar  r ../libcrypto.a /usr/local/ssl/
fips-2.0/lib/fipscanister.o
   /usr/bin/ranlib ../libcrypto.a || echo Never mind.
making all in crypto/objects...
   cc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  +Z -DOPENSSL_P
IC -DOPENSSL_THREADS  -DDSO_DL -D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_ty
ped -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/i
nclude -c o_names.c
...
making all in crypto/dso...
   cc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  +Z -DOPENSSL_P
IC -DOPENSSL_THREADS  -DDSO_DL -D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_ty
ped -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/i
nclude -c dso_dl.c
cc: "dso_dl.c", line 144: warning 604: Pointers are not assignment-compatible.
cc: "dso_dl.c", line 144: warning 563: Argument #1 is not the correct type.
...
cc: "dso_dl.c", line 232: warning 604: Pointers are not assignment-compatible.
cc: "dso_dl.c", line 232: warning 563: Argument #1 is not the correct type.
   cc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  +Z -DOPENSSL_P
IC -DOPENSSL_THREADS  -DDSO_DL -D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_ty
ped -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/i
nclude -c dso_dlfcn.c
...
   cc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  +Z -DOPENSSL_P
IC -DOPENSSL_THREADS  -DDSO_DL -D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_ty
ped -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/i
nclude -c cm_pmeth.c
   ar  r ../../libcrypto.a cmac.o cm_ameth.o cm_pmeth.o
   /usr/bin/ranlib ../../libcrypto.a || echo Never mind.
   if [ -n "libcrypto.sl.1.0.0 libssl.sl.1.0.0" ]; then \
      (cd ..; make libcrypto.sl.1.0.0); \
   fi
   [ -z "libcrypto" ] || cc +Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_REEN
TRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRA
Y -D_REENTRANT -I/usr/local/ssl/fips-2.0/include -Iinclude \
      -DFINGERPRINT_PREMAIN_DSO_LOAD -o fips_premain_dso  \
      /usr/local/ssl/fips-2.0/lib/fips_premain.c /usr/local/ssl/fips-2.0/lib/fip
scanister.o \
      libcrypto.a -Wl,+s -Wl,+allowdups -ldld
/usr/ccs/bin/ld: (Warning) Overriding $global$(Data) in file /usr/local/ssl/fips
-2.0/lib/fipscanister.o with symbol $global$(Data) in file /opt/langtools/lib/cr
t0.o
/usr/ccs/bin/ld: (Warning) Overriding $START$(Code) in file /usr/local/ssl/fips-
2.0/lib/fipscanister.o with symbol $START$(Code) in file /opt/langtools/lib/crt0
.o
/usr/ccs/bin/ld: (Warning) Overriding $ARGV(Data) in file /usr/local/ssl/fips-2.
0/lib/fipscanister.o with symbol $ARGV(Data) in file /opt/langtools/lib/crt0.o
/usr/ccs/bin/ld: (Warning) Overriding _environ(Data) in file /usr/local/ssl/fips
-2.0/lib/fipscanister.o with symbol _environ(Data) in file /opt/langtools/lib/cr
t0.o
/usr/ccs/bin/ld: (Warning) Overriding _CPU_REVISION(Data) in file /usr/local/ssl
/fips-2.0/lib/fipscanister.o with symbol _CPU_REVISION(Data) in file /opt/langto
ols/lib/crt0.o
...
/usr/ccs/bin/ld: (Warning) Overriding ___fini_len(Data) in file /usr/local/ssl/f
ips-2.0/lib/fipscanister.o with symbol ___fini_len(Data) in file /opt/langtools/
lib/crt0.o
/usr/ccs/bin/ld: CODE_ONE_SYM fixup to non-code subspace in file /usr/local/ssl/
fips-2.0/lib//fipscanister.o - shared library must be position independent. Use
+z or +Z to recompile.
*** Error exit code 1
Stop.
*** Error exit code 1
Stop.
*** Error exit code 1
Stop.
*** Error exit code 1
Stop.
*** Error exit code 1
Stop.

 


 

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,779
Registered: ‎03-06-2006
Message 2 of 8 (695 Views)

Re: HP-UX 11.31: HP C - Inability to create shared libs for openssl-1.0.1e (non PIC)

[ Edited ]

>I've searched the web for, found and read many references to HP-UX "CODE_ONE_SYM" related errors, but have been unable to successfully apply the info

 

Why not?  The error means you didn't compile that with +z/+Z.  Or the gcc -fPIC/-fpic.

All of your errors and warnings are due to: fipscanister.o

 

What's in that file and what's the compile line?

 

>In Configure, I modified the "hpux-parisc2-cc" line, adding "-Wl,+allowdups" as it is necessary for linking the openssl-fips-2.0 FIPS Object Module ...

 

This is mighty suspicious.

 

>ld: (Warning) Overriding $global$(Data) in file /usr/local/ssl/fips-2.0/lib/fipscanister.o with symbol $global$(Data) in file /opt/langtools/lib/crt0.o

 

There is something very scary in fipscanister.o if you get these warnings!  +allowdups is NOT a good idea here.

 

>ld: CODE_ONE_SYM fixup to non-code subspace in file /usr/local/ssl/fips-2.0/lib//fipscanister.o - shared library must be position independent. Use +z or +Z to recompile.

 

I assume this is the failing link line:

cc +Z -DOPENSSL_PIC -DOPENSSL_THREADS  -DDSO_DL -D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT -I/usr/local/ssl/fips-2.0/include -Iinclude \
      -DFINGERPRINT_PREMAIN_DSO_LOAD -o fips_premain_dso  \
      /usr/local/ssl/fips-2.0/lib/fips_premain.c /usr/local/ssl/fips-2.0/lib/fipscanister.o \
      libcrypto.a -Wl,+s -Wl,+allowdups -ldld

 

Something strange here.  You get an error as if you were creating a shlib but I don't see -b above?

Please use plain text.
Esteemed Contributor
ranganath ramachandra
Posts: 375
Registered: ‎05-16-2003
Message 3 of 8 (679 Views)

Re: HP-UX 11.31: HP C - Inability to create shared libs for openssl-1.0.1e (non PIC)

[ Edited ]

i  see "-b" in

-------------------------------------------------------------------------------

In Configure, I modified the "hpux-parisc2-cc" line, adding "-Wl,+allowdups"
as it is necessary for linking the openssl-fips-2.0 FIPS Object Module ...

-------------------------------------------------------------------------------

"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY -D_REENTRANT::::-Wl,+s -Wl,+allowdups -ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:".eval{my $asm=$parisc20_asm;$asm=~s/2W\./2\./;$asm=~s/:64/:32/;$asm}.":dl:hpux-shared:+Z:-b:.sl.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/pa20_32",

 and

SHARED_LDFLAGS=-b

 

also,

>ld: (Warning) Overriding $global$(Data) in file /usr/local/ssl/fips-2.0/lib/fipscanister.o with symbol $global$(Data) in file /opt/langtools/lib/crt0.o

 they may have "-r"-linked crt0.o into this file fipscanister.o - they should not.

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,779
Registered: ‎03-06-2006
Message 4 of 8 (671 Views)

Re: HP-UX 11.31: HP C - Inability to create shared libs for openssl-1.0.1e (non PIC)

[ Edited ]

>I  see "-b" in

 

Yes but how did it get from there to not appear on the c link line and then to ld?

 

>they may have "-r"-linked crt0.o into this file fipscanister.o

 

Yes more dangerous options and tricky things.  :-(

I would hope these have appropriate comments.

Please use plain text.
Established Member
radhart
Posts: 3
Registered: ‎08-06-2013
Message 5 of 8 (639 Views)

Re: HPUX 11.31: HP C - Inability to Create Shared Libs for openssl-1.0.1e

Dennis/Ranganath:

I have not wanted to reply until I had something concrete to respond with - I don't yet - but, I wanted to express my appreciation for your input ... I originally thought it possible that this was too specific a topic to be of interest to anyone.

Briefly, since returning to this task on Tuesday, I have tried to take your input and what I discern from successfully building - with gcc - FIPS-capable openssl-1.0.1e on a Sun SPARC/Solaris 10 platform and on an Intel x86-x64/RHEL platform to make some progress solving this problem.  With regard to the latter, I've spent some time dissecting the differences between the command-lines of the successful builds with my current attempts.  I have not made any progress with regard to the crt0.o "over-ride" events.

 

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,779
Registered: ‎03-06-2006
Message 6 of 8 (630 Views)

Re: HP-UX 11.31: HP C - Inability to create shared libs for openssl-1.0.1e (non PIC)

[ Edited ]

>until I had something concrete to respond with

 

This would be the exact link line.  And how you built fipscanister.o.

 

>what I discern from successfully building -...  on a Sun SPARC

 

I don't think that will be helpful at all.  PA-RISC is just different.  :-)

Please use plain text.
Established Member
radhart
Posts: 3
Registered: ‎08-06-2013
Message 7 of 8 (616 Views)

Re: HP-UX 11.31: HP C - Inability to Create Shared Libs for openssl-1.0.1e (non PIC)

Dennis:

Thanks for your interest. 

So, I stepped back from trying to build the FIPS-capable openssl-1.0.1e to determine if something was wrong with the OpenSSL FIPS Object Module (OFOM) I built with openssl-fips-2.0 (For simplicity, I'm equating the OFOM with  fipscanister.o).  I hadn’t immediately suspected a problem with the OFOM because it linked with a “no-shared” openssl-1.0.1e build to create an openssl executable that appeared to function in "FIPS mode".  I took another look at my attempted build of the OFOM in ../openssl-fips-2.0 and took note of the make output tail ...

 

---BEGIN---

...

+ cc -I. -I.. -I../include \

  -DOPENSSL_FIPSCANISTER +Z -DOPENSSL_PIC -DOPENSSL_THREADS -DDSO_DL \

  -D_REENTRANT +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed -Ae +ESlit \

  -DMD32_XARRAY -D_REENTRANT -DHMAC_EXT="sha1" -Wl,+sectionmerge -r -nostdlib \

  -o fipscanister.o fips_start.o ... [fips_* and misc object files] ... fips_end.o

cc: warning 422: Unknown option "-nostdlib" ignored.

/usr/ccs/bin/ld: (Warning) Shared library /usr/lib/libc.sl referenced during relocatable link - ignored

./fips_standalone_sha1 fipscanister.o > fipscanister.o.sha1

ar  r ../libcrypto.a fipscanister.o

ar: creating ../libcrypto.a

        /usr/bin/ranlib ../libcrypto.a || echo Never mind.

        if [ "y" = "n" -a -n "fipscanister.o" ]; then ar  r ../libcrypto.a fipscanister.o; fi

---END---

 

Note: Interested readers will find pertinent compiler and linker definitions below.

 

So, I apparently ignored the warning about “-nostdlib” that aCC had ignored and “standard” system startup files (crt0.o) were NOT excluded from fipscanister.o.  To check this, I quickly ran “objdump –t fipscanister.o” and resolved symbols like “_crt_open”, open”, and “close” were displayed; i.e.,

 

...

00001d48 l     F $CODE$ _crt_open

00001d68 l     F $CODE$ _crt_read

00001e68 l     F $CODE$ lseek

00001da8 l     F $CODE$ _crt_close

00000004         *COM*  _thread_init

00001de8 l     F $CODE$ open

00001e08 l     F $CODE$ close  

...

 

I’m not clear about what the next warning in the following line indicates; i.e., “/usr/ccs/bin/ld: (Warning) Shared library ...”

 

So, it looks like I first must determine if there is a way to avoid linking “standard” system startup files into fipscanister.o using the HP C compiler (aCC) and linker, right?

 

Thanks.

  

Selected option definitions ...

 

“aCC” manpage:

 

      -Ae        Turns on ANSI C c89 mode. This option allows

           compilation of c89 compatible C source programs just

           like C compiler.  Additional HP ANSI-C compiler

           features supported under the -Ae option may be enabled

           by this option in the future.  For limitations see the

           HP aC++ Online Programmer's Guide.

 

      +ES[no]lit     Place [ do not place ] string literals into read-only

           memory.  This may save space in the resulting

           executable by coalescing identical string literals, and

           can promote data sharing in a multi-user application.

           The default is +ESlit.

 

      +z,+Z      Causes the compiler to generate position independent

           code (PIC) for use in building shared libraries.  The

           option -G is ignored if used when generating PIC.

           Normally, +z should be used to generate PIC; however,

           when certain limits are exceeded, +Z is required to

           generate PIC.  The linker ld(1) issues the error

           indicating when +Z is required.  The default is +Z when

           +DA2.0W is specified.  If both +z and +Z are specified,

           only the last one encountered applies.  For a more

           complete discussion regarding PIC and these options,

           see HP-UX Linker and Libraries Online User's Guide and

           the manual Programming on HP-UX.

 

“ld” manpage:

 

      -r      Retain relocation information in the output file

           for subsequent re-linking.  The ld command does

           not report undefined symbols.   This option cannot

           be used when building a shared library ( (-b) or

           in conjunction with -A or +ild incremental linking

           options.

 

      +nosectionmerge

           Used with the -r option to allow procedures to be

           positioned independently.  The default is to merge

           all procedures into a single section.

 

“gcc” manpage:

 

      -nostdlib

     Do not use the standard system startup files or libraries when

     linking.  No startup files and only the libraries you specify will

     be passed to the linker.  The compiler may generate calls to

     "memcmp", "memset", "memcpy" and "memmove".  These entries are

     usually resolved by entries in libc. These entry points should be

     supplied through some other mechanism when this option is

     specified.

 

     One of the standard libraries bypassed by -nostdlib and

     -nodefaultlibs is libgcc.a, a library of internal subroutines that

     GCC uses to overcome shortcomings of particular machines, or

     special needs for some languages.

 

     In most cases, you need libgcc.a even when you want to avoid other

     standard libraries.  In other words, when you specify -nostdlib or

     -nodefaultlibs you should usually specify -lgcc as well.  This

     ensures that you have no unresolved references to internal GCC

     library subroutines.  (For example, __main, used to ensure C++

     constructors will be called.)

 

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,779
Registered: ‎03-06-2006
Message 8 of 8 (606 Views)

Re: HP-UX 11.31: HP C - Inability to create shared libs for openssl-1.0.1e (cc -r fails)

[ Edited ]

>if something was wrong with the OpenSSL FIPS Object Module (OFOM) I built with openssl-fips-2.0

 

Well, it isn't PIC because of crt0.o.

 

+ cc  +DA2.0 +O3  -Wl,+sectionmerge -r -o fipscanister.o fips_start.o ... fips_end.o
ld: (Warning) Shared library /usr/lib/libc.sl referenced during relocatable link - ignored

 

It appears that the PA C compiler hasn't implemented -r correctly.  You could switch to aCC to do this.

Or invoke ld -r directly.

 

>"standard" system startup files (crt0.o) were NOT excluded from fipscanister.o.

 

Yes, -r should never have included them.

 

>I ran “objdump –t fipscanister.o” and resolved symbols like “_crt_open”, open”, and “close” were displayed

 

You shouldn't be running foreign devil tools.  The correct command is: nm -px fipscanister.o

 >I’m not clear about what the next warning in the following line indicates; i.e., "ld: (Warning) Shared library ..."

 

This shouldn't appear with -r.
 
>if there is a way to avoid linking “standard” system startup files into fipscanister.o using the HP C compiler

 

It looks like you can't.

 

aCC should work and of course ld works.
 

>HP C compiler (aCC)

 

(There is no connection between cc and aCC on PA-RISC.)

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation