NetBSD-Bugs archive

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

port-powerpc/43073: powerpc64 rescue link finds many missing symbols in /usr/lib/libcrypto.a



>Number:         43073
>Category:       port-powerpc
>Synopsis:       powerpc64 rescue link finds many missing symbols in 
>/usr/lib/libcrypto.a
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 29 13:55:00 +0000 2010
>Originator:     Dennis Ferguson
>Release:        very recent 5.99.24
>Organization:
>Environment:
NetBSD acer.hk.akit-ferguson.com 5.99.24 NetBSD 5.99.24 (GENERIC) #0: Sun Mar 
14 17:25:30 HKT 2010  
dennis%acer.hk.akit-ferguson.com@localhost:/usr/obj/sys/arch/amd64/compile/GENERIC
 amd64
>Description:
When building a macppc64 distribution, the link for rescue finds
many, many missing symbols in /usr/lib/libcrypto.a, e.g.:

#      link  obj/rescue
[...]
/usr/NetBSD/src/obj/destdir.macppc/usr/lib/libcrypto.a(bn_nist.o): In function 
`.BN_nist_mod_521':
bn_nist.c:(.text+0x2b8): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x2d0): undefined reference to `.bn_sub_words'
/usr/NetBSD/src/obj/destdir.macppc/usr/lib/libcrypto.a(bn_nist.o): In function 
`.BN_nist_mod_384':
bn_nist.c:(.text+0x518): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x534): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x5cc): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x658): undefined reference to `.bn_add_words'
bn_nist.c:(.text+0x6b4): undefined reference to `.bn_add_words'
/usr/NetBSD/src/obj/destdir.macppc/usr/lib/libcrypto.a(bn_nist.o):bn_nist.c:(.text+0x708):
 more undefined references to `.bn_add_words' follow
/usr/NetBSD/src/obj/destdir.macppc/usr/lib/libcrypto.a(bn_nist.o): In function 
`.BN_nist_mod_384':
bn_nist.c:(.text+0x7a4): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x7fc): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x844): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x87c): undefined reference to `.bn_sub_words'
bn_nist.c:(.text+0x8b8): undefined reference to `.bn_add_words'

All the missing functions are powerpc (not 64) assembly
functions.
>How-To-Repeat:
Do a

    MACHINE=macppc64 ./build.sh distribution
>Fix:
For macppc64 builds we end up with the following two settings
for the cpu-related defines:

    MACHINE_ARCH=  "powerpc64"
    MACHINE_CPU=   "powerpc"

The make machinery in src/crypto/external/bsd/openssl/lib/libcrypto/,
based on this, includes the sources and Makefile includes
from its arch/powerpc subdirectory.  While the powerpc assembly
source files included in there assemble properly for powerpc64
the two ports have different, incompatible, calling and linkage
conventions (encapsulated in ENTRY() macros for NetBSD assembly
functions but not by libcrypto assembly functions).

Since modifying the powerpc functions to work on powerpc64 as
well, while possible, doesn't make sense, I think the quick fix
is to make powerpc64 the library's C versions of the functions
for now.

To do this do the following:

    mkdir crypto/external/bsd/openssl/lib/libcrypto/powerpc64
    cat > crypto/external/bsd/openssl/lib/libcrypto/powerpc64/des.inc
    .include "${.CURDIR}/des.inc"
    ^D

(the file des.inc is for CVS, it does what the build system would
do with no arch/*/des.inc file) and then apply the attached patch
patch to srcs.inc in the libcrypto directory.  Note that, instead
of exclusively using the arch/${MACHINE_CPU} directory if it
exists, the patch makes it first check to see if an
arch/${MACHINE_ARCH} directory exists and, if so, use that
in preference.  Note that I think this is actually a small
fix to the Makefile in general: in the very few cases where
MACHINE_ARCH and MACHINE_CPU differ, MACHINE_ARCH is always a
more specific description of the target architecture, so it
an arch/${MACHINE_ARCH} directory exists at all it is almost
certainly correct to prefer it.

Index: crypto/external/bsd/openssl/lib/libcrypto/srcs.inc
===================================================================
RCS file: /cvsroot/src/crypto/external/bsd/openssl/lib/libcrypto/srcs.inc,v
retrieving revision 1.1
diff -u -r1.1 srcs.inc
--- crypto/external/bsd/openssl/lib/libcrypto/srcs.inc  19 Jul 2009 23:30:44 
-0000      1.1
+++ crypto/external/bsd/openssl/lib/libcrypto/srcs.inc  29 Mar 2010 13:49:23 
-0000
@@ -17,7 +17,13 @@
 
 CRYPTOINCS+=   man.inc
 
-CRYPTO_MACHINE_CPU?=   ${MACHINE_CPU}
+.if !defined(CRYPTO_MACHINE_CPU)
+.if exists(${.CURDIR}/arch/${MACHINE_ARCH})
+CRYPTO_MACHINE_CPU=    ${MACHINE_ARCH}
+.else
+CRYPTO_MACHINE_CPU=    ${MACHINE_CPU}
+.endif
+.endif
 
 .for cryptoinc in ${CRYPTOINCS}
 .if exists(${.CURDIR}/arch/${CRYPTO_MACHINE_CPU}/${cryptoinc})



Home | Main Index | Thread Index | Old Index